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