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,2024 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=nullptr,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 setFocus();
107 
109  virtual void killFocus();
110 
112  void increment(FXbool notify=false);
113 
115  void incrementByAmount(FXint amount,FXbool notify=false);
116 
118  void decrement(FXbool notify=false);
119 
121  void decrementByAmount(FXint amount,FXbool notify=false);
122 
124  FXbool isCyclic() const;
125 
127  void setCyclic(FXbool cyclic);
128 
130  FXbool isTextVisible() const;
131 
133  void setTextVisible(FXbool flag);
134 
136  virtual void setValue(FXint value,FXbool notify=false);
137 
139  FXint getValue() const { return pos; }
140 
142  void setRange(FXint lo,FXint hi,FXbool notify=false);
143 
145  void getRange(FXint& lo,FXint& hi) const { lo=range[0]; hi=range[1]; }
146 
148  void setIncrement(FXint increment);
149 
151  FXint getIncrement() const { return incr; }
152 
154  void setFont(FXFont *fnt);
155 
157  FXFont *getFont() const;
158 
160  void setHelpText(const FXString& text);
161 
163  const FXString& getHelpText() const;
164 
166  void setTipText(const FXString& text);
167 
169  const FXString& getTipText() const;
170 
172  void setSpinnerStyle(FXuint style);
173 
175  FXuint getSpinnerStyle() const;
176 
178  void setEditable(FXbool edit=true);
179 
181  FXbool isEditable() const;
182 
184  void setUpArrowColor(FXColor clr);
185 
187  FXColor getUpArrowColor() const;
188 
190  void setDownArrowColor(FXColor clr);
191 
193  FXColor getDownArrowColor() const;
194 
196  void setTextColor(FXColor clr);
197 
199  FXColor getTextColor() const;
200 
202  void setSelBackColor(FXColor clr);
203 
205  FXColor getSelBackColor() const;
206 
208  void setSelTextColor(FXColor clr);
209 
211  FXColor getSelTextColor() const;
212 
214  void setCursorColor(FXColor clr);
215 
217  FXColor getCursorColor() const;
218 
220  void setNumColumns(FXint cols);
221 
223  FXint getNumColumns() const;
224 
226  virtual void save(FXStream& store) const;
227 
229  virtual void load(FXStream& store);
230 
232  virtual ~FXSpinner();
233  };
234 
235 }
236 
237 #endif
Base composite.
Definition: FXComposite.h:32
A stream is a way to serialize data and objects into a byte stream.
Definition: FXStream.h:81
Definition: FX4Splitter.h:28
Packer is a layout manager which automatically places child windows inside its area against the left...
Definition: FXPacker.h:48
FXint getValue() const
Return current value.
Definition: FXSpinner.h:139
A text field is a single-line text entry widget.
Definition: FXTextField.h:63
Spinner control.
Definition: FXSpinner.h:46
Object is the base class for all objects in FOX; in order to receive messages from the user interface...
Definition: FXObject.h:138
FXint getIncrement() const
Return spinner increment.
Definition: FXSpinner.h:151
Font class.
Definition: FXFont.h:137
void getRange(FXint &lo, FXint &hi) const
Get the spinner&#39;s current range.
Definition: FXSpinner.h:145
FXString provides essential string manipulation capabilities in FOX.
Definition: FXString.h:42
Button with an arrow; the arrow can point in any direction.
Definition: FXArrowButton.h:55

Copyright © 1997-2022 Jeroen van der Zijp