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