]>
Commit | Line | Data |
---|---|---|
23324ae1 FM |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: spinbutt.h | |
e725ba4f | 3 | // Purpose: interface of wxSpinEvent, wxSpinButton |
23324ae1 | 4 | // Author: wxWidgets team |
526954c5 | 5 | // Licence: wxWindows licence |
23324ae1 FM |
6 | ///////////////////////////////////////////////////////////////////////////// |
7 | ||
8 | /** | |
9 | @class wxSpinEvent | |
7c913512 | 10 | |
e725ba4f FM |
11 | This event class is used for the events generated by wxSpinButton and wxSpinCtrl. |
12 | ||
13 | @beginEventTable{wxSpinEvent} | |
14 | @event{EVT_SPIN(id, func)} | |
15 | Generated whenever an arrow is pressed. | |
16 | @event{EVT_SPIN_UP(id, func)} | |
17 | Generated when left/up arrow is pressed. | |
18 | @event{EVT_SPIN_DOWN(id, func)} | |
19 | Generated when right/down arrow is pressed. | |
20 | @endEventTable | |
21 | ||
22 | Note that if you handle both SPIN and UP or DOWN events, you will be notified | |
23 | about each of them twice: first the UP/DOWN event will be received and then, | |
24 | if it wasn't vetoed, the SPIN event will be sent. | |
7c913512 | 25 | |
23324ae1 FM |
26 | @library{wxcore} |
27 | @category{events} | |
7c913512 | 28 | |
e54c96f1 | 29 | @see wxSpinButton and wxSpinCtrl |
23324ae1 FM |
30 | */ |
31 | class wxSpinEvent : public wxNotifyEvent | |
32 | { | |
33 | public: | |
34 | /** | |
35 | The constructor is not normally used by the user code. | |
36 | */ | |
4cc4bfaf | 37 | wxSpinEvent(wxEventType commandType = wxEVT_NULL, int id = 0); |
23324ae1 FM |
38 | |
39 | /** | |
40 | Retrieve the current spin button or control value. | |
41 | */ | |
328f5751 | 42 | int GetPosition() const; |
23324ae1 FM |
43 | |
44 | /** | |
45 | Set the value associated with the event. | |
46 | */ | |
47 | void SetPosition(int pos); | |
48 | }; | |
49 | ||
50 | ||
e54c96f1 | 51 | |
23324ae1 FM |
52 | /** |
53 | @class wxSpinButton | |
7c913512 | 54 | |
e725ba4f FM |
55 | A wxSpinButton has two small up and down (or left and right) arrow buttons. |
56 | ||
57 | It is often used next to a text control for increment and decrementing a value. | |
58 | Portable programs should try to use wxSpinCtrl instead as wxSpinButton is not | |
59 | implemented for all platforms but wxSpinCtrl is as it degenerates to a simple | |
60 | wxTextCtrl on such platforms. | |
7c913512 | 61 | |
1f1d2182 | 62 | @note the range supported by this control (and wxSpinCtrl) depends on the |
e725ba4f FM |
63 | platform but is at least @c -0x8000 to @c 0x7fff. Under GTK and |
64 | Win32 with sufficiently new version of @c comctrl32.dll (at least 4.71 | |
65 | is required, 5.80 is recommended) the full 32 bit range is supported. | |
7c913512 | 66 | |
23324ae1 | 67 | @beginStyleTable |
8c6791e4 | 68 | @style{wxSP_HORIZONTAL} |
23324ae1 FM |
69 | Specifies a horizontal spin button (note that this style is not |
70 | supported in wxGTK). | |
8c6791e4 | 71 | @style{wxSP_VERTICAL} |
23324ae1 | 72 | Specifies a vertical spin button. |
8c6791e4 | 73 | @style{wxSP_ARROW_KEYS} |
23324ae1 | 74 | The user can use arrow keys to change the value. |
8c6791e4 | 75 | @style{wxSP_WRAP} |
23324ae1 FM |
76 | The value wraps at the minimum and maximum. |
77 | @endStyleTable | |
7c913512 | 78 | |
3051a44a | 79 | @beginEventEmissionTable{wxSpinEvent} |
e725ba4f FM |
80 | @event{EVT_SPIN(id, func)} |
81 | Generated whenever an arrow is pressed. | |
82 | @event{EVT_SPIN_UP(id, func)} | |
83 | Generated when left/up arrow is pressed. | |
84 | @event{EVT_SPIN_DOWN(id, func)} | |
85 | Generated when right/down arrow is pressed. | |
86 | @endEventTable | |
87 | ||
88 | Note that if you handle both SPIN and UP or DOWN events, you will be notified | |
89 | about each of them twice: first the UP/DOWN event will be received and then, | |
90 | if it wasn't vetoed, the SPIN event will be sent. | |
91 | ||
23324ae1 FM |
92 | @library{wxcore} |
93 | @category{ctrl} | |
ce154616 | 94 | @appearance{spinbutton} |
7c913512 | 95 | |
e54c96f1 | 96 | @see wxSpinCtrl |
23324ae1 FM |
97 | */ |
98 | class wxSpinButton : public wxControl | |
99 | { | |
100 | public: | |
d930d177 RR |
101 | /** |
102 | Default constructor. | |
103 | */ | |
104 | wxSpinButton(); | |
e725ba4f | 105 | |
23324ae1 FM |
106 | /** |
107 | Constructor, creating and showing a spin button. | |
3c4f71cc | 108 | |
7c913512 | 109 | @param parent |
4cc4bfaf | 110 | Parent window. Must not be @NULL. |
7c913512 | 111 | @param id |
4cc4bfaf | 112 | Window identifier. The value wxID_ANY indicates a default value. |
7c913512 | 113 | @param pos |
e725ba4f | 114 | Window position. |
dc1b07fd | 115 | If ::wxDefaultPosition is specified then a default position is chosen. |
7c913512 | 116 | @param size |
e725ba4f | 117 | Window size. |
dc1b07fd | 118 | If ::wxDefaultSize is specified then a default size is chosen. |
7c913512 | 119 | @param style |
e725ba4f | 120 | Window style. See wxSpinButton class description. |
7c913512 | 121 | @param name |
4cc4bfaf | 122 | Window name. |
3c4f71cc | 123 | |
4cc4bfaf | 124 | @see Create() |
23324ae1 | 125 | */ |
11e3af6e | 126 | wxSpinButton(wxWindow* parent, wxWindowID id = -1, |
7c913512 FM |
127 | const wxPoint& pos = wxDefaultPosition, |
128 | const wxSize& size = wxDefaultSize, | |
11e3af6e | 129 | long style = wxSP_VERTICAL, |
7c913512 | 130 | const wxString& name = "spinButton"); |
23324ae1 FM |
131 | |
132 | /** | |
133 | Destructor, destroys the spin button control. | |
134 | */ | |
adaaa686 | 135 | virtual ~wxSpinButton(); |
23324ae1 FM |
136 | |
137 | /** | |
138 | Scrollbar creation function called by the spin button constructor. | |
139 | See wxSpinButton() for details. | |
140 | */ | |
5267aefd | 141 | bool Create(wxWindow* parent, wxWindowID id = -1, |
23324ae1 | 142 | const wxPoint& pos = wxDefaultPosition, |
11e3af6e FM |
143 | const wxSize& size = wxDefaultSize, |
144 | long style = wxSP_VERTICAL, | |
5267aefd | 145 | const wxString& name = "wxSpinButton"); |
23324ae1 FM |
146 | |
147 | /** | |
148 | Returns the maximum permissible value. | |
3c4f71cc | 149 | |
4cc4bfaf | 150 | @see SetRange() |
23324ae1 | 151 | */ |
adaaa686 | 152 | virtual int GetMax() const; |
23324ae1 FM |
153 | |
154 | /** | |
155 | Returns the minimum permissible value. | |
3c4f71cc | 156 | |
4cc4bfaf | 157 | @see SetRange() |
23324ae1 | 158 | */ |
adaaa686 | 159 | virtual int GetMin() const; |
23324ae1 FM |
160 | |
161 | /** | |
162 | Returns the current spin button value. | |
3c4f71cc | 163 | |
4cc4bfaf | 164 | @see SetValue() |
23324ae1 | 165 | */ |
adaaa686 | 166 | virtual int GetValue() const; |
23324ae1 FM |
167 | |
168 | /** | |
169 | Sets the range of the spin button. | |
3c4f71cc | 170 | |
7c913512 | 171 | @param min |
4cc4bfaf | 172 | The minimum value for the spin button. |
7c913512 | 173 | @param max |
4cc4bfaf | 174 | The maximum value for the spin button. |
3c4f71cc | 175 | |
4cc4bfaf | 176 | @see GetMin(), GetMax() |
23324ae1 | 177 | */ |
adaaa686 | 178 | virtual void SetRange(int min, int max); |
23324ae1 FM |
179 | |
180 | /** | |
181 | Sets the value of the spin button. | |
3c4f71cc | 182 | |
7c913512 | 183 | @param value |
4cc4bfaf | 184 | The value for the spin button. |
23324ae1 | 185 | */ |
adaaa686 | 186 | virtual void SetValue(int value); |
23324ae1 | 187 | }; |
e54c96f1 | 188 |