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,2017 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=NULL,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 changeFocus(FXWindow *child);
113 
115  void increment(FXbool notify=false);
116 
118  void incrementByAmount(FXdouble amount,FXbool notify=false);
119 
121  void decrement(FXbool notify=false);
122 
124  void decrementByAmount(FXdouble amount,FXbool notify=false);
125 
127  FXbool isCyclic() const;
128 
130  void setCyclic(FXbool cyclic);
131 
133  FXbool isTextVisible() const;
134 
136  void setTextVisible(FXbool flag);
137 
139  virtual void setValue(FXdouble value,FXbool notify=false);
140 
142  FXdouble getValue() const { return pos; }
143 
145  void setRange(FXdouble lo,FXdouble hi,FXbool notify=false);
146 
148  void getRange(FXdouble& lo,FXdouble& hi) const { lo=range[0]; hi=range[1]; }
149 
151  void setIncrement(FXdouble increment);
152 
154  FXdouble getIncrement() const { return incr; }
155 
157  void setGranularity(FXdouble gr);
158 
160  FXdouble getGranularity() const { return gran; }
161 
163  void setFont(FXFont *fnt);
164 
166  FXFont *getFont() const;
167 
169  void setHelpText(const FXString& text);
170 
172  const FXString& getHelpText() const;
173 
175  void setTipText(const FXString& text);
176 
178  const FXString& getTipText() const;
179 
181  void setSpinnerStyle(FXuint style);
182 
184  FXuint getSpinnerStyle() const;
185 
187  void setEditable(FXbool edit=true);
188 
190  FXbool isEditable() const;
191 
193  void setUpArrowColor(FXColor clr);
194 
196  FXColor getUpArrowColor() const;
197 
199  void setDownArrowColor(FXColor clr);
200 
202  FXColor getDownArrowColor() const;
203 
205  void setTextColor(FXColor clr);
206 
208  FXColor getTextColor() const;
209 
211  void setSelBackColor(FXColor clr);
212 
214  FXColor getSelBackColor() const;
215 
217  void setSelTextColor(FXColor clr);
218 
220  FXColor getSelTextColor() const;
221 
223  void setCursorColor(FXColor clr);
224 
226  FXColor getCursorColor() const;
227 
229  void setNumColumns(FXint cols);
230 
232  FXint getNumColumns() const;
233 
235  virtual void save(FXStream& store) const;
236 
238  virtual void load(FXStream& store);
239 
241  virtual ~FXRealSpinner();
242  };
243 
244 }
245 
246 #endif

Copyright © 1997-2016 Jeroen van der Zijp