]> git.saurik.com Git - wxWidgets.git/blame - docs/latex/wx/slider.tex
wxFont can now raelly use the native fonts
[wxWidgets.git] / docs / latex / wx / slider.tex
CommitLineData
a660d684
KB
1\section{\class{wxSlider}}\label{wxslider}
2
3A slider is a control with a handle which can be pulled
4back and forth to change the value.
5
6In Windows versions below Windows 95, a scrollbar is used to simulate the slider. In Windows 95,
7the track bar control is used.
8
9Slider events are handled in the same way as a scrollbar.
10
11\wxheading{Derived from}
12
13\helpref{wxControl}{wxcontrol}\\
14\helpref{wxWindow}{wxwindow}\\
15\helpref{wxEvtHandler}{wxevthandler}\\
16\helpref{wxObject}{wxobject}
17
954b8ae6
JS
18\wxheading{Include files}
19
20<wx/slider.h>
21
a660d684
KB
22\wxheading{Window styles}
23
24\twocolwidtha{5cm}
25\begin{twocollist}\itemsep=0pt
26\twocolitem{\windowstyle{wxSL\_HORIZONTAL}}{Displays the slider horizontally.}
27\twocolitem{\windowstyle{wxSL\_VERTICAL}}{Displays the slider vertically.}
28\twocolitem{\windowstyle{wxSL\_AUTOTICKS}}{Displays tick marks.}
9a8c7620
VZ
29\twocolitem{\windowstyle{wxSL\_LABELS}}{Displays minimum, maximum and value labels.
30(NB: only displays the current value label under wxGTK)}
a660d684
KB
31\twocolitem{\windowstyle{wxSL\_LEFT}}{Displays ticks on the left, if a vertical slider.}
32\twocolitem{\windowstyle{wxSL\_RIGHT}}{Displays ticks on the right, if a vertical slider.}
33\twocolitem{\windowstyle{wxSL\_TOP}}{Displays ticks on the top, if a horizontal slider.}
34\twocolitem{\windowstyle{wxSL\_SELRANGE}}{Allows the user to select a range on the slider. Windows 95 only.}
35\end{twocollist}
36
37See also \helpref{window styles overview}{windowstyles}.
38
5de76427
JS
39\wxheading{Event handling}
40
41To process input from a slider, use one of these event handler macros to direct input to member
42functions that take a \helpref{wxScrollEvent}{wxscrollevent} argument:
43
44\twocolwidtha{7cm}
45\begin{twocollist}
46\twocolitem{{\bf EVT\_COMMAND\_SCROLL(id, func)}}{Catch all scroll commands.}
47\twocolitem{{\bf EVT\_COMMAND\_TOP(id, func)}}{Catch a command to put the scroll thumb at the maximum position.}
48\twocolitem{{\bf EVT\_COMMAND\_BOTTOM(id, func)}}{Catch a command to put the scroll thumb at the maximum position.}
49\twocolitem{{\bf EVT\_COMMAND\_LINEUP(id, func)}}{Catch a line up command.}
50\twocolitem{{\bf EVT\_COMMAND\_LINEDOWN(id, func)}}{Catch a line down command.}
51\twocolitem{{\bf EVT\_COMMAND\_PAGEUP(id, func)}}{Catch a page up command.}
52\twocolitem{{\bf EVT\_COMMAND\_PAGEDOWN(id, func)}}{Catch a page down command.}
53\twocolitem{{\bf EVT\_COMMAND\_THUMBTRACK(id, func)}}{Catch a thumbtrack command (continuous movement of the scroll thumb).}
54\twocolitem{{\bf EVT\_SLIDER(id, func)}}{Process a wxEVT\_COMMAND\_SLIDER\_UPDATED event,
55when the slider is moved. Though provided for backward compatibility, this is obsolete.}
56\end{twocollist}%
57
a660d684
KB
58\wxheading{See also}
59
60\helpref{Event handling overview}{eventhandlingoverview}, \helpref{wxScrollBar}{wxscrollbar}
61
62\latexignore{\rtfignore{\wxheading{Members}}}
63
64\membersection{wxSlider::wxSlider}\label{wxsliderconstr}
65
66\func{}{wxSlider}{\void}
67
68Default slider.
69
eaaa6a06
JS
70\func{}{wxSlider}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{int }{value },\rtfsp
71\param{int}{ minValue}, \param{int}{ maxValue},\rtfsp
a660d684 72\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 73\param{long}{ style = wxSL\_HORIZONTAL},\rtfsp
a660d684
KB
74\param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
75\param{const wxString\& }{name = ``slider"}}
76
77Constructor, creating and showing a slider.
78
79\wxheading{Parameters}
80
81\docparam{parent}{Parent window. Must not be NULL.}
82
83\docparam{id}{Window identifier. A value of -1 indicates a default value.}
84
85\docparam{value}{Initial position for the slider.}
86
87\docparam{minValue}{Minimum slider position.}
88
89\docparam{maxValue}{Maximum slider position.}
90
91\docparam{size}{Window size. If the default size (-1, -1) is specified then a default size is chosen.}
92
93\docparam{style}{Window style. See \helpref{wxSlider}{wxslider}.}
94
95\docparam{validator}{Window validator.}
96
97\docparam{name}{Window name.}
98
99\wxheading{See also}
100
101\helpref{wxSlider::Create}{wxslidercreate}, \helpref{wxValidator}{wxvalidator}
102
103\membersection{wxSlider::\destruct{wxSlider}}
104
105\func{void}{\destruct{wxSlider}}{\void}
106
107Destructor, destroying the slider.
108
109\membersection{wxSlider::ClearSel}\label{wxsliderclearsel}
110
111\func{void}{ClearSel}{\void}
112
113Clears the selection, for a slider with the {\bf wxSL\_SELRANGE} style.
114
115\wxheading{Remarks}
116
117Windows 95 only.
118
119\membersection{wxSlider::ClearTicks}\label{wxsliderclearticks}
120
121\func{void}{ClearTicks}{\void}
122
123Clears the ticks.
124
125\wxheading{Remarks}
126
127Windows 95 only.
128
129\membersection{wxSlider::Create}\label{wxslidercreate}
130
eaaa6a06
JS
131\func{bool}{Create}{\param{wxWindow* }{parent}, \param{wxWindowID }{id}, \param{int }{value },\rtfsp
132\param{int}{ minValue}, \param{int}{ maxValue},\rtfsp
a660d684 133\param{const wxPoint\& }{point = wxDefaultPosition}, \param{const wxSize\& }{size = wxDefaultSize},\rtfsp
eaaa6a06 134\param{long}{ style = wxSL\_HORIZONTAL},\rtfsp
a660d684
KB
135\param{const wxValidator\& }{validator = wxDefaultValidator},\rtfsp
136\param{const wxString\& }{name = ``slider"}}
137
138Used for two-step slider construction. See \helpref{wxSlider::wxSlider}{wxsliderconstr}\rtfsp
139for further details.
140
141\membersection{wxSlider::GetLineSize}\label{wxslidergetlinesize}
142
143\constfunc{int}{GetLineSize}{\void}
144
145Returns the line size.
146
147\wxheading{See also}
148
149\helpref{wxSlider::SetLineSize}{wxslidersetlinesize}
150
151\membersection{wxSlider::GetMax}\label{wxslidergetmax}
152
153\constfunc{int}{GetMax}{\void}
154
155Gets the maximum slider value.
156
157\wxheading{See also}
158
159\helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::SetRange}{wxslidersetrange}
160
161\membersection{wxSlider::GetMin}\label{wxslidergetmin}
162
163\constfunc{int}{GetMin}{\void}
164
165Gets the minimum slider value.
166
167\wxheading{See also}
168
169\helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::SetRange}{wxslidersetrange}
170
171\membersection{wxSlider::GetPageSize}\label{wxslidergetpagesize}
172
173\constfunc{int}{GetPageSize}{\void}
174
175Returns the page size.
176
177\wxheading{See also}
178
179\helpref{wxSlider::SetPageSize}{wxslidersetpagesize}
180
181\membersection{wxSlider::GetSelEnd}\label{wxslidergetselend}
182
183\constfunc{int}{GetSelEnd}{\void}
184
185Returns the selection end point.
186
187\wxheading{Remarks}
188
189Windows 95 only.
190
191\wxheading{See also}
192
193\helpref{wxSlider::GetSelStart}{wxslidergetselstart}, \helpref{wxSlider::SetSelection}{wxslidersetselection}
194
195\membersection{wxSlider::GetSelStart}\label{wxslidergetselstart}
196
197\constfunc{int}{GetSelStart}{\void}
198
199Returns the selection start point.
200
201\wxheading{Remarks}
202
203Windows 95 only.
204
205\wxheading{See also}
206
207\helpref{wxSlider::GetSelEnd}{wxslidergetselend}, \helpref{wxSlider::SetSelection}{wxslidersetselection}
208
209\membersection{wxSlider::GetThumbLength}\label{wxslidergetthumblength}
210
211\constfunc{int}{GetThumbLength}{\void}
212
213Returns the thumb length.
214
215\wxheading{Remarks}
216
217Windows 95 only.
218
219\wxheading{See also}
220
221\helpref{wxSlider::SetThumbLength}{wxslidersetthumblength}
222
223\membersection{wxSlider::GetTickFreq}\label{wxslidergettickfreq}
224
225\constfunc{int}{GetTickFreq}{\void}
226
227Returns the tick frequency.
228
229\wxheading{Remarks}
230
231Windows 95 only.
232
233\wxheading{See also}
234
235\helpref{wxSlider::SetTickFreq}{wxslidersettickfreq}
236
237\membersection{wxSlider::GetValue}\label{wxslidergetvalue}
238
239\constfunc{int}{GetValue}{\void}
240
241Gets the current slider value.
242
243\wxheading{See also}
244
245\helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::GetMax}{wxslidergetmax},\rtfsp
246\helpref{wxSlider::SetValue}{wxslidersetvalue}
247
248\membersection{wxSlider::SetRange}\label{wxslidersetrange}
249
eaaa6a06 250\func{void}{SetRange}{\param{int}{ minValue}, \param{int}{ maxValue}}
a660d684
KB
251
252Sets the minimum and maximum slider values.
253
254\wxheading{See also}
255
256\helpref{wxSlider::GetMin}{wxslidergetmin}, \helpref{wxSlider::GetMax}{wxslidergetmax}
257
258\membersection{wxSlider::SetTickFreq}\label{wxslidersettickfreq}
259
eaaa6a06 260\func{void}{SetTickFreq}{\param{int }{n}, \param{int }{pos}}
a660d684
KB
261
262Sets the tick mark frequency and position.
263
264\wxheading{Parameters}
265
266\docparam{n}{Frequency. For example, if the frequency is set to two, a tick mark is displayed for
267every other increment in the slider's range.}
268
269\docparam{pos}{Position. Must be greater than zero. TODO: what is this for?}
270
271\wxheading{Remarks}
272
273Windows 95 only.
274
275\wxheading{See also}
276
277\helpref{wxSlider::GetTickFreq}{wxslidergettickfreq}
278
279\membersection{wxSlider::SetLineSize}\label{wxslidersetlinesize}
280
eaaa6a06 281\func{void}{SetLineSize}{\param{int }{lineSize}}
a660d684
KB
282
283Sets the line size for the slider.
284
285\wxheading{Parameters}
286
287\docparam{lineSize}{The number of steps the slider moves when the user moves it up or down a line.}
288
289\wxheading{See also}
290
291\helpref{wxSlider::GetLineSize}{wxslidergetlinesize}
292
293\membersection{wxSlider::SetPageSize}\label{wxslidersetpagesize}
294
eaaa6a06 295\func{void}{SetPageSize}{\param{int }{pageSize}}
a660d684
KB
296
297Sets the page size for the slider.
298
299\wxheading{Parameters}
300
301\docparam{pageSize}{The number of steps the slider moves when the user pages up or down.}
302
303\wxheading{See also}
304
305\helpref{wxSlider::GetPageSize}{wxslidergetpagesize}
306
307\membersection{wxSlider::SetSelection}\label{wxslidersetselection}
308
eaaa6a06 309\func{void}{SetSelection}{\param{int }{startPos}, \param{int }{endPos}}
a660d684
KB
310
311Sets the selection.
312
313\wxheading{Parameters}
314
315\docparam{startPos}{The selection start position.}
316
317\docparam{endPos}{The selection end position.}
318
319\wxheading{Remarks}
320
321Windows 95 only.
322
323\wxheading{See also}
324
325\helpref{wxSlider::GetSelStart}{wxslidergetselstart}, \helpref{wxSlider::GetSelEnd}{wxslidergetselend}
326
327\membersection{wxSlider::SetThumbLength}\label{wxslidersetthumblength}
328
eaaa6a06 329\func{void}{SetThumbLength}{\param{int }{len}}
a660d684
KB
330
331Sets the slider thumb length.
332
333\wxheading{Parameters}
334
335\docparam{len}{The thumb length.}
336
337\wxheading{Remarks}
338
339Windows 95 only.
340
341\wxheading{See also}
342
343\helpref{wxSlider::GetThumbLength}{wxslidergetthumblength}
344
345\membersection{wxSlider::SetTick}\label{wxslidersettick}
346
eaaa6a06 347\func{void}{SetTick}{\param{int}{ tickPos}}
a660d684
KB
348
349Sets a tick position.
350
351\wxheading{Parameters}
352
353\docparam{tickPos}{The tick position.}
354
355\wxheading{Remarks}
356
357Windows 95 only.
358
359\wxheading{See also}
360
361\helpref{wxSlider::SetTickFreq}{wxslidersettickfreq}
362
363\membersection{wxSlider::SetValue}\label{wxslidersetvalue}
364
eaaa6a06 365\func{void}{SetValue}{\param{int}{ value}}
a660d684
KB
366
367Sets the slider position.
368
369\wxheading{Parameters}
370
371\docparam{value}{The slider position.}
372
373\wxheading{See also}
374
375\helpref{wxSlider::GetValue}{wxslidergetvalue}
376