]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/spinbutt.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSpinEvent, wxSpinButton
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 This event class is used for the events generated by wxSpinButton and wxSpinCtrl.
14 @beginEventTable{wxSpinEvent}
15 @event{EVT_SPIN(id, func)}
16 Generated whenever an arrow is pressed.
17 @event{EVT_SPIN_UP(id, func)}
18 Generated when left/up arrow is pressed.
19 @event{EVT_SPIN_DOWN(id, func)}
20 Generated when right/down arrow is pressed.
23 Note that if you handle both SPIN and UP or DOWN events, you will be notified
24 about each of them twice: first the UP/DOWN event will be received and then,
25 if it wasn't vetoed, the SPIN event will be sent.
30 @see wxSpinButton and wxSpinCtrl
32 class wxSpinEvent
: public wxNotifyEvent
36 The constructor is not normally used by the user code.
38 wxSpinEvent(wxEventType commandType
= wxEVT_NULL
, int id
= 0);
41 Retrieve the current spin button or control value.
43 int GetPosition() const;
46 Set the value associated with the event.
48 void SetPosition(int pos
);
56 A wxSpinButton has two small up and down (or left and right) arrow buttons.
58 It is often used next to a text control for increment and decrementing a value.
59 Portable programs should try to use wxSpinCtrl instead as wxSpinButton is not
60 implemented for all platforms but wxSpinCtrl is as it degenerates to a simple
61 wxTextCtrl on such platforms.
63 @note the range supported by this control (and wxSpinCtrl) depends on the
64 platform but is at least @c -0x8000 to @c 0x7fff. Under GTK and
65 Win32 with sufficiently new version of @c comctrl32.dll (at least 4.71
66 is required, 5.80 is recommended) the full 32 bit range is supported.
69 @style{wxSP_HORIZONTAL}
70 Specifies a horizontal spin button (note that this style is not
73 Specifies a vertical spin button.
74 @style{wxSP_ARROW_KEYS}
75 The user can use arrow keys to change the value.
77 The value wraps at the minimum and maximum.
80 @beginEventEmissionTable{wxSpinEvent}
81 @event{EVT_SPIN(id, func)}
82 Generated whenever an arrow is pressed.
83 @event{EVT_SPIN_UP(id, func)}
84 Generated when left/up arrow is pressed.
85 @event{EVT_SPIN_DOWN(id, func)}
86 Generated when right/down arrow is pressed.
89 Note that if you handle both SPIN and UP or DOWN events, you will be notified
90 about each of them twice: first the UP/DOWN event will be received and then,
91 if it wasn't vetoed, the SPIN event will be sent.
95 @appearance{spinbutton.png}
99 class wxSpinButton
: public wxControl
108 Constructor, creating and showing a spin button.
111 Parent window. Must not be @NULL.
113 Window identifier. The value wxID_ANY indicates a default value.
116 If ::wxDefaultPosition is specified then a default position is chosen.
119 If ::wxDefaultSize is specified then a default size is chosen.
121 Window style. See wxSpinButton class description.
127 wxSpinButton(wxWindow
* parent
, wxWindowID id
= -1,
128 const wxPoint
& pos
= wxDefaultPosition
,
129 const wxSize
& size
= wxDefaultSize
,
130 long style
= wxSP_VERTICAL
,
131 const wxString
& name
= "spinButton");
134 Destructor, destroys the spin button control.
136 virtual ~wxSpinButton();
139 Scrollbar creation function called by the spin button constructor.
140 See wxSpinButton() for details.
142 bool Create(wxWindow
* parent
, wxWindowID id
= -1,
143 const wxPoint
& pos
= wxDefaultPosition
,
144 const wxSize
& size
= wxDefaultSize
,
145 long style
= wxSP_VERTICAL
,
146 const wxString
& name
= "wxSpinButton");
149 Returns the maximum permissible value.
153 virtual int GetMax() const;
156 Returns the minimum permissible value.
160 virtual int GetMin() const;
163 Returns the current spin button value.
167 virtual int GetValue() const;
170 Sets the range of the spin button.
173 The minimum value for the spin button.
175 The maximum value for the spin button.
177 @see GetMin(), GetMax()
179 virtual void SetRange(int min
, int max
);
182 Sets the value of the spin button.
185 The value for the spin button.
187 virtual void SetValue(int value
);