]>
Commit | Line | Data |
---|---|---|
1 | ///////////////////////////////////////////////////////////////////////////// | |
2 | // Name: slider.h | |
3 | // Purpose: interface of wxSlider | |
4 | // Author: wxWidgets team | |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | /** | |
10 | @class wxSlider | |
11 | @wxheader{slider.h} | |
12 | ||
13 | A slider is a control with a handle which can be pulled | |
14 | back and forth to change the value. | |
15 | ||
16 | On Windows, the track bar control is used. | |
17 | ||
18 | Slider events are handled in the same way as a scrollbar. | |
19 | ||
20 | @beginStyleTable | |
21 | @style{wxSL_HORIZONTAL} | |
22 | Displays the slider horizontally (this is the default). | |
23 | @style{wxSL_VERTICAL} | |
24 | Displays the slider vertically. | |
25 | @style{wxSL_AUTOTICKS} | |
26 | Displays tick marks. | |
27 | @style{wxSL_LABELS} | |
28 | Displays minimum, maximum and value labels. | |
29 | @style{wxSL_LEFT} | |
30 | Displays ticks on the left and forces the slider to be vertical. | |
31 | @style{wxSL_RIGHT} | |
32 | Displays ticks on the right and forces the slider to be vertical. | |
33 | @style{wxSL_TOP} | |
34 | Displays ticks on the top. | |
35 | @style{wxSL_BOTTOM} | |
36 | Displays ticks on the bottom (this is the default). | |
37 | @style{wxSL_SELRANGE} | |
38 | Allows the user to select a range on the slider. Windows only. | |
39 | @style{wxSL_INVERSE} | |
40 | Inverses the mininum and maximum endpoints on the slider. Not | |
41 | compatible with wxSL_SELRANGE. | |
42 | @endStyleTable | |
43 | ||
44 | @library{wxcore} | |
45 | @category{ctrl} | |
46 | <!-- @appearance{slider.png} --> | |
47 | ||
48 | @see @ref overview_eventhandlingoverview, wxScrollBar | |
49 | */ | |
50 | class wxSlider : public wxControl | |
51 | { | |
52 | public: | |
53 | /** | |
54 | Default constructor | |
55 | */ | |
56 | wxSlider(); | |
57 | ||
58 | /** | |
59 | Constructor, creating and showing a slider. | |
60 | ||
61 | @param parent | |
62 | Parent window. Must not be @NULL. | |
63 | @param id | |
64 | Window identifier. The value wxID_ANY indicates a default value. | |
65 | @param value | |
66 | Initial position for the slider. | |
67 | @param minValue | |
68 | Minimum slider position. | |
69 | @param maxValue | |
70 | Maximum slider position. | |
71 | @param size | |
72 | Window size. If wxDefaultSize is specified then a default size | |
73 | is chosen. | |
74 | @param style | |
75 | Window style. See wxSlider. | |
76 | @param validator | |
77 | Window validator. | |
78 | @param name | |
79 | Window name. | |
80 | ||
81 | @see Create(), wxValidator | |
82 | */ | |
83 | wxSlider(wxWindow* parent, wxWindowID id, int value, | |
84 | int minValue, int maxValue, | |
85 | const wxPoint& point = wxDefaultPosition, | |
86 | const wxSize& size = wxDefaultSize, | |
87 | long style = wxSL_HORIZONTAL, | |
88 | const wxValidator& validator = wxDefaultValidator, | |
89 | const wxString& name = "slider"); | |
90 | ||
91 | /** | |
92 | Destructor, destroying the slider. | |
93 | */ | |
94 | ~wxSlider(); | |
95 | ||
96 | /** | |
97 | Clears the selection, for a slider with the @b wxSL_SELRANGE style. | |
98 | ||
99 | @remarks Windows 95 only. | |
100 | */ | |
101 | void ClearSel(); | |
102 | ||
103 | /** | |
104 | Clears the ticks. | |
105 | ||
106 | @remarks Windows 95 only. | |
107 | */ | |
108 | void ClearTicks(); | |
109 | ||
110 | /** | |
111 | Used for two-step slider construction. See wxSlider() | |
112 | for further details. | |
113 | */ | |
114 | bool Create(wxWindow* parent, wxWindowID id, int value, | |
115 | int minValue, int maxValue, | |
116 | const wxPoint& point = wxDefaultPosition, | |
117 | const wxSize& size = wxDefaultSize, | |
118 | long style = wxSL_HORIZONTAL, | |
119 | const wxValidator& validator = wxDefaultValidator, | |
120 | const wxString& name = "slider"); | |
121 | ||
122 | /** | |
123 | Returns the line size. | |
124 | ||
125 | @see SetLineSize() | |
126 | */ | |
127 | int GetLineSize() const; | |
128 | ||
129 | /** | |
130 | Gets the maximum slider value. | |
131 | ||
132 | @see GetMin(), SetRange() | |
133 | */ | |
134 | int GetMax() const; | |
135 | ||
136 | /** | |
137 | Gets the minimum slider value. | |
138 | ||
139 | @see GetMin(), SetRange() | |
140 | */ | |
141 | int GetMin() const; | |
142 | ||
143 | /** | |
144 | Returns the page size. | |
145 | ||
146 | @see SetPageSize() | |
147 | */ | |
148 | int GetPageSize() const; | |
149 | ||
150 | /** | |
151 | Returns the selection end point. | |
152 | ||
153 | @remarks Windows 95 only. | |
154 | ||
155 | @see GetSelStart(), SetSelection() | |
156 | */ | |
157 | int GetSelEnd() const; | |
158 | ||
159 | /** | |
160 | Returns the selection start point. | |
161 | ||
162 | @remarks Windows 95 only. | |
163 | ||
164 | @see GetSelEnd(), SetSelection() | |
165 | */ | |
166 | int GetSelStart() const; | |
167 | ||
168 | /** | |
169 | Returns the thumb length. | |
170 | ||
171 | @remarks Windows 95 only. | |
172 | ||
173 | @see SetThumbLength() | |
174 | */ | |
175 | int GetThumbLength() const; | |
176 | ||
177 | /** | |
178 | Returns the tick frequency. | |
179 | ||
180 | @remarks Windows 95 only. | |
181 | ||
182 | @see SetTickFreq() | |
183 | */ | |
184 | int GetTickFreq() const; | |
185 | ||
186 | /** | |
187 | Gets the current slider value. | |
188 | ||
189 | @see GetMin(), GetMax(), SetValue() | |
190 | */ | |
191 | int GetValue() const; | |
192 | ||
193 | /** | |
194 | Sets the line size for the slider. | |
195 | ||
196 | @param lineSize | |
197 | The number of steps the slider moves when the user moves it up or down a | |
198 | line. | |
199 | ||
200 | @see GetLineSize() | |
201 | */ | |
202 | void SetLineSize(int lineSize); | |
203 | ||
204 | /** | |
205 | Sets the page size for the slider. | |
206 | ||
207 | @param pageSize | |
208 | The number of steps the slider moves when the user pages up or down. | |
209 | ||
210 | @see GetPageSize() | |
211 | */ | |
212 | void SetPageSize(int pageSize); | |
213 | ||
214 | /** | |
215 | Sets the minimum and maximum slider values. | |
216 | ||
217 | @see GetMin(), GetMax() | |
218 | */ | |
219 | void SetRange(int minValue, int maxValue); | |
220 | ||
221 | /** | |
222 | Sets the selection. | |
223 | ||
224 | @param startPos | |
225 | The selection start position. | |
226 | @param endPos | |
227 | The selection end position. | |
228 | ||
229 | @remarks Windows 95 only. | |
230 | ||
231 | @see GetSelStart(), GetSelEnd() | |
232 | */ | |
233 | void SetSelection(int startPos, int endPos); | |
234 | ||
235 | /** | |
236 | Sets the slider thumb length. | |
237 | ||
238 | @param len | |
239 | The thumb length. | |
240 | ||
241 | @remarks Windows 95 only. | |
242 | ||
243 | @see GetThumbLength() | |
244 | */ | |
245 | void SetThumbLength(int len); | |
246 | ||
247 | /** | |
248 | Sets a tick position. | |
249 | ||
250 | @param tickPos | |
251 | The tick position. | |
252 | ||
253 | @remarks Windows 95 only. | |
254 | ||
255 | @see SetTickFreq() | |
256 | */ | |
257 | void SetTick(int tickPos); | |
258 | ||
259 | /** | |
260 | Sets the tick mark frequency and position. | |
261 | ||
262 | @param n | |
263 | Frequency. For example, if the frequency is set to two, a tick mark is | |
264 | displayed for | |
265 | every other increment in the slider's range. | |
266 | @param pos | |
267 | Position. Must be greater than zero. TODO: what is this for? | |
268 | ||
269 | @remarks Windows 95 only. | |
270 | ||
271 | @see GetTickFreq() | |
272 | */ | |
273 | void SetTickFreq(int n, int pos); | |
274 | ||
275 | /** | |
276 | Sets the slider position. | |
277 | ||
278 | @param value | |
279 | The slider position. | |
280 | */ | |
281 | void SetValue(int value); | |
282 | }; | |
283 |