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