]> git.saurik.com Git - wxWidgets.git/blame - interface/slider.h
add wxShowEvent::IsShown() and wxIconizeEvent::IsIconized() instead of (now deprecate...
[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 20 @beginStyleTable
8c6791e4 21 @style{wxSL_HORIZONTAL}
23324ae1 22 Displays the slider horizontally (this is the default).
8c6791e4 23 @style{wxSL_VERTICAL}
23324ae1 24 Displays the slider vertically.
8c6791e4 25 @style{wxSL_AUTOTICKS}
23324ae1 26 Displays tick marks.
8c6791e4 27 @style{wxSL_LABELS}
23324ae1 28 Displays minimum, maximum and value labels.
8c6791e4 29 @style{wxSL_LEFT}
23324ae1 30 Displays ticks on the left and forces the slider to be vertical.
8c6791e4 31 @style{wxSL_RIGHT}
23324ae1 32 Displays ticks on the right and forces the slider to be vertical.
8c6791e4 33 @style{wxSL_TOP}
23324ae1 34 Displays ticks on the top.
8c6791e4 35 @style{wxSL_BOTTOM}
23324ae1 36 Displays ticks on the bottom (this is the default).
8c6791e4 37 @style{wxSL_SELRANGE}
23324ae1 38 Allows the user to select a range on the slider. Windows only.
8c6791e4 39 @style{wxSL_INVERSE}
23324ae1
FM
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}
0c7fe6f2 46 <!-- @appearance{slider.png} -->
7c913512 47
e54c96f1 48 @see @ref overview_eventhandlingoverview, wxScrollBar
23324ae1
FM
49*/
50class wxSlider : public wxControl
51{
52public:
7adc2e2e
RR
53 /**
54 Default constructor
55 */
56 wxSlider();
57
23324ae1
FM
58 /**
59 Constructor, creating and showing a slider.
3c4f71cc 60
7c913512 61 @param parent
4cc4bfaf 62 Parent window. Must not be @NULL.
7c913512 63 @param id
4cc4bfaf 64 Window identifier. The value wxID_ANY indicates a default value.
7c913512 65 @param value
4cc4bfaf 66 Initial position for the slider.
7c913512 67 @param minValue
4cc4bfaf 68 Minimum slider position.
7c913512 69 @param maxValue
4cc4bfaf 70 Maximum slider position.
7c913512 71 @param size
4cc4bfaf
FM
72 Window size. If wxDefaultSize is specified then a default size
73 is chosen.
7c913512 74 @param style
4cc4bfaf 75 Window style. See wxSlider.
7c913512 76 @param validator
4cc4bfaf 77 Window validator.
7c913512 78 @param name
4cc4bfaf 79 Window name.
3c4f71cc 80
4cc4bfaf 81 @see Create(), wxValidator
23324ae1 82 */
7c913512
FM
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");
23324ae1
FM
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.
3c4f71cc 98
23324ae1
FM
99 @remarks Windows 95 only.
100 */
101 void ClearSel();
102
103 /**
104 Clears the ticks.
3c4f71cc 105
23324ae1
FM
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.
3c4f71cc 124
4cc4bfaf 125 @see SetLineSize()
23324ae1 126 */
328f5751 127 int GetLineSize() const;
23324ae1
FM
128
129 /**
130 Gets the maximum slider value.
3c4f71cc 131
4cc4bfaf 132 @see GetMin(), SetRange()
23324ae1 133 */
328f5751 134 int GetMax() const;
23324ae1
FM
135
136 /**
137 Gets the minimum slider value.
3c4f71cc 138
4cc4bfaf 139 @see GetMin(), SetRange()
23324ae1 140 */
328f5751 141 int GetMin() const;
23324ae1
FM
142
143 /**
144 Returns the page size.
3c4f71cc 145
4cc4bfaf 146 @see SetPageSize()
23324ae1 147 */
328f5751 148 int GetPageSize() const;
23324ae1
FM
149
150 /**
151 Returns the selection end point.
3c4f71cc 152
23324ae1 153 @remarks Windows 95 only.
3c4f71cc 154
4cc4bfaf 155 @see GetSelStart(), SetSelection()
23324ae1 156 */
328f5751 157 int GetSelEnd() const;
23324ae1
FM
158
159 /**
160 Returns the selection start point.
3c4f71cc 161
23324ae1 162 @remarks Windows 95 only.
3c4f71cc 163
4cc4bfaf 164 @see GetSelEnd(), SetSelection()
23324ae1 165 */
328f5751 166 int GetSelStart() const;
23324ae1
FM
167
168 /**
169 Returns the thumb length.
3c4f71cc 170
23324ae1 171 @remarks Windows 95 only.
3c4f71cc 172
4cc4bfaf 173 @see SetThumbLength()
23324ae1 174 */
328f5751 175 int GetThumbLength() const;
23324ae1
FM
176
177 /**
178 Returns the tick frequency.
3c4f71cc 179
23324ae1 180 @remarks Windows 95 only.
3c4f71cc 181
4cc4bfaf 182 @see SetTickFreq()
23324ae1 183 */
328f5751 184 int GetTickFreq() const;
23324ae1
FM
185
186 /**
187 Gets the current slider value.
3c4f71cc 188
4cc4bfaf 189 @see GetMin(), GetMax(), SetValue()
23324ae1 190 */
328f5751 191 int GetValue() const;
23324ae1
FM
192
193 /**
194 Sets the line size for the slider.
3c4f71cc 195
7c913512 196 @param lineSize
4cc4bfaf
FM
197 The number of steps the slider moves when the user moves it up or down a
198 line.
3c4f71cc 199
4cc4bfaf 200 @see GetLineSize()
23324ae1
FM
201 */
202 void SetLineSize(int lineSize);
203
204 /**
205 Sets the page size for the slider.
3c4f71cc 206
7c913512 207 @param pageSize
4cc4bfaf 208 The number of steps the slider moves when the user pages up or down.
3c4f71cc 209
4cc4bfaf 210 @see GetPageSize()
23324ae1
FM
211 */
212 void SetPageSize(int pageSize);
213
214 /**
215 Sets the minimum and maximum slider values.
3c4f71cc 216
4cc4bfaf 217 @see GetMin(), GetMax()
23324ae1
FM
218 */
219 void SetRange(int minValue, int maxValue);
220
221 /**
222 Sets the selection.
3c4f71cc 223
7c913512 224 @param startPos
4cc4bfaf 225 The selection start position.
7c913512 226 @param endPos
4cc4bfaf 227 The selection end position.
3c4f71cc 228
23324ae1 229 @remarks Windows 95 only.
3c4f71cc 230
4cc4bfaf 231 @see GetSelStart(), GetSelEnd()
23324ae1
FM
232 */
233 void SetSelection(int startPos, int endPos);
234
235 /**
236 Sets the slider thumb length.
3c4f71cc 237
7c913512 238 @param len
4cc4bfaf 239 The thumb length.
3c4f71cc 240
23324ae1 241 @remarks Windows 95 only.
3c4f71cc 242
4cc4bfaf 243 @see GetThumbLength()
23324ae1
FM
244 */
245 void SetThumbLength(int len);
246
247 /**
248 Sets a tick position.
3c4f71cc 249
7c913512 250 @param tickPos
4cc4bfaf 251 The tick position.
3c4f71cc 252
23324ae1 253 @remarks Windows 95 only.
3c4f71cc 254
4cc4bfaf 255 @see SetTickFreq()
23324ae1
FM
256 */
257 void SetTick(int tickPos);
258
259 /**
260 Sets the tick mark frequency and position.
3c4f71cc 261
7c913512 262 @param n
4cc4bfaf 263 Frequency. For example, if the frequency is set to two, a tick mark is
23324ae1 264 displayed for
4cc4bfaf 265 every other increment in the slider's range.
7c913512 266 @param pos
4cc4bfaf 267 Position. Must be greater than zero. TODO: what is this for?
3c4f71cc 268
23324ae1 269 @remarks Windows 95 only.
3c4f71cc 270
4cc4bfaf 271 @see GetTickFreq()
23324ae1
FM
272 */
273 void SetTickFreq(int n, int pos);
274
275 /**
276 Sets the slider position.
3c4f71cc 277
7c913512 278 @param value
4cc4bfaf 279 The slider position.
23324ae1
FM
280 */
281 void SetValue(int value);
282};
e54c96f1 283