]>
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 | /** | |
55 | Constructor, creating and showing a slider. | |
56 | ||
57 | @param parent | |
58 | Parent window. Must not be @NULL. | |
59 | @param id | |
60 | Window identifier. The value wxID_ANY indicates a default value. | |
61 | @param value | |
62 | Initial position for the slider. | |
63 | @param minValue | |
64 | Minimum slider position. | |
65 | @param maxValue | |
66 | Maximum slider position. | |
67 | @param size | |
68 | Window size. If wxDefaultSize is specified then a default size | |
69 | is chosen. | |
70 | @param style | |
71 | Window style. See wxSlider. | |
72 | @param validator | |
73 | Window validator. | |
74 | @param name | |
75 | Window name. | |
76 | ||
77 | @see Create(), wxValidator | |
78 | */ | |
79 | wxSlider(); | |
80 | wxSlider(wxWindow* parent, wxWindowID id, int value, | |
81 | int minValue, int maxValue, | |
82 | const wxPoint& point = wxDefaultPosition, | |
83 | const wxSize& size = wxDefaultSize, | |
84 | long style = wxSL_HORIZONTAL, | |
85 | const wxValidator& validator = wxDefaultValidator, | |
86 | const wxString& name = "slider"); | |
87 | //@} | |
88 | ||
89 | /** | |
90 | Destructor, destroying the slider. | |
91 | */ | |
92 | ~wxSlider(); | |
93 | ||
94 | /** | |
95 | Clears the selection, for a slider with the @b wxSL_SELRANGE style. | |
96 | ||
97 | @remarks Windows 95 only. | |
98 | */ | |
99 | void ClearSel(); | |
100 | ||
101 | /** | |
102 | Clears the ticks. | |
103 | ||
104 | @remarks Windows 95 only. | |
105 | */ | |
106 | void ClearTicks(); | |
107 | ||
108 | /** | |
109 | Used for two-step slider construction. See wxSlider() | |
110 | for further details. | |
111 | */ | |
112 | bool Create(wxWindow* parent, wxWindowID id, int value, | |
113 | int minValue, int maxValue, | |
114 | const wxPoint& point = wxDefaultPosition, | |
115 | const wxSize& size = wxDefaultSize, | |
116 | long style = wxSL_HORIZONTAL, | |
117 | const wxValidator& validator = wxDefaultValidator, | |
118 | const wxString& name = "slider"); | |
119 | ||
120 | /** | |
121 | Returns the line size. | |
122 | ||
123 | @see SetLineSize() | |
124 | */ | |
125 | int GetLineSize() const; | |
126 | ||
127 | /** | |
128 | Gets the maximum slider value. | |
129 | ||
130 | @see GetMin(), SetRange() | |
131 | */ | |
132 | int GetMax() const; | |
133 | ||
134 | /** | |
135 | Gets the minimum slider value. | |
136 | ||
137 | @see GetMin(), SetRange() | |
138 | */ | |
139 | int GetMin() const; | |
140 | ||
141 | /** | |
142 | Returns the page size. | |
143 | ||
144 | @see SetPageSize() | |
145 | */ | |
146 | int GetPageSize() const; | |
147 | ||
148 | /** | |
149 | Returns the selection end point. | |
150 | ||
151 | @remarks Windows 95 only. | |
152 | ||
153 | @see GetSelStart(), SetSelection() | |
154 | */ | |
155 | int GetSelEnd() const; | |
156 | ||
157 | /** | |
158 | Returns the selection start point. | |
159 | ||
160 | @remarks Windows 95 only. | |
161 | ||
162 | @see GetSelEnd(), SetSelection() | |
163 | */ | |
164 | int GetSelStart() const; | |
165 | ||
166 | /** | |
167 | Returns the thumb length. | |
168 | ||
169 | @remarks Windows 95 only. | |
170 | ||
171 | @see SetThumbLength() | |
172 | */ | |
173 | int GetThumbLength() const; | |
174 | ||
175 | /** | |
176 | Returns the tick frequency. | |
177 | ||
178 | @remarks Windows 95 only. | |
179 | ||
180 | @see SetTickFreq() | |
181 | */ | |
182 | int GetTickFreq() const; | |
183 | ||
184 | /** | |
185 | Gets the current slider value. | |
186 | ||
187 | @see GetMin(), GetMax(), SetValue() | |
188 | */ | |
189 | int GetValue() const; | |
190 | ||
191 | /** | |
192 | Sets the line size for the slider. | |
193 | ||
194 | @param lineSize | |
195 | The number of steps the slider moves when the user moves it up or down a | |
196 | line. | |
197 | ||
198 | @see GetLineSize() | |
199 | */ | |
200 | void SetLineSize(int lineSize); | |
201 | ||
202 | /** | |
203 | Sets the page size for the slider. | |
204 | ||
205 | @param pageSize | |
206 | The number of steps the slider moves when the user pages up or down. | |
207 | ||
208 | @see GetPageSize() | |
209 | */ | |
210 | void SetPageSize(int pageSize); | |
211 | ||
212 | /** | |
213 | Sets the minimum and maximum slider values. | |
214 | ||
215 | @see GetMin(), GetMax() | |
216 | */ | |
217 | void SetRange(int minValue, int maxValue); | |
218 | ||
219 | /** | |
220 | Sets the selection. | |
221 | ||
222 | @param startPos | |
223 | The selection start position. | |
224 | @param endPos | |
225 | The selection end position. | |
226 | ||
227 | @remarks Windows 95 only. | |
228 | ||
229 | @see GetSelStart(), GetSelEnd() | |
230 | */ | |
231 | void SetSelection(int startPos, int endPos); | |
232 | ||
233 | /** | |
234 | Sets the slider thumb length. | |
235 | ||
236 | @param len | |
237 | The thumb length. | |
238 | ||
239 | @remarks Windows 95 only. | |
240 | ||
241 | @see GetThumbLength() | |
242 | */ | |
243 | void SetThumbLength(int len); | |
244 | ||
245 | /** | |
246 | Sets a tick position. | |
247 | ||
248 | @param tickPos | |
249 | The tick position. | |
250 | ||
251 | @remarks Windows 95 only. | |
252 | ||
253 | @see SetTickFreq() | |
254 | */ | |
255 | void SetTick(int tickPos); | |
256 | ||
257 | /** | |
258 | Sets the tick mark frequency and position. | |
259 | ||
260 | @param n | |
261 | Frequency. For example, if the frequency is set to two, a tick mark is | |
262 | displayed for | |
263 | every other increment in the slider's range. | |
264 | @param pos | |
265 | Position. Must be greater than zero. TODO: what is this for? | |
266 | ||
267 | @remarks Windows 95 only. | |
268 | ||
269 | @see GetTickFreq() | |
270 | */ | |
271 | void SetTickFreq(int n, int pos); | |
272 | ||
273 | /** | |
274 | Sets the slider position. | |
275 | ||
276 | @param value | |
277 | The slider position. | |
278 | */ | |
279 | void SetValue(int value); | |
280 | }; | |
281 |