SUMO - Simulation of Urban MObility
FXRealSpinDial.h
Go to the documentation of this file.
1 /****************************************************************************/
2 // Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.org/sumo
3 // Copyright (C) 2004-2017 German Aerospace Center (DLR) and others.
4 /****************************************************************************/
5 //
6 // This program and the accompanying materials
7 // are made available under the terms of the Eclipse Public License v2.0
8 // which accompanies this distribution, and is available at
9 // http://www.eclipse.org/legal/epl-v20.html
10 //
11 /****************************************************************************/
20 //
21 /****************************************************************************/
22 
23 
24 #ifndef FXREALSPINDIAL_H
25 #define FXREALSPINDIAL_H
26 
27 
28 // ===========================================================================
29 // included modules
30 // ===========================================================================
31 #ifdef _MSC_VER
32 #include <windows_config.h>
33 #else
34 #include <config.h>
35 #endif
36 
37 #ifndef FXPACKER_H
38 #include "FXPacker.h"
39 #endif
40 
41 namespace FX {
42 
43 
44 // Spinner Options
45 enum {
46  SPINDIAL_CYCLIC = SPIN_CYCLIC, // Cyclic spinner
47  SPINDIAL_NOTEXT = SPIN_NOTEXT, // No text visible
48  SPINDIAL_NOMAX = SPIN_NOMAX, // Spin all the way up to infinity
49  SPINDIAL_NOMIN = SPIN_NOMIN, // Spin all the way down to -infinity
50  SPINDIAL_LOG = 0x00200000, // Logarithmic rather than linear
51  SPINDIAL_NODIAL = 0x00400000, // No dial visible
52  SPINDIAL_NOBUTTONS = 0x00800000, // No spinbuttons visible
53  SPINDIAL_NORMAL = SPINDIAL_NOBUTTONS// Normal, non-cyclic, no buttons
54 };
55 
56 enum {
60 };
61 
62 class FXRealSpinDialText;
63 class FXDial;
64 
65 
67 class /*FXAPI*/ FXRealSpinDial : public FXPacker {
68  FXDECLARE(FXRealSpinDial)
69 protected:
70  FXRealSpinDialText* textField; // Text field
71  FXArrowButton* upButton; // The up button
72  FXArrowButton* downButton; // The down button
73  FXDial* dial; // The up/down dial
74  FXdouble range[2]; // Reported data range
75  FXdouble incr[3]; // Increments (fine,normal,coarse)
76  FXdouble pos; // Current position
77  FXint dialpos; // Current position of dial
78  FXint keystate; // Current key modifiers
79 protected:
81 private:
84 public:
85  long onUpdDial(FXObject*, FXSelector, void*);
86  long onChgDial(FXObject*, FXSelector, void*);
87  long onCmdDial(FXObject*, FXSelector, void*);
88  long onUpdIncrement(FXObject*, FXSelector, void*);
89  long onCmdIncrement(FXObject*, FXSelector, void*);
90  long onUpdDecrement(FXObject*, FXSelector, void*);
91  long onCmdDecrement(FXObject*, FXSelector, void*);
92  long onMouseWheel(FXObject*, FXSelector, void*);
93  long onUpdEntry(FXObject*, FXSelector, void*);
94  long onCmdEntry(FXObject*, FXSelector, void*);
95  long onChgEntry(FXObject*, FXSelector, void*);
96  long onKeyPress(FXObject*, FXSelector, void*);
97  long onKeyRelease(FXObject*, FXSelector, void*);
98  long onCmdSetValue(FXObject*, FXSelector, void*);
99  long onCmdSetIntValue(FXObject*, FXSelector, void*);
100  long onCmdGetIntValue(FXObject*, FXSelector, void*);
101  long onCmdSetIntRange(FXObject*, FXSelector, void*);
102  long onCmdGetIntRange(FXObject*, FXSelector, void*);
103  long onCmdSetRealValue(FXObject*, FXSelector, void*);
104  long onCmdGetRealValue(FXObject*, FXSelector, void*);
105  long onCmdSetRealRange(FXObject*, FXSelector, void*);
106  long onCmdGetRealRange(FXObject*, FXSelector, void*);
107  long onMotion(FXObject*, FXSelector, void*);
108  //long onDefault(FXObject*,FXSelector,void*);
109 public:
110  enum {
111  ID_DIAL = FXPacker::ID_LAST,
116  };
117 public:
118 
120  FXRealSpinDial(FXComposite* p, FXint cols, FXObject* tgt = NULL,
121  FXSelector sel = 0, FXuint opts = SPINDIAL_NORMAL,
122  FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
123  FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD
124  );
125 
127  virtual void create();
128 
130  virtual void layout();
131 
133  virtual void disable();
134 
136  virtual void enable();
137 
139  virtual FXint getDefaultWidth();
140 
142  virtual FXint getDefaultHeight();
143 
145  void increment(FXint incMode = SPINDIAL_INC_NORMAL);
146 
148  void decrement(FXint incMode = SPINDIAL_INC_NORMAL);
149 
151  FXbool isCyclic() const;
152 
154  void setCyclic(FXbool cyclic);
155 
157  FXbool isTextVisible() const;
158 
160  void setTextVisible(FXbool shown);
161 
163  FXbool isDialVisible() const;
164 
166  void setDialVisible(FXbool shown);
167 
169  virtual void setValue(FXdouble value);
170 
172  FXdouble getValue() const {
173  return pos;
174  }
175 
177  void setRange(FXdouble lo, FXdouble hi);
178 
180  void getRange(FXdouble& lo, FXdouble& hi) const {
181  lo = range[0];
182  hi = range[1];
183  }
184 
186  void setIncrement(FXdouble increment);
188  void setIncrements(FXdouble fine, FXdouble norm, FXdouble coarse);
190  void setFineIncrement(FXdouble increment);
192  void setCoarseIncrement(FXdouble increment);
193 
195  FXdouble getIncrement() const {
196  return incr[1];
197  }
199  FXdouble getFineIncrement() const {
200  return incr[0];
201  }
203  FXdouble getCoarseIncrement() const {
204  return incr[2];
205  }
206 
208  void setFont(FXFont* fnt);
209 
211  FXFont* getFont() const;
212 
214  void setHelpText(const FXString& text);
215 
217  FXString getHelpText() const;
218 
220  void setTipText(const FXString& text);
221 
223  FXString getTipText() const;
224 
226  void setSpinnerStyle(FXuint style);
227 
229  FXuint getSpinnerStyle() const;
230 
232  void setEditable(FXbool edit = TRUE);
233 
235  FXbool isEditable() const;
236 
238  void setDialColor(FXColor clr);
239 
241  FXColor getDialColor() const;
242 
244  void setUpArrowColor(FXColor clr);
245 
247  FXColor getUpArrowColor() const;
248 
250  void setDownArrowColor(FXColor clr);
251 
253  FXColor getDownArrowColor() const;
254 
256  void setTextColor(FXColor clr);
257 
259  FXColor getTextColor() const;
260 
262  void setSelBackColor(FXColor clr);
263 
265  FXColor getSelBackColor() const;
266 
268  void setSelTextColor(FXColor clr);
269 
271  FXColor getSelTextColor() const;
272 
274  void setCursorColor(FXColor clr);
275 
277  FXColor getCursorColor() const;
278 
280  virtual void save(FXStream& store) const;
281 
283  virtual void load(FXStream& store);
284 
287  void setNumberFormat(FXint prec, FXbool bExp = FALSE);
288 
290  FXint getNumberFormatPrecision() const;
291 
293  FXbool getNumberFormatExponent() const;
294 
298  void setFormatString(const FXchar* fmt);
299 
301  FXString getNumberFormatString() const;
302 
304  void selectAll();
305 
306  const FXDial& getDial() const;
307 
309  virtual ~FXRealSpinDial();
310 };
311 
312 }
313 
314 
315 #endif // FXREALSPINDIAL_H
long onCmdDecrement(FXObject *, FXSelector, void *)
long onCmdGetIntRange(FXObject *, FXSelector, void *)
long onCmdGetRealRange(FXObject *, FXSelector, void *)
FXbool isDialVisible() const
Return TRUE if dial is visible.
FXString getHelpText() const
Get the status line help text for this spinner.
FXbool isEditable() const
Return TRUE if text field is editable.
void selectAll()
Mark the text entry as selected.
void setFineIncrement(FXdouble increment)
Change spinner fine adjustment increment (when CTRL key held down)
FXuint getSpinnerStyle() const
Return current spinner style.
FXColor getDialColor() const
Return color of the dial.
FXFont * getFont() const
Get the text font.
FXString getNumberFormatString() const
Return the format string for number display.
long onUpdEntry(FXObject *, FXSelector, void *)
void setFont(FXFont *fnt)
Set the text font.
void setDialColor(FXColor clr)
Change color of the dial.
virtual FXint getDefaultHeight()
Return default height.
virtual void load(FXStream &store)
Load spinner from a stream.
FXString getTipText() const
Get the tool tip message for this spinner.
virtual void setValue(FXdouble value)
Change current value.
long onCmdSetIntRange(FXObject *, FXSelector, void *)
void setNumberFormat(FXint prec, FXbool bExp=FALSE)
void setCoarseIncrement(FXdouble increment)
Change spinner coarse adjustment increment (when SHIFT key held down)
FXArrowButton * downButton
virtual FXint getDefaultWidth()
Return default width.
void setSpinnerStyle(FXuint style)
Change spinner style.
void setCursorColor(FXColor clr)
Changes the cursor color.
FXbool isCyclic() const
Return TRUE if in cyclic mode.
FXint getNumberFormatPrecision() const
Return the digits of precision used to display numbers.
long onCmdSetValue(FXObject *, FXSelector, void *)
virtual void create()
Create server-side resources.
FXdouble getIncrement() const
Return spinner increment.
long onCmdSetRealRange(FXObject *, FXSelector, void *)
void getRange(FXdouble &lo, FXdouble &hi) const
Get the spinner&#39;s current range.
long onKeyPress(FXObject *, FXSelector, void *)
virtual void disable()
Disable spinner.
FXColor getCursorColor() const
Return the cursor color.
void setEditable(FXbool edit=TRUE)
Allow editing of the text field.
void setTextColor(FXColor clr)
Change text color.
void decrement(FXint incMode=SPINDIAL_INC_NORMAL)
Decrement spinner.
const FXDial & getDial() const
FXRealSpinDial & operator=(const FXRealSpinDial &)
void setSelBackColor(FXColor clr)
Change selected background color.
void setRange(FXdouble lo, FXdouble hi)
Change the spinner&#39;s range.
long onCmdEntry(FXObject *, FXSelector, void *)
long onCmdSetIntValue(FXObject *, FXSelector, void *)
FXColor getSelTextColor() const
Return selected text color.
FXArrowButton * upButton
FXColor getTextColor() const
Return text color.
long onUpdDial(FXObject *, FXSelector, void *)
void setFormatString(const FXchar *fmt)
void setTipText(const FXString &text)
Set the tool tip message for this spinner.
FXdouble getFineIncrement() const
Return spinner increment.
virtual ~FXRealSpinDial()
Destructor.
FXColor getSelBackColor() const
Return selected background color.
void setCyclic(FXbool cyclic)
Set to cyclic mode, i.e. wrap around at maximum/minimum.
long onKeyRelease(FXObject *, FXSelector, void *)
long onUpdDecrement(FXObject *, FXSelector, void *)
long onCmdDial(FXObject *, FXSelector, void *)
long onCmdGetRealValue(FXObject *, FXSelector, void *)
void setTextVisible(FXbool shown)
Set text visible flag.
FXbool getNumberFormatExponent() const
Return whether the exponent is used in number display.
long onCmdIncrement(FXObject *, FXSelector, void *)
long onMotion(FXObject *, FXSelector, void *)
void increment(FXint incMode=SPINDIAL_INC_NORMAL)
Increment spinner.
FXdouble getValue() const
Return current value.
long onChgEntry(FXObject *, FXSelector, void *)
void setHelpText(const FXString &text)
Set the status line help text for this spinner.
void setDownArrowColor(FXColor clr)
Change color of the down arrow.
void setIncrement(FXdouble increment)
Change spinner increment.
long onCmdGetIntValue(FXObject *, FXSelector, void *)
long onUpdIncrement(FXObject *, FXSelector, void *)
void setIncrements(FXdouble fine, FXdouble norm, FXdouble coarse)
Change all spinner increment.
virtual void layout()
Perform layout.
long onMouseWheel(FXObject *, FXSelector, void *)
FXColor getDownArrowColor() const
Return color of the the down arrow.
void setSelTextColor(FXColor clr)
Change selected text color.
FXColor getUpArrowColor() const
Return color of the up arrow.
Spinner control.
FXRealSpinDialText * textField
virtual void enable()
Enable spinner.
void setUpArrowColor(FXColor clr)
Change color of the up arrow.
long onCmdSetRealValue(FXObject *, FXSelector, void *)
FXbool isTextVisible() const
Return TRUE if text is visible.
long onChgDial(FXObject *, FXSelector, void *)
void setDialVisible(FXbool shown)
Set dial visible flag.
FXdouble getCoarseIncrement() const
Return spinner increment.
virtual void save(FXStream &store) const
Save spinner to a stream.