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