Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXRealSpinner.h
1 /********************************************************************************
2 * *
3 * R e a l - V a l u e d S p i n n e r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 2003,2024 by Bill Baxter. All Rights Reserved. *
7 *********************************************************************************
8 * This library is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU Lesser General Public License as published by *
10 * the Free Software Foundation; either version 3 of the License, or *
11 * (at your option) any later version. *
12 * *
13 * This library is distributed in the hope that it will be useful, *
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
16 * GNU Lesser General Public License for more details. *
17 * *
18 * You should have received a copy of the GNU Lesser General Public License *
19 * along with this program. If not, see <http://www.gnu.org/licenses/> *
20 ********************************************************************************/
21 #ifndef FXREALSPINNER_H
22 #define FXREALSPINNER_H
23 
24 #ifndef FXPACKER_H
25 #include "FXPacker.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  REALSPIN_NORMAL = 0,
34  REALSPIN_CYCLIC = 0x00020000,
35  REALSPIN_NOTEXT = 0x00040000,
36  REALSPIN_NOMAX = 0x00080000,
37  REALSPIN_NOMIN = 0x00100000,
38  REALSPIN_LOG = 0x00200000
39  };
40 
41 
42 class FXTextField;
43 class FXDial;
44 
45 
47 class FXAPI FXRealSpinner : public FXPacker {
48  FXDECLARE(FXRealSpinner)
49 protected:
50  FXTextField *textField; // Text field
51  FXArrowButton *upButton; // The up button
52  FXArrowButton *downButton; // The down button
53  FXdouble range[2]; // Reported data range
54  FXdouble incr; // Increment
55  FXdouble gran; // Granularity
56  FXdouble pos; // Current position
57 protected:
58  FXRealSpinner();
59 private:
61  FXRealSpinner& operator=(const FXRealSpinner&);
62 public:
63  long onUpdIncrement(FXObject*,FXSelector,void*);
64  long onCmdIncrement(FXObject*,FXSelector,void*);
65  long onUpdDecrement(FXObject*,FXSelector,void*);
66  long onCmdDecrement(FXObject*,FXSelector,void*);
67  long onChgEntry(FXObject*,FXSelector,void*);
68  long onCmdEntry(FXObject*,FXSelector,void*);
69  long onWheelEntry(FXObject*,FXSelector,void*);
70  long onKeyPress(FXObject*,FXSelector,void*);
71  long onKeyRelease(FXObject*,FXSelector,void*);
72  long onCmdSetValue(FXObject*,FXSelector,void*);
73  long onCmdSetIntValue(FXObject*,FXSelector,void*);
74  long onCmdGetIntValue(FXObject*,FXSelector,void*);
75  long onCmdSetLongValue(FXObject*,FXSelector,void*);
76  long onCmdGetLongValue(FXObject*,FXSelector,void*);
77  long onCmdSetIntRange(FXObject*,FXSelector,void*);
78  long onCmdGetIntRange(FXObject*,FXSelector,void*);
79  long onCmdSetRealValue(FXObject*,FXSelector,void*);
80  long onCmdGetRealValue(FXObject*,FXSelector,void*);
81  long onCmdSetRealRange(FXObject*,FXSelector,void*);
82  long onCmdGetRealRange(FXObject*,FXSelector,void*);
83  long onFocusSelf(FXObject*,FXSelector,void*);
84 public:
85  enum{
86  ID_INCREMENT=FXPacker::ID_LAST,
87  ID_DECREMENT,
88  ID_ENTRY,
89  ID_LAST
90  };
91 public:
92 
94  FXRealSpinner(FXComposite *p,FXint cols,FXObject *tgt=nullptr,FXSelector sel=0,FXuint opts=REALSPIN_NORMAL,FXint x=0,FXint y=0,FXint w=0,FXint h=0,FXint pl=DEFAULT_PAD,FXint pr=DEFAULT_PAD,FXint pt=DEFAULT_PAD,FXint pb=DEFAULT_PAD);
95 
97  virtual void layout();
98 
100  virtual void disable();
101 
103  virtual void enable();
104 
106  virtual FXint getDefaultWidth();
107 
109  virtual FXint getDefaultHeight();
110 
112  virtual void setFocus();
113 
115  virtual void killFocus();
116 
118  void increment(FXbool notify=false);
119 
121  void incrementByAmount(FXdouble amount,FXbool notify=false);
122 
124  void decrement(FXbool notify=false);
125 
127  void decrementByAmount(FXdouble amount,FXbool notify=false);
128 
130  FXbool isCyclic() const;
131 
133  void setCyclic(FXbool cyclic);
134 
136  FXbool isTextVisible() const;
137 
139  void setTextVisible(FXbool flag);
140 
142  virtual void setValue(FXdouble value,FXbool notify=false);
143 
145  FXdouble getValue() const { return pos; }
146 
148  void setRange(FXdouble lo,FXdouble hi,FXbool notify=false);
149 
151  void getRange(FXdouble& lo,FXdouble& hi) const { lo=range[0]; hi=range[1]; }
152 
154  void setIncrement(FXdouble increment);
155 
157  FXdouble getIncrement() const { return incr; }
158 
160  void setGranularity(FXdouble gr);
161 
163  FXdouble getGranularity() const { return gran; }
164 
166  void setFont(FXFont *fnt);
167 
169  FXFont *getFont() const;
170 
172  void setHelpText(const FXString& text);
173 
175  const FXString& getHelpText() const;
176 
178  void setTipText(const FXString& text);
179 
181  const FXString& getTipText() const;
182 
184  void setSpinnerStyle(FXuint style);
185 
187  FXuint getSpinnerStyle() const;
188 
190  void setEditable(FXbool edit=true);
191 
193  FXbool isEditable() const;
194 
196  void setUpArrowColor(FXColor clr);
197 
199  FXColor getUpArrowColor() const;
200 
202  void setDownArrowColor(FXColor clr);
203 
205  FXColor getDownArrowColor() const;
206 
208  void setTextColor(FXColor clr);
209 
211  FXColor getTextColor() const;
212 
214  void setSelBackColor(FXColor clr);
215 
217  FXColor getSelBackColor() const;
218 
220  void setSelTextColor(FXColor clr);
221 
223  FXColor getSelTextColor() const;
224 
226  void setCursorColor(FXColor clr);
227 
229  FXColor getCursorColor() const;
230 
232  void setNumColumns(FXint cols);
233 
235  FXint getNumColumns() const;
236 
238  virtual void save(FXStream& store) const;
239 
241  virtual void load(FXStream& store);
242 
244  virtual ~FXRealSpinner();
245  };
246 
247 }
248 
249 #endif
Real Spinner control.
Definition: FXRealSpinner.h:47
void getRange(FXdouble &lo, FXdouble &hi) const
Get the spinner&#39;s current range.
Definition: FXRealSpinner.h:151
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:48
A text field is a single-line text entry widget.
Definition: FXTextField.h:63
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
FXdouble getGranularity() const
Return spinner granularity.
Definition: FXRealSpinner.h:163
FXdouble getIncrement() const
Return spinner increment.
Definition: FXRealSpinner.h:157
Font class.
Definition: FXFont.h:137
FXdouble getValue() const
Return current value.
Definition: FXRealSpinner.h:145
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
Button with an arrow; the arrow can point in any direction.
Definition: FXArrowButton.h:55

Copyright © 1997-2022 Jeroen van der Zijp