Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members

FXSpinner.h
1 /********************************************************************************
2 * *
3 * S p i n n e r W i d g e t *
4 * *
5 *********************************************************************************
6 * Copyright (C) 1998,2017 by Lyle Johnson. 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 FXSPINNER_H
22 #define FXSPINNER_H
23 
24 #ifndef FXPACKER_H
25 #include "FXPacker.h"
26 #endif
27 
28 namespace FX {
29 
30 
32 enum {
33  SPIN_NORMAL = 0,
34  SPIN_CYCLIC = 0x00020000,
35  SPIN_NOTEXT = 0x00040000,
36  SPIN_NOMAX = 0x00080000,
37  SPIN_NOMIN = 0x00100000
38  };
39 
40 
41 class FXTextField;
42 class FXArrowButton;
43 
44 
46 class FXAPI FXSpinner : public FXPacker {
47  FXDECLARE(FXSpinner)
48 protected:
49  FXTextField *textField; // Text field
50  FXArrowButton *upButton; // The up button
51  FXArrowButton *downButton; // The down button
52  FXint range[2]; // Reported data range
53  FXint incr; // Increment
54  FXint pos; // Current position
55 protected:
56  FXSpinner();
57 private:
58  FXSpinner(const FXSpinner&);
59  FXSpinner& operator=(const FXSpinner&);
60 public:
61  long onUpdIncrement(FXObject*,FXSelector,void*);
62  long onCmdIncrement(FXObject*,FXSelector,void*);
63  long onUpdDecrement(FXObject*,FXSelector,void*);
64  long onCmdDecrement(FXObject*,FXSelector,void*);
65  long onChgEntry(FXObject*,FXSelector,void*);
66  long onCmdEntry(FXObject*,FXSelector,void*);
67  long onWheelEntry(FXObject*,FXSelector,void*);
68  long onKeyPress(FXObject*,FXSelector,void*);
69  long onKeyRelease(FXObject*,FXSelector,void*);
70  long onCmdSetValue(FXObject*,FXSelector,void*);
71  long onCmdSetIntValue(FXObject*,FXSelector,void*);
72  long onCmdGetIntValue(FXObject*,FXSelector,void*);
73  long onCmdSetLongValue(FXObject*,FXSelector,void*);
74  long onCmdGetLongValue(FXObject*,FXSelector,void*);
75  long onCmdSetIntRange(FXObject*,FXSelector,void*);
76  long onCmdGetIntRange(FXObject*,FXSelector,void*);
77  long onFocusSelf(FXObject*,FXSelector,void*);
78 public:
79  enum{
80  ID_INCREMENT=FXPacker::ID_LAST,
81  ID_DECREMENT,
82  ID_ENTRY,
83  ID_LAST
84  };
85 public:
86 
88  FXSpinner(FXComposite *p,FXint cols,FXObject *tgt=NULL,FXSelector sel=0,FXuint opts=SPIN_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);
89 
91  virtual void layout();
92 
94  virtual void disable();
95 
97  virtual void enable();
98 
100  virtual FXint getDefaultWidth();
101 
103  virtual FXint getDefaultHeight();
104 
106  virtual void changeFocus(FXWindow *child);
107 
109  void increment(FXbool notify=false);
110 
112  void incrementByAmount(FXint amount,FXbool notify=false);
113 
115  void decrement(FXbool notify=false);
116 
118  void decrementByAmount(FXint amount,FXbool notify=false);
119 
121  FXbool isCyclic() const;
122 
124  void setCyclic(FXbool cyclic);
125 
127  FXbool isTextVisible() const;
128 
130  void setTextVisible(FXbool flag);
131 
133  virtual void setValue(FXint value,FXbool notify=false);
134 
136  FXint getValue() const { return pos; }
137 
139  void setRange(FXint lo,FXint hi,FXbool notify=false);
140 
142  void getRange(FXint& lo,FXint& hi) const { lo=range[0]; hi=range[1]; }
143 
145  void setIncrement(FXint increment);
146 
148  FXint getIncrement() const { return incr; }
149 
151  void setFont(FXFont *fnt);
152 
154  FXFont *getFont() const;
155 
157  void setHelpText(const FXString& text);
158 
160  const FXString& getHelpText() const;
161 
163  void setTipText(const FXString& text);
164 
166  const FXString& getTipText() const;
167 
169  void setSpinnerStyle(FXuint style);
170 
172  FXuint getSpinnerStyle() const;
173 
175  void setEditable(FXbool edit=true);
176 
178  FXbool isEditable() const;
179 
181  void setUpArrowColor(FXColor clr);
182 
184  FXColor getUpArrowColor() const;
185 
187  void setDownArrowColor(FXColor clr);
188 
190  FXColor getDownArrowColor() const;
191 
193  void setTextColor(FXColor clr);
194 
196  FXColor getTextColor() const;
197 
199  void setSelBackColor(FXColor clr);
200 
202  FXColor getSelBackColor() const;
203 
205  void setSelTextColor(FXColor clr);
206 
208  FXColor getSelTextColor() const;
209 
211  void setCursorColor(FXColor clr);
212 
214  FXColor getCursorColor() const;
215 
217  void setNumColumns(FXint cols);
218 
220  FXint getNumColumns() const;
221 
223  virtual void save(FXStream& store) const;
224 
226  virtual void load(FXStream& store);
227 
229  virtual ~FXSpinner();
230  };
231 
232 }
233 
234 #endif

Copyright © 1997-2016 Jeroen van der Zijp