]> git.saurik.com Git - wxWidgets.git/blame - interface/slider.h
documented that Freeze and Thaw are now recursive
[wxWidgets.git] / interface / slider.h
CommitLineData
23324ae1
FM
1/////////////////////////////////////////////////////////////////////////////
2// Name: slider.h
e54c96f1 3// Purpose: interface of wxSlider
23324ae1
FM
4// Author: wxWidgets team
5// RCS-ID: $Id$
6// Licence: wxWindows license
7/////////////////////////////////////////////////////////////////////////////
8
9/**
10 @class wxSlider
11 @wxheader{slider.h}
7c913512 12
23324ae1
FM
13 A slider is a control with a handle which can be pulled
14 back and forth to change the value.
7c913512 15
23324ae1 16 On Windows, the track bar control is used.
7c913512 17
23324ae1 18 Slider events are handled in the same way as a scrollbar.
7c913512 19
23324ae1
FM
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
7c913512 43
23324ae1
FM
44 @library{wxcore}
45 @category{ctrl}
46 @appearance{slider.png}
7c913512 47
e54c96f1 48 @see @ref overview_eventhandlingoverview, wxScrollBar
23324ae1
FM
49*/
50class wxSlider : public wxControl
51{
52public:
53 //@{
54 /**
55 Constructor, creating and showing a slider.
3c4f71cc 56
7c913512 57 @param parent
4cc4bfaf 58 Parent window. Must not be @NULL.
7c913512 59 @param id
4cc4bfaf 60 Window identifier. The value wxID_ANY indicates a default value.
7c913512 61 @param value
4cc4bfaf 62 Initial position for the slider.
7c913512 63 @param minValue
4cc4bfaf 64 Minimum slider position.
7c913512 65 @param maxValue
4cc4bfaf 66 Maximum slider position.
7c913512 67 @param size
4cc4bfaf
FM
68 Window size. If wxDefaultSize is specified then a default size
69 is chosen.
7c913512 70 @param style
4cc4bfaf 71 Window style. See wxSlider.
7c913512 72 @param validator
4cc4bfaf 73 Window validator.
7c913512 74 @param name
4cc4bfaf 75 Window name.
3c4f71cc 76
4cc4bfaf 77 @see Create(), wxValidator
23324ae1
FM
78 */
79 wxSlider();
7c913512
FM
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");
23324ae1
FM
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.
3c4f71cc 96
23324ae1
FM
97 @remarks Windows 95 only.
98 */
99 void ClearSel();
100
101 /**
102 Clears the ticks.
3c4f71cc 103
23324ae1
FM
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.
3c4f71cc 122
4cc4bfaf 123 @see SetLineSize()
23324ae1 124 */
328f5751 125 int GetLineSize() const;
23324ae1
FM
126
127 /**
128 Gets the maximum slider value.
3c4f71cc 129
4cc4bfaf 130 @see GetMin(), SetRange()
23324ae1 131 */
328f5751 132 int GetMax() const;
23324ae1
FM
133
134 /**
135 Gets the minimum slider value.
3c4f71cc 136
4cc4bfaf 137 @see GetMin(), SetRange()
23324ae1 138 */
328f5751 139 int GetMin() const;
23324ae1
FM
140
141 /**
142 Returns the page size.
3c4f71cc 143
4cc4bfaf 144 @see SetPageSize()
23324ae1 145 */
328f5751 146 int GetPageSize() const;
23324ae1
FM
147
148 /**
149 Returns the selection end point.
3c4f71cc 150
23324ae1 151 @remarks Windows 95 only.
3c4f71cc 152
4cc4bfaf 153 @see GetSelStart(), SetSelection()
23324ae1 154 */
328f5751 155 int GetSelEnd() const;
23324ae1
FM
156
157 /**
158 Returns the selection start point.
3c4f71cc 159
23324ae1 160 @remarks Windows 95 only.
3c4f71cc 161
4cc4bfaf 162 @see GetSelEnd(), SetSelection()
23324ae1 163 */
328f5751 164 int GetSelStart() const;
23324ae1
FM
165
166 /**
167 Returns the thumb length.
3c4f71cc 168
23324ae1 169 @remarks Windows 95 only.
3c4f71cc 170
4cc4bfaf 171 @see SetThumbLength()
23324ae1 172 */
328f5751 173 int GetThumbLength() const;
23324ae1
FM
174
175 /**
176 Returns the tick frequency.
3c4f71cc 177
23324ae1 178 @remarks Windows 95 only.
3c4f71cc 179
4cc4bfaf 180 @see SetTickFreq()
23324ae1 181 */
328f5751 182 int GetTickFreq() const;
23324ae1
FM
183
184 /**
185 Gets the current slider value.
3c4f71cc 186
4cc4bfaf 187 @see GetMin(), GetMax(), SetValue()
23324ae1 188 */
328f5751 189 int GetValue() const;
23324ae1
FM
190
191 /**
192 Sets the line size for the slider.
3c4f71cc 193
7c913512 194 @param lineSize
4cc4bfaf
FM
195 The number of steps the slider moves when the user moves it up or down a
196 line.
3c4f71cc 197
4cc4bfaf 198 @see GetLineSize()
23324ae1
FM
199 */
200 void SetLineSize(int lineSize);
201
202 /**
203 Sets the page size for the slider.
3c4f71cc 204
7c913512 205 @param pageSize
4cc4bfaf 206 The number of steps the slider moves when the user pages up or down.
3c4f71cc 207
4cc4bfaf 208 @see GetPageSize()
23324ae1
FM
209 */
210 void SetPageSize(int pageSize);
211
212 /**
213 Sets the minimum and maximum slider values.
3c4f71cc 214
4cc4bfaf 215 @see GetMin(), GetMax()
23324ae1
FM
216 */
217 void SetRange(int minValue, int maxValue);
218
219 /**
220 Sets the selection.
3c4f71cc 221
7c913512 222 @param startPos
4cc4bfaf 223 The selection start position.
7c913512 224 @param endPos
4cc4bfaf 225 The selection end position.
3c4f71cc 226
23324ae1 227 @remarks Windows 95 only.
3c4f71cc 228
4cc4bfaf 229 @see GetSelStart(), GetSelEnd()
23324ae1
FM
230 */
231 void SetSelection(int startPos, int endPos);
232
233 /**
234 Sets the slider thumb length.
3c4f71cc 235
7c913512 236 @param len
4cc4bfaf 237 The thumb length.
3c4f71cc 238
23324ae1 239 @remarks Windows 95 only.
3c4f71cc 240
4cc4bfaf 241 @see GetThumbLength()
23324ae1
FM
242 */
243 void SetThumbLength(int len);
244
245 /**
246 Sets a tick position.
3c4f71cc 247
7c913512 248 @param tickPos
4cc4bfaf 249 The tick position.
3c4f71cc 250
23324ae1 251 @remarks Windows 95 only.
3c4f71cc 252
4cc4bfaf 253 @see SetTickFreq()
23324ae1
FM
254 */
255 void SetTick(int tickPos);
256
257 /**
258 Sets the tick mark frequency and position.
3c4f71cc 259
7c913512 260 @param n
4cc4bfaf 261 Frequency. For example, if the frequency is set to two, a tick mark is
23324ae1 262 displayed for
4cc4bfaf 263 every other increment in the slider's range.
7c913512 264 @param pos
4cc4bfaf 265 Position. Must be greater than zero. TODO: what is this for?
3c4f71cc 266
23324ae1 267 @remarks Windows 95 only.
3c4f71cc 268
4cc4bfaf 269 @see GetTickFreq()
23324ae1
FM
270 */
271 void SetTickFreq(int n, int pos);
272
273 /**
274 Sets the slider position.
3c4f71cc 275
7c913512 276 @param value
4cc4bfaf 277 The slider position.
23324ae1
FM
278 */
279 void SetValue(int value);
280};
e54c96f1 281