]>
git.saurik.com Git - wxWidgets.git/blob - interface/wx/spinctrl.h
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: interface of wxSpinCtrl
4 // Author: wxWidgets team
6 // Licence: wxWindows license
7 /////////////////////////////////////////////////////////////////////////////
12 wxSpinCtrl combines wxTextCtrl and wxSpinButton in one control.
15 @style{wxSP_ARROW_KEYS}
16 The user can use arrow keys to change the value.
18 The value wraps at the minimum and maximum.
19 @style{wxTE_PROCESS_ENTER}
20 Indicates that the control should generate wxEVT_COMMAND_TEXT_ENTER
21 events. Using this style will prevent the user from using the Enter key
22 for dialog navigation (e.g. activating the default button in the
25 Same as wxTE_LEFT for wxTextCtrl: the text is left aligned.
26 @style{wxALIGN_CENTRE}
27 Same as wxTE_CENTRE for wxTextCtrl: the text is centered.
29 Same as wxTE_RIGHT for wxTextCtrl: the text is right aligned (this is
34 @beginEventEmissionTable{wxSpinEvent}
35 @event{EVT_SPINCTRL(id, func)}
36 Generated whenever the numeric value of the spinctrl is updated
39 You may also use the wxSpinButton event macros, however the corresponding events
40 will not be generated under all platforms. Finally, if the user modifies the
41 text in the edit part of the spin control directly, the EVT_TEXT is generated,
42 like for the wxTextCtrl. When the use enters text into the text area, the text
43 is not validated until the control loses focus (e.g. by using the TAB key).
44 The value is then adjusted to the range and a wxSpinEvent sent then if the value
45 is different from the last value sent.
49 @appearance{spinctrl.png}
51 @see wxSpinButton, wxSpinCtrlDouble, wxControl
53 class wxSpinCtrl
: public wxControl
62 Constructor, creating and showing a spin control.
65 Parent window. Must not be @NULL.
67 Default value (as text).
69 Window identifier. The value wxID_ANY indicates a default value.
72 If ::wxDefaultPosition is specified then a default position is chosen.
75 If ::wxDefaultSize is specified then a default size is chosen.
77 Window style. See wxSpinButton.
89 wxSpinCtrl(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
90 const wxString
& value
= wxEmptyString
,
91 const wxPoint
& pos
= wxDefaultPosition
,
92 const wxSize
& size
= wxDefaultSize
,
93 long style
= wxSP_ARROW_KEYS
,
94 int min
= 0, int max
= 100,
95 int initial
= 0, const wxString
& name
= "wxSpinCtrl");
98 Creation function called by the spin control constructor.
99 See wxSpinCtrl() for details.
101 bool Create(wxWindow
* parent
, wxWindowID id
= wxID_ANY
,
102 const wxString
& value
= wxEmptyString
,
103 const wxPoint
& pos
= wxDefaultPosition
,
104 const wxSize
& size
= wxDefaultSize
,
105 long style
= wxSP_ARROW_KEYS
, int min
= 0, int max
= 100,
106 int initial
= 0, const wxString
& name
= "wxSpinCtrl");
109 Gets maximal allowable value.
114 Gets minimal allowable value.
119 Gets the value of the spin control.
121 int GetValue() const;
124 Sets range of allowable values.
126 void SetRange(int minVal
, int maxVal
);
129 Select the text in the text part of the control between positions
130 @a from (inclusive) and @a to (exclusive).
131 This is similar to wxTextCtrl::SetSelection().
133 @note this is currently only implemented for Windows and generic versions
136 virtual void SetSelection(long from
, long to
);
139 Sets the value of the spin control. Use the variant using int instead.
141 virtual void SetValue(const wxString
& text
);
144 Sets the value of the spin control.
146 void SetValue(int value
);