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