SUMO - Simulation of Urban MObility
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
FXRealSpinDial.h
Go to the documentation of this file.
1 /****************************************************************************/
10 //
11 /****************************************************************************/
12 // SUMO, Simulation of Urban MObility; see http://sumo-sim.org/
13 // Copyright (C) 2004-2014 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 {
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