]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/spinbutt.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSpinEvent, wxSpinButton
4 // Author: wxWidgets team
5 // Licence: wxWindows licence
6 /////////////////////////////////////////////////////////////////////////////
11 This event class is used for the events generated by wxSpinButton and wxSpinCtrl.
13 @beginEventTable{wxSpinEvent}
14 @event{EVT_SPIN(id, func)}
15 Generated whenever an arrow is pressed.
16 @event{EVT_SPIN_UP(id, func)}
17 Generated when left/up arrow is pressed.
18 @event{EVT_SPIN_DOWN(id, func)}
19 Generated when right/down arrow is pressed.
22 Note that if you handle both SPIN and UP or DOWN events, you will be notified
23 about each of them twice: first the UP/DOWN event will be received and then,
24 if it wasn't vetoed, the SPIN event will be sent.
29 @see wxSpinButton and wxSpinCtrl
31 class wxSpinEvent
: public wxNotifyEvent
35 The constructor is not normally used by the user code.
37 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0);
40 Retrieve the current spin button or control value.
42 int GetPosition() const;
45 Set the value associated with the event.
47 void SetPosition(int pos
);
55 A wxSpinButton has two small up and down (or left and right) arrow buttons.
57 It is often used next to a text control for increment and decrementing a value.
58 Portable programs should try to use wxSpinCtrl instead as wxSpinButton is not
59 implemented for all platforms but wxSpinCtrl is as it degenerates to a simple
60 wxTextCtrl on such platforms.
62 @note the range supported by this control (and wxSpinCtrl) depends on the
63 platform but is at least @c -0x8000 to @c 0x7fff. Under GTK and
64 Win32 with sufficiently new version of @c comctrl32.dll (at least 4.71
65 is required, 5.80 is recommended) the full 32 bit range is supported.
68 @style{wxSP_HORIZONTAL}
69 Specifies a horizontal spin button (note that this style is not
72 Specifies a vertical spin button.
73 @style{wxSP_ARROW_KEYS}
74 The user can use arrow keys to change the value.
76 The value wraps at the minimum and maximum.
79 @beginEventEmissionTable{wxSpinEvent}
80 @event{EVT_SPIN(id, func)}
81 Generated whenever an arrow is pressed.
82 @event{EVT_SPIN_UP(id, func)}
83 Generated when left/up arrow is pressed.
84 @event{EVT_SPIN_DOWN(id, func)}
85 Generated when right/down arrow is pressed.
88 Note that if you handle both SPIN and UP or DOWN events, you will be notified
89 about each of them twice: first the UP/DOWN event will be received and then,
90 if it wasn't vetoed, the SPIN event will be sent.
94 @appearance{spinbutton}
98 class wxSpinButton
: public wxControl
107 Constructor, creating and showing a spin button.
110 Parent window. Must not be @NULL.
112 Window identifier. The value wxID_ANY indicates a default value.
115 If ::wxDefaultPosition is specified then a default position is chosen.
118 If ::wxDefaultSize is specified then a default size is chosen.
120 Window style. See wxSpinButton class description.
126 wxSpinButton(wxWindow
* parent
, wxWindowID id
= -1,
127 const wxPoint
& pos
= wxDefaultPosition
,
128 const wxSize
& size
= wxDefaultSize
,
129 long style
= wxSP_VERTICAL
,
130 const wxString
& name
= "spinButton");
133 Destructor, destroys the spin button control.
135 virtual ~wxSpinButton();
138 Scrollbar creation function called by the spin button constructor.
139 See wxSpinButton() for details.
141 bool Create(wxWindow
* parent
, wxWindowID id
= -1,
142 const wxPoint
& pos
= wxDefaultPosition
,
143 const wxSize
& size
= wxDefaultSize
,
144 long style
= wxSP_VERTICAL
,
145 const wxString
& name
= "wxSpinButton");
148 Returns the maximum permissible value.
152 virtual int GetMax() const;
155 Returns the minimum permissible value.
159 virtual int GetMin() const;
162 Returns the current spin button value.
166 virtual int GetValue() const;
169 Sets the range of the spin button.
172 The minimum value for the spin button.
174 The maximum value for the spin button.
176 @see GetMin(), GetMax()
178 virtual void SetRange(int min
, int max
);
181 Sets the value of the spin button.
184 The value for the spin button.
186 virtual void SetValue(int value
);