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 /********************************************************************************
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 by Bill Baxter. All Rights Reserved. *
7 *********************************************************************************
8 * Based on FXSpinner.cpp *
9 * Copyright (C) 1998,2003 by Lyle Johnson. All Rights Reserved. *
10 *********************************************************************************
11 * This library is free software; you can redistribute it and/or *
12 * modify it under the terms of the GNU Lesser General Public *
13 * License as published by the Free Software Foundation; either *
14 * version 2.1 of the License, or (at your option) any later version. *
15 * *
16 * This library is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
19 * Lesser General Public License for more details. *
20 * *
21 * You should have received a copy of the GNU Lesser General Public *
22 * License along with this library; if not, write to the Free Software *
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
24 *********************************************************************************
25 * $Id: FXRealSpinDial.h 11451 2011-11-02 09:07:49Z behrisch $ *
26 ********************************************************************************/
27 #ifndef FXREALSPINDIAL_H
28 #define FXREALSPINDIAL_H
29 
30 
31 // ===========================================================================
32 // included modules
33 // ===========================================================================
34 #ifdef _MSC_VER
35 #include <windows_config.h>
36 #else
37 #include <config.h>
38 #endif
39 
40 #ifndef FXPACKER_H
41 #include "FXPacker.h"
42 #endif
43 
44 namespace FX {
45 
46 
47 // Spinner Options
48 enum {
49  SPINDIAL_CYCLIC = SPIN_CYCLIC, // Cyclic spinner
50  SPINDIAL_NOTEXT = SPIN_NOTEXT, // No text visible
51  SPINDIAL_NOMAX = SPIN_NOMAX, // Spin all the way up to infinity
52  SPINDIAL_NOMIN = SPIN_NOMIN, // Spin all the way down to -infinity
53  SPINDIAL_LOG = 0x00200000, // Logarithmic rather than linear
54  SPINDIAL_NODIAL = 0x00400000, // No dial visible
55  SPINDIAL_NOBUTTONS = 0x00800000, // No spinbuttons visible
56  SPINDIAL_NORMAL = SPINDIAL_NOBUTTONS// Normal, non-cyclic, no buttons
57 };
58 
59 enum {
63 };
64 
65 class FXRealSpinDialText;
66 class FXDial;
67 
68 
70 class /*FXAPI*/ FXRealSpinDial : public FXPacker {
71  FXDECLARE(FXRealSpinDial)
72 protected:
73  FXRealSpinDialText* textField; // Text field
74  FXArrowButton* upButton; // The up button
75  FXArrowButton* downButton; // The down button
76  FXDial* dial; // The up/down dial
77  FXdouble range[2]; // Reported data range
78  FXdouble incr[3]; // Increments (fine,normal,coarse)
79  FXdouble pos; // Current position
80  FXint dialpos; // Current position of dial
81  FXint keystate; // Current key modifiers
82 protected:
84 private:
87 public:
88  long onUpdDial(FXObject*, FXSelector, void*);
89  long onChgDial(FXObject*, FXSelector, void*);
90  long onCmdDial(FXObject*, FXSelector, void*);
91  long onUpdIncrement(FXObject*, FXSelector, void*);
92  long onCmdIncrement(FXObject*, FXSelector, void*);
93  long onUpdDecrement(FXObject*, FXSelector, void*);
94  long onCmdDecrement(FXObject*, FXSelector, void*);
95  long onMouseWheel(FXObject*, FXSelector, void*);
96  long onUpdEntry(FXObject*, FXSelector, void*);
97  long onCmdEntry(FXObject*, FXSelector, void*);
98  long onChgEntry(FXObject*, FXSelector, void*);
99  long onKeyPress(FXObject*, FXSelector, void*);
100  long onKeyRelease(FXObject*, FXSelector, void*);
101  long onCmdSetValue(FXObject*, FXSelector, void*);
102  long onCmdSetIntValue(FXObject*, FXSelector, void*);
103  long onCmdGetIntValue(FXObject*, FXSelector, void*);
104  long onCmdSetIntRange(FXObject*, FXSelector, void*);
105  long onCmdGetIntRange(FXObject*, FXSelector, void*);
106  long onCmdSetRealValue(FXObject*, FXSelector, void*);
107  long onCmdGetRealValue(FXObject*, FXSelector, void*);
108  long onCmdSetRealRange(FXObject*, FXSelector, void*);
109  long onCmdGetRealRange(FXObject*, FXSelector, void*);
110  long onMotion(FXObject*, FXSelector, void*);
111  //long onDefault(FXObject*,FXSelector,void*);
112 public:
113  enum {
119  };
120 public:
121 
123  FXRealSpinDial(FXComposite* p, FXint cols, FXObject* tgt = NULL,
124  FXSelector sel = 0, FXuint opts = SPINDIAL_NORMAL,
125  FXint x = 0, FXint y = 0, FXint w = 0, FXint h = 0,
126  FXint pl = DEFAULT_PAD, FXint pr = DEFAULT_PAD, FXint pt = DEFAULT_PAD, FXint pb = DEFAULT_PAD
127  );
128 
130  virtual void create();
131 
133  virtual void layout();
134 
136  virtual void disable();
137 
139  virtual void enable();
140 
142  virtual FXint getDefaultWidth();
143 
145  virtual FXint getDefaultHeight();
146 
148  void increment(FXint incMode = SPINDIAL_INC_NORMAL);
149 
151  void decrement(FXint incMode = SPINDIAL_INC_NORMAL);
152 
154  FXbool isCyclic() const;
155 
157  void setCyclic(FXbool cyclic);
158 
160  FXbool isTextVisible() const;
161 
163  void setTextVisible(FXbool shown);
164 
166  FXbool isDialVisible() const;
167 
169  void setDialVisible(FXbool shown);
170 
172  virtual void setValue(FXdouble value);
173 
175  FXdouble getValue() const {
176  return pos;
177  }
178 
180  void setRange(FXdouble lo, FXdouble hi);
181 
183  void getRange(FXdouble& lo, FXdouble& hi) const {
184  lo = range[0];
185  hi = range[1];
186  }
187 
189  void setIncrement(FXdouble increment);
191  void setIncrements(FXdouble fine, FXdouble norm, FXdouble coarse);
193  void setFineIncrement(FXdouble increment);
195  void setCoarseIncrement(FXdouble increment);
196 
198  FXdouble getIncrement() const {
199  return incr[1];
200  }
202  FXdouble getFineIncrement() const {
203  return incr[0];
204  }
206  FXdouble getCoarseIncrement() const {
207  return incr[-1];
208  }
209 
211  void setFont(FXFont* fnt);
212 
214  FXFont* getFont() const;
215 
217  void setHelpText(const FXString& text);
218 
220  FXString getHelpText() const;
221 
223  void setTipText(const FXString& text);
224 
226  FXString getTipText() const;
227 
229  void setSpinnerStyle(FXuint style);
230 
232  FXuint getSpinnerStyle() const;
233 
235  void setEditable(FXbool edit = TRUE);
236 
238  FXbool isEditable() const;
239 
241  void setDialColor(FXColor clr);
242 
244  FXColor getDialColor() const;
245 
247  void setUpArrowColor(FXColor clr);
248 
250  FXColor getUpArrowColor() const;
251 
253  void setDownArrowColor(FXColor clr);
254 
256  FXColor getDownArrowColor() const;
257 
259  void setTextColor(FXColor clr);
260 
262  FXColor getTextColor() const;
263 
265  void setSelBackColor(FXColor clr);
266 
268  FXColor getSelBackColor() const;
269 
271  void setSelTextColor(FXColor clr);
272 
274  FXColor getSelTextColor() const;
275 
277  void setCursorColor(FXColor clr);
278 
280  FXColor getCursorColor() const;
281 
283  virtual void save(FXStream& store) const;
284 
286  virtual void load(FXStream& store);
287 
290  void setNumberFormat(FXint prec, FXbool bExp = FALSE);
291 
293  FXint getNumberFormatPrecision() const;
294 
296  FXbool getNumberFormatExponent() const;
297 
301  void setFormatString(const FXchar* fmt);
302 
304  FXString getNumberFormatString() const;
305 
307  void selectAll();
308 
309  const FXDial& getDial() const;
310 
312  virtual ~FXRealSpinDial();
313 };
314 
315 }
316 
317 
318 #endif // FXREALSPINDIAL_H