Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
/********************************************************************************
* *
* R e a l - V a l u e d S p i n n e r W i d g e t *
* *
*********************************************************************************
* Copyright (C) 2003,2006 by Bill Baxter. All Rights Reserved. *
*********************************************************************************
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
*********************************************************************************
* $Id: FXRealSpinner.h 2360 2006-03-29 04:10:56Z lyle $ *
********************************************************************************/
#ifndef FXREALSPINNER_H
#define FXREALSPINNER_H
#ifndef FXPACKER_H
#include "FXPacker.h"
#endif
namespace FX {
/// RealSpinner Options
enum {
REALSPIN_NORMAL = 0, /// Normal, non-cyclic
REALSPIN_CYCLIC = 0x00020000, /// Cyclic spinner
REALSPIN_NOTEXT = 0x00040000, /// No text visible
REALSPIN_NOMAX = 0x00080000, /// Spin all the way up to infinity
REALSPIN_NOMIN = 0x00100000, /// Spin all the way down to -infinity
REALSPIN_LOG = 0x00200000 /// Logarithmic rather than linear
};
class FXTextField;
class FXDial;
/// Spinner control
class FXAPI FXRealSpinner : public FXPacker {
FXDECLARE(FXRealSpinner)
protected:
FXTextField *textField; // Text field
FXArrowButton *upButton; // The up button
FXArrowButton *downButton; // The down button
FXdouble range[2]; // Reported data range
FXdouble incr; // Increment
FXdouble gran; // Granularity
FXdouble pos; // Current position
protected:
FXRealSpinner();
private:
FXRealSpinner(const FXRealSpinner&);
FXRealSpinner& operator=(const FXRealSpinner&);
public:
long onUpdIncrement(FXObject*,FXSelector,void*);
long onCmdIncrement(FXObject*,FXSelector,void*);
long onUpdDecrement(FXObject*,FXSelector,void*);
long onCmdDecrement(FXObject*,FXSelector,void*);
long onCmdEntry(FXObject*,FXSelector,void*);
long onChgEntry(FXObject*,FXSelector,void*);
long onWheelEntry(FXObject*,FXSelector,void*);
long onKeyPress(FXObject*,FXSelector,void*);
long onKeyRelease(FXObject*,FXSelector,void*);
long onCmdSetValue(FXObject*,FXSelector,void*);
long onCmdSetIntValue(FXObject*,FXSelector,void*);
long onCmdGetIntValue(FXObject*,FXSelector,void*);
long onCmdSetIntRange(FXObject*,FXSelector,void*);
long onCmdGetIntRange(FXObject*,FXSelector,void*);
long onCmdSetRealValue(FXObject*,FXSelector,void*);
long onCmdGetRealValue(FXObject*,FXSelector,void*);
long onCmdSetRealRange(FXObject*,FXSelector,void*);
long onCmdGetRealRange(FXObject*,FXSelector,void*);
long onFocusSelf(FXObject*,FXSelector,void*);
public:
enum{
ID_INCREMENT=FXPacker::ID_LAST,
ID_DECREMENT,
ID_ENTRY,
ID_LAST
};
public:
/// Construct a spinner
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);
/// Perform layout
virtual void layout();
/// Disable spinner
virtual void disable();
/// Enable spinner
virtual void enable();
/// Return default width
virtual FXint getDefaultWidth();
/// Return default height
virtual FXint getDefaultHeight();
/// Increment spinner
void increment(FXbool notify=FALSE);
/// Increment spinner by certain amount
void incrementByAmount(FXdouble amount,FXbool notify=FALSE);
/// Decrement spinner
void decrement(FXbool notify=FALSE);
/// Decrement spinner by certain amount
void decrementByAmount(FXdouble amount, FXbool notify=FALSE);
/// Return TRUE if in cyclic mode
FXbool isCyclic() const;
/// Set to cyclic mode, i.e. wrap around at maximum/minimum
void setCyclic(FXbool cyclic);
/// Return TRUE if text is visible
FXbool isTextVisible() const;
/// Set text visible flag
void setTextVisible(FXbool shown);
/// Change current value
virtual void setValue(FXdouble value,FXbool notify=FALSE);
/// Return current value
FXdouble getValue() const { return pos; }
/// Change the spinner's range
void setRange(FXdouble lo,FXdouble hi,FXbool notify=FALSE);
/// Get the spinner's current range
void getRange(FXdouble& lo,FXdouble& hi) const { lo=range[0]; hi=range[1]; }
/// Change spinner increment
void setIncrement(FXdouble increment);
/// Return spinner increment
FXdouble getIncrement() const { return incr; }
/// Change spinner granularity
void setGranularity(FXdouble gr);
/// Return spinner granularity
FXdouble getGranularity() const { return gran; }
/// Set the text font
void setFont(FXFont *fnt);
/// Get the text font
FXFont *getFont() const;
/// Set the status line help text for this spinner
void setHelpText(const FXString& text);
/// Get the status line help text for this spinner
const FXString& getHelpText() const;
/// Set the tool tip message for this spinner
void setTipText(const FXString& text);
/// Get the tool tip message for this spinner
const FXString& getTipText() const;
/// Change spinner style
void setSpinnerStyle(FXuint style);
/// Return current spinner style
FXuint getSpinnerStyle() const;
/// Allow editing of the text field
void setEditable(FXbool edit=TRUE);
/// Return TRUE if text field is editable
FXbool isEditable() const;
/// Change color of the up arrow
void setUpArrowColor(FXColor clr);
/// Return color of the up arrow
FXColor getUpArrowColor() const;
/// Change color of the down arrow
void setDownArrowColor(FXColor clr);
/// Return color of the the down arrow
FXColor getDownArrowColor() const;
/// Change text color
void setTextColor(FXColor clr);
/// Return text color
FXColor getTextColor() const;
/// Change selected background color
void setSelBackColor(FXColor clr);
/// Return selected background color
FXColor getSelBackColor() const;
/// Change selected text color
void setSelTextColor(FXColor clr);
/// Return selected text color
FXColor getSelTextColor() const;
/// Changes the cursor color
void setCursorColor(FXColor clr);
/// Return the cursor color
FXColor getCursorColor() const;
/// Change width of text field in terms of number of columns * `m'
void setNumColumns(FXint cols);
/// Return number of columns
FXint getNumColumns() const;
/// Save spinner to a stream
virtual void save(FXStream& store) const;
/// Load spinner from a stream
virtual void load(FXStream& store);
/// Destructor
virtual ~FXRealSpinner();
};
}
#endif