]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: spinctrl.h | |
e54c96f1 | 3 | // Purpose: interface of wxSpinCtrl |
23324ae1 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxSpinCtrl | |
7c913512 FM |
11 | |
12 | wxSpinCtrl combines wxTextCtrl and | |
23324ae1 | 13 | wxSpinButton in one control. |
7c913512 | 14 | |
23324ae1 | 15 | @beginStyleTable |
8c6791e4 | 16 | @style{wxSP_ARROW_KEYS} |
242ec2f7 | 17 | The user can use arrow keys to change the value. |
8c6791e4 | 18 | @style{wxSP_WRAP} |
242ec2f7 VZ |
19 | The value wraps at the minimum and maximum. |
20 | @style{wxTE_PROCESS_ENTER} | |
21 | Indicates that the control should generate wxEVT_COMMAND_TEXT_ENTER | |
22 | events. Using this style will prevent the user from using the Enter key | |
23 | for dialog navigation (e.g. activating the default button in the | |
24 | dialog) under MSW. | |
23324ae1 | 25 | @endStyleTable |
7c913512 | 26 | |
23324ae1 FM |
27 | @library{wxcore} |
28 | @category{ctrl} | |
0c7fe6f2 | 29 | <!-- @appearance{spinctrl.png} --> |
7c913512 | 30 | |
42561c3c | 31 | @see wxSpinButton, wxSpinCtrlDouble, wxControl |
23324ae1 FM |
32 | */ |
33 | class wxSpinCtrl : public wxControl | |
34 | { | |
35 | public: | |
23324ae1 | 36 | /** |
d930d177 RR |
37 | Default constructor. |
38 | */ | |
39 | wxSpinCtrl(); | |
40 | ||
41 | /** | |
23324ae1 | 42 | Constructor, creating and showing a spin control. |
3c4f71cc | 43 | |
7c913512 | 44 | @param parent |
4cc4bfaf | 45 | Parent window. Must not be @NULL. |
7c913512 | 46 | @param value |
d930d177 | 47 | Default value (as text). |
7c913512 | 48 | @param id |
4cc4bfaf | 49 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 50 | @param pos |
4cc4bfaf FM |
51 | Window position. If wxDefaultPosition is specified then a default |
52 | position is chosen. | |
7c913512 | 53 | @param size |
4cc4bfaf FM |
54 | Window size. If wxDefaultSize is specified then a default size |
55 | is chosen. | |
7c913512 | 56 | @param style |
4cc4bfaf | 57 | Window style. See wxSpinButton. |
7c913512 | 58 | @param min |
4cc4bfaf | 59 | Minimal value. |
7c913512 | 60 | @param max |
4cc4bfaf | 61 | Maximal value. |
7c913512 | 62 | @param initial |
4cc4bfaf | 63 | Initial value. |
7c913512 | 64 | @param name |
4cc4bfaf | 65 | Window name. |
3c4f71cc | 66 | |
4cc4bfaf | 67 | @see Create() |
23324ae1 | 68 | */ |
7c913512 FM |
69 | wxSpinCtrl(wxWindow* parent, wxWindowID id = -1, |
70 | const wxString& value = wxEmptyString, | |
71 | const wxPoint& pos = wxDefaultPosition, | |
72 | const wxSize& size = wxDefaultSize, | |
73 | long style = wxSP_ARROW_KEYS, | |
74 | int min = 0, int max = 100, | |
42561c3c | 75 | int initial = 0, const wxString& name = _T("wxSpinCtrl")); |
23324ae1 FM |
76 | |
77 | /** | |
23324ae1 | 78 | Creation function called by the spin control constructor. |
23324ae1 FM |
79 | See wxSpinCtrl() for details. |
80 | */ | |
81 | bool Create(wxWindow* parent, wxWindowID id = -1, | |
82 | const wxString& value = wxEmptyString, | |
83 | const wxPoint& pos = wxDefaultPosition, | |
84 | const wxSize& size = wxDefaultSize, | |
85 | long style = wxSP_ARROW_KEYS, | |
86 | int min = 0, int max = 100, | |
42561c3c | 87 | int initial = 0, const wxString& name = _T("wxSpinCtrl")); |
23324ae1 FM |
88 | |
89 | /** | |
90 | Gets maximal allowable value. | |
91 | */ | |
328f5751 | 92 | int GetMax() const; |
23324ae1 FM |
93 | |
94 | /** | |
95 | Gets minimal allowable value. | |
96 | */ | |
328f5751 | 97 | int GetMin() const; |
23324ae1 FM |
98 | |
99 | /** | |
100 | Gets the value of the spin control. | |
101 | */ | |
328f5751 | 102 | int GetValue() const; |
23324ae1 FM |
103 | |
104 | /** | |
105 | Sets range of allowable values. | |
106 | */ | |
107 | void SetRange(int minVal, int maxVal); | |
108 | ||
109 | /** | |
7c913512 | 110 | Select the text in the text part of the control between positions |
4cc4bfaf | 111 | @a from (inclusive) and @a to (exclusive). This is similar to |
23324ae1 | 112 | wxTextCtrl::SetSelection. |
1f1d2182 | 113 | @note this is currently only implemented for Windows and generic versions |
23324ae1 FM |
114 | of the control. |
115 | */ | |
116 | void SetSelection(long from, long to); | |
117 | ||
23324ae1 | 118 | /** |
d930d177 | 119 | Sets the value of the spin control. Use the variant using int instead. |
23324ae1 | 120 | */ |
adaaa686 | 121 | virtual void SetValue(const wxString& text); |
d930d177 RR |
122 | |
123 | /** | |
124 | Sets the value of the spin control. | |
125 | */ | |
7c913512 | 126 | void SetValue(int value); |
23324ae1 | 127 | }; |
e54c96f1 | 128 |