SUMO - Simulation of Urban MObility
FXRealSpinDial.h
Go to the documentation of this file.
1 /****************************************************************************/
10 //
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
13 // Copyright (C) 2004-2017 DLR (http://www.dlr.de/) and contributors
14 /****************************************************************************/
15 //
16 // This file is part of SUMO.
17 // SUMO is free software: you can redistribute it and/or modify
18 // it under the terms of the GNU General Public License as published by
19 // the Free Software Foundation, either version 3 of the License, or
20 // (at your option) any later version.
21 //
22 /****************************************************************************/
23 
24 
25 #ifndef FXREALSPINDIAL_H
26 #define FXREALSPINDIAL_H
27 
28 
29 // ===========================================================================
30 // included modules
31 // ===========================================================================
32 #ifdef _MSC_VER
33 #include <windows_config.h>
34 #else
35 #include <config.h>
36 #endif
37 
38 #ifndef FXPACKER_H
39 #include "FXPacker.h"
40 #endif
41 
42 namespace FX {
43 
44 
45 // Spinner Options
46 enum {
47  SPINDIAL_CYCLIC = SPIN_CYCLIC, // Cyclic spinner
48  SPINDIAL_NOTEXT = SPIN_NOTEXT, // No text visible
49  SPINDIAL_NOMAX = SPIN_NOMAX, // Spin all the way up to infinity
50  SPINDIAL_NOMIN = SPIN_NOMIN, // Spin all the way down to -infinity
51  SPINDIAL_LOG = 0x00200000, // Logarithmic rather than linear
52  SPINDIAL_NODIAL = 0x00400000, // No dial visible
53  SPINDIAL_NOBUTTONS = 0x00800000, // No spinbuttons visible
54  SPINDIAL_NORMAL = SPINDIAL_NOBUTTONS// Normal, non-cyclic, no buttons
55 };
56 
57 enum {
61 };
62 
63 class FXRealSpinDialText;
64 class FXDial;
65 
66 
68 class /*FXAPI*/ FXRealSpinDial : public FXPacker {
69  FXDECLARE(FXRealSpinDial)
70 protected:
71  FXRealSpinDialText* textField; // Text field
72  FXArrowButton* upButton; // The up button
73  FXArrowButton* downButton; // The down button
74  FXDial* dial; // The up/down dial
75  FXdouble range[2]; // Reported data range
76  FXdouble incr[3]; // Increments (fine,normal,coarse)
77  FXdouble pos; // Current position
78  FXint dialpos; // Current position of dial
79  FXint keystate; // Current key modifiers
80 protected:
82 private:
85 public:
86  long onUpdDial(FXObject*, FXSelector, void*);
87  long onChgDial(FXObject*, FXSelector, void*);
88  long onCmdDial(FXObject*, FXSelector, void*);
89  long onUpdIncrement(FXObject*, FXSelector, void*);
90  long onCmdIncrement(FXObject*, FXSelector, void*);
91  long onUpdDecrement(FXObject*, FXSelector, void*);
92  long onCmdDecrement(FXObject*, FXSelector, void*);
93  long onMouseWheel(FXObject*, FXSelector, void*);
94  long onUpdEntry(FXObject*, FXSelector, void*);
95  long onCmdEntry(FXObject*, FXSelector, void*);
96  long onChgEntry(FXObject*, FXSelector, void*);
97  long onKeyPress(FXObject*, FXSelector, void*);
98  long onKeyRelease(FXObject*, FXSelector, void*);
99  long onCmdSetValue(FXObject*, FXSelector, void*);
100  long onCmdSetIntValue(FXObject*, FXSelector, void*);
101  long onCmdGetIntValue(FXObject*, FXSelector, void*);
102  long onCmdSetIntRange(FXObject*, FXSelector, void*);
103  long onCmdGetIntRange(FXObject*, FXSelector, void*);
104  long onCmdSetRealValue(FXObject*, FXSelector, void*);
105  long onCmdGetRealValue(FXObject*, FXSelector, void*);
106  long onCmdSetRealRange(FXObject*, FXSelector, void*);
107  long onCmdGetRealRange(FXObject*, FXSelector, void*);
108  long onMotion(FXObject*, FXSelector, void*);
109  //long onDefault(FXObject*,FXSelector,void*);
110 public:
111  enum {
112  ID_DIAL = FXPacker::ID_LAST,
117  };
118 public:
119 
121  FXRealSpinDial(FXComposite* p, FXint cols, FXObject* tgt = NULL,
122  FXSelector sel = 0, FXuint opts = SPINDIAL_NORMAL,
123  FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
124  FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD
125  );
126 
128  virtual void create();
129 
131  virtual void layout();
132 
134  virtual void disable();
135 
137  virtual void enable();
138 
140  virtual FXint getDefaultWidth();
141 
143  virtual FXint getDefaultHeight();
144 
146  void increment(FXint incMode = SPINDIAL_INC_NORMAL);
147 
149  void decrement(FXint incMode = SPINDIAL_INC_NORMAL);
150 
152  FXbool isCyclic() const;
153 
155  void setCyclic(FXbool cyclic);
156 
158  FXbool isTextVisible() const;
159 
161  void setTextVisible(FXbool shown);
162 
164  FXbool isDialVisible() const;
165 
167  void setDialVisible(FXbool shown);
168 
170  virtual void setValue(FXdouble value);
171 
173  FXdouble getValue() const {
174  return pos;
175  }
176 
178  void setRange(FXdouble lo, FXdouble hi);
179 
181  void getRange(FXdouble& lo, FXdouble& hi) const {
182  lo = range[0];
183  hi = range[1];
184  }
185 
187  void setIncrement(FXdouble increment);
189  void setIncrements(FXdouble fine, FXdouble norm, FXdouble coarse);
191  void setFineIncrement(FXdouble increment);
193  void setCoarseIncrement(FXdouble increment);
194 
196  FXdouble getIncrement() const {
197  return incr[1];
198  }
200  FXdouble getFineIncrement() const {
201  return incr[0];
202  }
204  FXdouble getCoarseIncrement() const {
205  return incr[2];
206  }
207 
209  void setFont(FXFont* fnt);
210 
212  FXFont* getFont() const;
213 
215  void setHelpText(const FXString& text);
216 
218  FXString getHelpText() const;
219 
221  void setTipText(const FXString& text);
222 
224  FXString getTipText() const;
225 
227  void setSpinnerStyle(FXuint style);
228 
230  FXuint getSpinnerStyle() const;
231 
233  void setEditable(FXbool edit = TRUE);
234 
236  FXbool isEditable() const;
237 
239  void setDialColor(FXColor clr);
240 
242  FXColor getDialColor() const;
243 
245  void setUpArrowColor(FXColor clr);
246 
248  FXColor getUpArrowColor() const;
249 
251  void setDownArrowColor(FXColor clr);
252 
254  FXColor getDownArrowColor() const;
255 
257  void setTextColor(FXColor clr);
258 
260  FXColor getTextColor() const;
261 
263  void setSelBackColor(FXColor clr);
264 
266  FXColor getSelBackColor() const;
267 
269  void setSelTextColor(FXColor clr);
270 
272  FXColor getSelTextColor() const;
273 
275  void setCursorColor(FXColor clr);
276 
278  FXColor getCursorColor() const;
279 
281  virtual void save(FXStream& store) const;
282 
284  virtual void load(FXStream& store);
285 
288  void setNumberFormat(FXint prec, FXbool bExp = FALSE);
289 
291  FXint getNumberFormatPrecision() const;
292 
294  FXbool getNumberFormatExponent() const;
295 
299  void setFormatString(const FXchar* fmt);
300 
302  FXString getNumberFormatString() const;
303 
305  void selectAll();
306 
307  const FXDial& getDial() const;
308 
310  virtual ~FXRealSpinDial();
311 };
312 
313 }
314 
315 
316 #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.