]> git.saurik.com Git - wxWidgets.git/blame - samples/widgets/slider.cpp
added wxDynamicLibrary::GetSymbolAorW()
[wxWidgets.git] / samples / widgets / slider.cpp
CommitLineData
32b8ec41 1/////////////////////////////////////////////////////////////////////////////
be5a51fb 2// Program: wxWidgets Widgets Sample
32b8ec41
VZ
3// Name: slider.cpp
4// Purpose: Part of the widgets sample showing wxSlider
5// Author: Vadim Zeitlin
6// Created: 16.04.01
7// Id: $Id$
8// Copyright: (c) 2001 Vadim Zeitlin
9// License: wxWindows license
10/////////////////////////////////////////////////////////////////////////////
11
12// ============================================================================
13// declarations
14// ============================================================================
15
16// ----------------------------------------------------------------------------
17// headers
18// ----------------------------------------------------------------------------
19
20// for compilers that support precompilation, includes "wx/wx.h".
21#include "wx/wxprec.h"
22
23#ifdef __BORLANDC__
24 #pragma hdrstop
25#endif
26
61c083e7
WS
27#if wxUSE_SLIDER
28
32b8ec41
VZ
29// for all others, include the necessary headers
30#ifndef WX_PRECOMP
31 #include "wx/log.h"
32
3bb70c40 33 #include "wx/bitmap.h"
32b8ec41
VZ
34 #include "wx/button.h"
35 #include "wx/checkbox.h"
36 #include "wx/radiobox.h"
37 #include "wx/slider.h"
38 #include "wx/statbox.h"
39 #include "wx/textctrl.h"
40#endif
41
53b98211
JS
42#if wxUSE_TOOLTIPS
43 #include "wx/tooltip.h"
44#endif
45
32b8ec41
VZ
46#include "wx/sizer.h"
47
48#include "widgets.h"
61c083e7 49
32b8ec41
VZ
50#include "icons/slider.xpm"
51
52// ----------------------------------------------------------------------------
53// constants
54// ----------------------------------------------------------------------------
55
56// control ids
57enum
58{
d79b005a 59 SliderPage_Reset = wxID_HIGHEST,
32b8ec41
VZ
60 SliderPage_Clear,
61 SliderPage_SetValue,
62 SliderPage_SetMinAndMax,
63 SliderPage_SetTickFreq,
53b98211 64 SliderPage_SetThumbLen,
32b8ec41
VZ
65 SliderPage_CurValueText,
66 SliderPage_ValueText,
67 SliderPage_MinText,
68 SliderPage_MaxText,
69 SliderPage_TickFreqText,
53b98211
JS
70 SliderPage_ThumbLenText,
71 SliderPage_RadioSides,
72 SliderPage_BothSides,
32b8ec41
VZ
73 SliderPage_Slider
74};
75
53b98211
JS
76// sides radiobox values
77enum
78{
93103bab
VZ
79 SliderTicks_Top,
80 SliderTicks_Bottom,
81 SliderTicks_Left,
82 SliderTicks_Right
53b98211
JS
83};
84
32b8ec41
VZ
85// ----------------------------------------------------------------------------
86// SliderWidgetsPage
87// ----------------------------------------------------------------------------
88
89class SliderWidgetsPage : public WidgetsPage
90{
91public:
61c083e7 92 SliderWidgetsPage(wxBookCtrl *book, wxImageList *imaglist);
8f6eaec9 93 virtual ~SliderWidgetsPage(){};
32b8ec41 94
195df7a7
VZ
95 virtual wxControl *GetWidget() const { return m_slider; }
96
32b8ec41
VZ
97protected:
98 // event handlers
99 void OnButtonReset(wxCommandEvent& event);
100 void OnButtonClear(wxCommandEvent& event);
101 void OnButtonSetValue(wxCommandEvent& event);
102 void OnButtonSetMinAndMax(wxCommandEvent& event);
103 void OnButtonSetTickFreq(wxCommandEvent& event);
53b98211 104 void OnButtonSetThumbLen(wxCommandEvent& event);
32b8ec41
VZ
105
106 void OnCheckOrRadioBox(wxCommandEvent& event);
107
d79b005a 108 void OnSlider(wxScrollEvent& event);
32b8ec41 109
32b8ec41
VZ
110 void OnUpdateUIValueButton(wxUpdateUIEvent& event);
111 void OnUpdateUIMinMaxButton(wxUpdateUIEvent& event);
112 void OnUpdateUITickFreq(wxUpdateUIEvent& event);
53b98211
JS
113 void OnUpdateUIThumbLen(wxUpdateUIEvent& event);
114 void OnUpdateUIRadioSides(wxUpdateUIEvent& event);
115 void OnUpdateUIBothSides(wxUpdateUIEvent& event);
32b8ec41
VZ
116
117 void OnUpdateUIResetButton(wxUpdateUIEvent& event);
118
119 void OnUpdateUICurValueText(wxUpdateUIEvent& event);
120
121 // reset the slider parameters
122 void Reset();
123
124 // (re)create the slider
125 void CreateSlider();
126
127 // set the tick frequency from the text field value
128 void DoSetTickFreq();
129
53b98211
JS
130 // set the thumb len from the text field value
131 void DoSetThumbLen();
132
32b8ec41
VZ
133 // is this slider value in range?
134 bool IsValidValue(int val) const
135 { return (val >= m_min) && (val <= m_max); }
136
137 // the slider range
138 int m_min, m_max;
139
140 // the controls
141 // ------------
142
143 // the check/radio boxes for styles
144 wxCheckBox *m_chkLabels,
2bcdbe0f 145 *m_chkInverse,
53b98211
JS
146 *m_chkTicks,
147 *m_chkBothSides;
148
149 wxRadioBox *m_radioSides;
32b8ec41
VZ
150
151 // the slider itself and the sizer it is in
152 wxSlider *m_slider;
153 wxSizer *m_sizerSlider;
154
155 // the text entries for set value/range
156 wxTextCtrl *m_textValue,
157 *m_textMin,
158 *m_textMax,
53b98211
JS
159 *m_textTickFreq,
160 *m_textThumbLen;
32b8ec41
VZ
161
162private:
5e173f35
GD
163 DECLARE_EVENT_TABLE()
164 DECLARE_WIDGETS_PAGE(SliderWidgetsPage)
32b8ec41
VZ
165};
166
167// ----------------------------------------------------------------------------
168// event tables
169// ----------------------------------------------------------------------------
170
171BEGIN_EVENT_TABLE(SliderWidgetsPage, WidgetsPage)
172 EVT_BUTTON(SliderPage_Reset, SliderWidgetsPage::OnButtonReset)
173 EVT_BUTTON(SliderPage_SetValue, SliderWidgetsPage::OnButtonSetValue)
174 EVT_BUTTON(SliderPage_SetMinAndMax, SliderWidgetsPage::OnButtonSetMinAndMax)
175 EVT_BUTTON(SliderPage_SetTickFreq, SliderWidgetsPage::OnButtonSetTickFreq)
53b98211 176 EVT_BUTTON(SliderPage_SetThumbLen, SliderWidgetsPage::OnButtonSetThumbLen)
32b8ec41
VZ
177
178 EVT_UPDATE_UI(SliderPage_SetValue, SliderWidgetsPage::OnUpdateUIValueButton)
179 EVT_UPDATE_UI(SliderPage_SetMinAndMax, SliderWidgetsPage::OnUpdateUIMinMaxButton)
180 EVT_UPDATE_UI(SliderPage_SetTickFreq, SliderWidgetsPage::OnUpdateUITickFreq)
53b98211 181 EVT_UPDATE_UI(SliderPage_SetThumbLen, SliderWidgetsPage::OnUpdateUIThumbLen)
32b8ec41 182 EVT_UPDATE_UI(SliderPage_TickFreqText, SliderWidgetsPage::OnUpdateUITickFreq)
53b98211
JS
183 EVT_UPDATE_UI(SliderPage_RadioSides, SliderWidgetsPage::OnUpdateUIRadioSides)
184 EVT_UPDATE_UI(SliderPage_BothSides, SliderWidgetsPage::OnUpdateUIBothSides)
32b8ec41
VZ
185
186 EVT_UPDATE_UI(SliderPage_Reset, SliderWidgetsPage::OnUpdateUIResetButton)
187
188 EVT_UPDATE_UI(SliderPage_CurValueText, SliderWidgetsPage::OnUpdateUICurValueText)
189
d79b005a 190 EVT_COMMAND_SCROLL(SliderPage_Slider, SliderWidgetsPage::OnSlider)
32b8ec41 191
206d3a16
JS
192 EVT_CHECKBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox)
193 EVT_RADIOBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox)
32b8ec41
VZ
194END_EVENT_TABLE()
195
196// ============================================================================
197// implementation
198// ============================================================================
199
200IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, _T("Slider"));
201
61c083e7
WS
202SliderWidgetsPage::SliderWidgetsPage(wxBookCtrl *book,
203 wxImageList *imaglist)
204 : WidgetsPage(book)
32b8ec41
VZ
205{
206 imaglist->Add(wxBitmap(slider_xpm));
207
208 // init everything
209 m_min = 0;
210 m_max = 100;
211
dc3155f1 212 m_chkInverse =
32b8ec41
VZ
213 m_chkTicks =
214 m_chkLabels =
53b98211
JS
215 m_chkBothSides = (wxCheckBox *)NULL;
216
217 m_radioSides = (wxRadioBox *)NULL;
32b8ec41
VZ
218
219 m_slider = (wxSlider *)NULL;
220 m_sizerSlider = (wxSizer *)NULL;
221
222 wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
223
224 // left pane
206d3a16 225 wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style"));
32b8ec41
VZ
226 wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
227
2bcdbe0f 228 m_chkInverse = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Inverse"));
32b8ec41
VZ
229 m_chkTicks = CreateCheckBoxAndAddToSizer(sizerLeft, _T("Show &ticks"));
230 m_chkLabels = CreateCheckBoxAndAddToSizer(sizerLeft, _T("Show &labels"));
53b98211
JS
231 static const wxString sides[] =
232 {
233 _T("top"),
234 _T("bottom"),
235 _T("left"),
236 _T("right"),
237 };
238 m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, _T("&Ticks/Labels"),
239 wxDefaultPosition, wxDefaultSize,
240 WXSIZEOF(sides), sides,
241 1, wxRA_SPECIFY_COLS);
242 sizerLeft->Add(m_radioSides, 0, wxGROW | wxALL, 5);
243 m_chkBothSides = CreateCheckBoxAndAddToSizer
244 (sizerLeft, _T("&Both sides"), SliderPage_BothSides);
245#if wxUSE_TOOLTIPS
246 m_chkBothSides->SetToolTip( _T("\"Both sides\" is only supported \nin Win95 and Universal") );
247#endif // wxUSE_TOOLTIPS
32b8ec41
VZ
248
249 sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
250
251 wxButton *btn = new wxButton(this, SliderPage_Reset, _T("&Reset"));
252 sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
253
254 // middle pane
206d3a16 255 wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Change slider value"));
32b8ec41
VZ
256 wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
257
258 wxTextCtrl *text;
259 wxSizer *sizerRow = CreateSizerWithTextAndLabel(_T("Current value"),
260 SliderPage_CurValueText,
261 &text);
206d3a16 262 text->SetEditable(false);
32b8ec41
VZ
263
264 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
265
266 sizerRow = CreateSizerWithTextAndButton(SliderPage_SetValue,
267 _T("Set &value"),
268 SliderPage_ValueText,
269 &m_textValue);
270 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
271
272 sizerRow = CreateSizerWithTextAndButton(SliderPage_SetMinAndMax,
273 _T("&Min and max"),
274 SliderPage_MinText,
275 &m_textMin);
276
206d3a16 277 m_textMax = new wxTextCtrl(this, SliderPage_MaxText, wxEmptyString);
32b8ec41
VZ
278 sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
279
aec18ff7
MB
280 m_textMin->SetValue( wxString::Format(_T("%d"), m_min) );
281 m_textMax->SetValue( wxString::Format(_T("%d"), m_max) );
32b8ec41
VZ
282
283 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
284
285 sizerRow = CreateSizerWithTextAndButton(SliderPage_SetTickFreq,
286 _T("Tick &frequency"),
287 SliderPage_TickFreqText,
288 &m_textTickFreq);
289
290 m_textTickFreq->SetValue(_T("10"));
291
292 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
293
53b98211 294 sizerRow = CreateSizerWithTextAndButton(SliderPage_SetThumbLen,
a0d9c6cb 295 _T("Thumb &length"),
53b98211
JS
296 SliderPage_ThumbLenText,
297 &m_textThumbLen);
298
299 sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
300
32b8ec41
VZ
301 // right pane
302 wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
53b98211 303 sizerRight->SetMinSize(150, 40);
32b8ec41
VZ
304 m_sizerSlider = sizerRight; // save it to modify it later
305
306 Reset();
307 CreateSlider();
308
309 // the 3 panes panes compose the window
310 sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
7b127900 311 sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
32b8ec41
VZ
312 sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
313
314 // final initializations
32b8ec41
VZ
315 SetSizer(sizerTop);
316
317 sizerTop->Fit(this);
318}
319
32b8ec41
VZ
320// ----------------------------------------------------------------------------
321// operations
322// ----------------------------------------------------------------------------
323
324void SliderWidgetsPage::Reset()
325{
2bcdbe0f 326 m_chkInverse->SetValue(false);
206d3a16
JS
327 m_chkTicks->SetValue(true);
328 m_chkLabels->SetValue(true);
329 m_chkBothSides->SetValue(false);
53b98211 330
93103bab 331 m_radioSides->SetSelection(SliderTicks_Top);
32b8ec41
VZ
332}
333
334void SliderWidgetsPage::CreateSlider()
335{
336 int flags = 0;
337
2bcdbe0f
KH
338 if ( m_chkInverse->GetValue() )
339 {
340 flags |= wxSL_INVERSE;
341 }
342
32b8ec41
VZ
343 if ( m_chkLabels->GetValue() )
344 {
345 flags |= wxSL_LABELS;
32b8ec41
VZ
346 }
347
348 if ( m_chkTicks->GetValue() )
349 {
350 flags |= wxSL_AUTOTICKS;
351 }
352
53b98211
JS
353 switch ( m_radioSides->GetSelection() )
354 {
93103bab 355 case SliderTicks_Top:
53b98211
JS
356 flags |= wxSL_TOP;
357 break;
93103bab
VZ
358
359 case SliderTicks_Left:
53b98211
JS
360 flags |= wxSL_LEFT;
361 break;
93103bab
VZ
362
363 case SliderTicks_Bottom:
53b98211
JS
364 flags |= wxSL_BOTTOM;
365 break;
93103bab
VZ
366
367 case SliderTicks_Right:
53b98211
JS
368 flags |= wxSL_RIGHT;
369 break;
93103bab 370
53b98211
JS
371 default:
372 wxFAIL_MSG(_T("unexpected radiobox selection"));
373 // fall through
374 }
375
376 if ( m_chkBothSides->GetValue() )
377 {
378 flags |= wxSL_BOTH;
379 }
380
32b8ec41
VZ
381 int val = m_min;
382 if ( m_slider )
383 {
384 int valOld = m_slider->GetValue();
385 if ( !IsValidValue(valOld) )
386 {
387 val = valOld;
388 }
389
12a3f227 390 m_sizerSlider->Detach( m_slider );
32b8ec41
VZ
391
392 if ( m_sizerSlider->GetChildren().GetCount() )
393 {
394 // we have 2 spacers, remove them too
9dd96c0f
VZ
395 m_sizerSlider->Remove( 0 );
396 m_sizerSlider->Remove( 0 );
32b8ec41
VZ
397 }
398
399 delete m_slider;
400 }
401
402 m_slider = new wxSlider(this, SliderPage_Slider,
403 val, m_min, m_max,
404 wxDefaultPosition, wxDefaultSize,
405 flags);
406
93103bab 407 if ( m_slider->HasFlag(wxSL_VERTICAL) )
32b8ec41
VZ
408 {
409 m_sizerSlider->Add(0, 0, 1);
410 m_sizerSlider->Add(m_slider, 0, wxGROW | wxALL, 5);
411 m_sizerSlider->Add(0, 0, 1);
412 }
413 else
414 {
415 m_sizerSlider->Add(m_slider, 1, wxCENTRE | wxALL, 5);
416 }
417
418 if ( m_chkTicks->GetValue() )
419 {
420 DoSetTickFreq();
421 }
422
423 m_sizerSlider->Layout();
424}
425
426void SliderWidgetsPage::DoSetTickFreq()
427{
428 long freq;
429 if ( !m_textTickFreq->GetValue().ToLong(&freq) )
430 {
431 wxLogWarning(_T("Invalid slider tick frequency"));
432
433 return;
434 }
435
436 m_slider->SetTickFreq(freq, 0 /* unused */);
437}
438
53b98211
JS
439void SliderWidgetsPage::DoSetThumbLen()
440{
441 long len;
442 if ( !m_textThumbLen->GetValue().ToLong(&len) )
443 {
a0d9c6cb 444 wxLogWarning(_T("Invalid slider thumb length"));
53b98211
JS
445
446 return;
447 }
448
449 m_slider->SetThumbLength(len);
450}
451
32b8ec41
VZ
452// ----------------------------------------------------------------------------
453// event handlers
454// ----------------------------------------------------------------------------
455
456void SliderWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
457{
458 Reset();
459
460 CreateSlider();
461}
462
463void SliderWidgetsPage::OnButtonSetTickFreq(wxCommandEvent& WXUNUSED(event))
464{
465 DoSetTickFreq();
466}
467
53b98211
JS
468void SliderWidgetsPage::OnButtonSetThumbLen(wxCommandEvent& WXUNUSED(event))
469{
470 DoSetThumbLen();
471}
472
32b8ec41
VZ
473void SliderWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event))
474{
475 long minNew,
476 maxNew = 0; // init to suppress compiler warning
477 if ( !m_textMin->GetValue().ToLong(&minNew) ||
478 !m_textMax->GetValue().ToLong(&maxNew) ||
479 minNew >= maxNew )
480 {
481 wxLogWarning(_T("Invalid min/max values for the slider."));
482
483 return;
484 }
485
486 m_min = minNew;
487 m_max = maxNew;
488
489 m_slider->SetRange(minNew, maxNew);
9690a439
WS
490
491 if ( m_slider->GetMin() != m_min ||
492 m_slider->GetMax() != m_max )
493 {
494 wxLogWarning(_T("Invalid range in slider."));
495 }
32b8ec41
VZ
496}
497
498void SliderWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
499{
500 long val;
501 if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) )
502 {
503 wxLogWarning(_T("Invalid slider value."));
504
505 return;
506 }
507
508 m_slider->SetValue(val);
509}
510
511void SliderWidgetsPage::OnUpdateUIValueButton(wxUpdateUIEvent& event)
512{
513 long val;
514 event.Enable( m_textValue->GetValue().ToLong(&val) && IsValidValue(val) );
515}
516
517void SliderWidgetsPage::OnUpdateUITickFreq(wxUpdateUIEvent& event)
518{
519 long freq;
520 event.Enable( m_chkTicks->GetValue() &&
521 m_textTickFreq->GetValue().ToLong(&freq) &&
522 (freq > 0) && (freq <= m_max - m_min) );
523}
524
53b98211
JS
525void SliderWidgetsPage::OnUpdateUIThumbLen(wxUpdateUIEvent& event)
526{
527 long val;
528 event.Enable( m_textThumbLen->GetValue().ToLong(&val));
529}
530
32b8ec41
VZ
531void SliderWidgetsPage::OnUpdateUIMinMaxButton(wxUpdateUIEvent& event)
532{
533 long mn, mx;
534 event.Enable( m_textMin->GetValue().ToLong(&mn) &&
535 m_textMax->GetValue().ToLong(&mx) &&
536 mn < mx);
537}
538
539void SliderWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
540{
93103bab 541 event.Enable( m_chkInverse->GetValue() ||
53b98211 542 !m_chkTicks->GetValue() ||
32b8ec41 543 !m_chkLabels->GetValue() ||
93103bab
VZ
544 m_chkBothSides->GetValue() ||
545 m_radioSides->GetSelection() != SliderTicks_Top );
32b8ec41
VZ
546}
547
c02e5a31 548void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
32b8ec41
VZ
549{
550 CreateSlider();
551}
552
553void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
554{
aec18ff7 555 event.SetText( wxString::Format(_T("%d"), m_slider->GetValue()) );
32b8ec41
VZ
556}
557
53b98211
JS
558void SliderWidgetsPage::OnUpdateUIRadioSides(wxUpdateUIEvent& event)
559{
560 event.Enable( m_chkLabels->GetValue() || m_chkTicks->GetValue() );
561}
562
563void SliderWidgetsPage::OnUpdateUIBothSides(wxUpdateUIEvent& event)
32b8ec41 564{
53b98211
JS
565#if defined(__WIN95__) || defined(__WXUNIVERSAL__)
566 event.Enable( m_chkTicks->GetValue() );
567#else
206d3a16 568 event.Enable( false );
53b98211 569#endif // defined(__WIN95__) || defined(__WXUNIVERSAL__)
32b8ec41
VZ
570}
571
d79b005a 572void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
32b8ec41 573{
2b5f62a0
VZ
574 wxASSERT_MSG( event.GetInt() == m_slider->GetValue(),
575 wxT("slider value should be the same") );
32b8ec41 576
d79b005a
VZ
577 wxEventType eventType = event.GetEventType();
578
579 /*
580 This array takes the EXACT order of the declarations in
581 include/wx/event.h
582 (section "wxScrollBar and wxSlider event identifiers")
583 */
584 static const wxChar *eventNames[] =
585 {
586 wxT("wxEVT_SCROLL_TOP"),
587 wxT("wxEVT_SCROLL_BOTTOM"),
588 wxT("wxEVT_SCROLL_LINEUP"),
589 wxT("wxEVT_SCROLL_LINEDOWN"),
590 wxT("wxEVT_SCROLL_PAGEUP"),
591 wxT("wxEVT_SCROLL_PAGEDOWN"),
592 wxT("wxEVT_SCROLL_THUMBTRACK"),
593 wxT("wxEVT_SCROLL_THUMBRELEASE"),
cbc85508 594 wxT("wxEVT_SCROLL_CHANGED")
d79b005a
VZ
595 };
596
597 int index = eventType - wxEVT_SCROLL_TOP;
598
599 /*
600 If this assert is triggered, there is an unknown slider event which
601 should be added to the above eventNames array.
602 */
8b1d8f36 603 wxASSERT_MSG(index >= 0 && (size_t)index < WXSIZEOF(eventNames),
d79b005a
VZ
604 wxT("Unknown slider event") );
605
606
607 static int s_numSliderEvents = 0;
608
dc3155f1 609 wxLogMessage(wxT("Slider event #%d: %s (pos = %d, int value = %ld)"),
580d78b3 610 s_numSliderEvents++,
d79b005a 611 eventNames[index],
2bcdbe0f
KH
612 event.GetPosition(),
613 event.GetInt());
32b8ec41
VZ
614}
615
61c083e7 616#endif // wxUSE_SLIDER