2001-06-26 17:05:06 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2004-05-25 07:20:37 -04:00
|
|
|
// Program: wxWidgets Widgets Sample
|
2001-06-26 17:05:06 -04:00
|
|
|
// Name: slider.cpp
|
|
|
|
// Purpose: Part of the widgets sample showing wxSlider
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Created: 16.04.01
|
|
|
|
// Copyright: (c) 2001 Vadim Zeitlin
|
2010-07-13 09:29:13 -04:00
|
|
|
// Licence: wxWindows licence
|
2001-06-26 17:05:06 -04:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// declarations
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// headers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// for compilers that support precompilation, includes "wx/wx.h".
|
|
|
|
#include "wx/wxprec.h"
|
|
|
|
|
|
|
|
#ifdef __BORLANDC__
|
|
|
|
#pragma hdrstop
|
|
|
|
#endif
|
|
|
|
|
2004-11-23 06:45:07 -05:00
|
|
|
#if wxUSE_SLIDER
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// for all others, include the necessary headers
|
|
|
|
#ifndef WX_PRECOMP
|
|
|
|
#include "wx/log.h"
|
|
|
|
|
2003-03-23 10:12:41 -05:00
|
|
|
#include "wx/bitmap.h"
|
2001-06-26 17:05:06 -04:00
|
|
|
#include "wx/button.h"
|
|
|
|
#include "wx/checkbox.h"
|
|
|
|
#include "wx/radiobox.h"
|
|
|
|
#include "wx/slider.h"
|
|
|
|
#include "wx/statbox.h"
|
|
|
|
#include "wx/textctrl.h"
|
|
|
|
#endif
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
#if wxUSE_TOOLTIPS
|
|
|
|
#include "wx/tooltip.h"
|
|
|
|
#endif
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
#include "wx/sizer.h"
|
|
|
|
|
|
|
|
#include "widgets.h"
|
2004-11-23 06:45:07 -05:00
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
#include "icons/slider.xpm"
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// constants
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// control ids
|
|
|
|
enum
|
|
|
|
{
|
2002-07-09 19:33:46 -04:00
|
|
|
SliderPage_Reset = wxID_HIGHEST,
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_Clear,
|
|
|
|
SliderPage_SetValue,
|
|
|
|
SliderPage_SetMinAndMax,
|
2006-07-27 01:05:21 -04:00
|
|
|
SliderPage_SetLineSize,
|
|
|
|
SliderPage_SetPageSize,
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_SetTickFreq,
|
2003-01-24 06:55:29 -05:00
|
|
|
SliderPage_SetThumbLen,
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_CurValueText,
|
|
|
|
SliderPage_ValueText,
|
|
|
|
SliderPage_MinText,
|
|
|
|
SliderPage_MaxText,
|
2006-07-27 01:05:21 -04:00
|
|
|
SliderPage_LineSizeText,
|
|
|
|
SliderPage_PageSizeText,
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_TickFreqText,
|
2003-01-24 06:55:29 -05:00
|
|
|
SliderPage_ThumbLenText,
|
|
|
|
SliderPage_RadioSides,
|
|
|
|
SliderPage_BothSides,
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_Slider
|
|
|
|
};
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
// sides radiobox values
|
|
|
|
enum
|
|
|
|
{
|
2009-11-14 18:15:27 -05:00
|
|
|
SliderTicks_None,
|
2005-04-10 14:07:08 -04:00
|
|
|
SliderTicks_Top,
|
|
|
|
SliderTicks_Bottom,
|
|
|
|
SliderTicks_Left,
|
|
|
|
SliderTicks_Right
|
2003-01-24 06:55:29 -05:00
|
|
|
};
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// SliderWidgetsPage
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
class SliderWidgetsPage : public WidgetsPage
|
|
|
|
{
|
|
|
|
public:
|
2006-05-17 15:49:09 -04:00
|
|
|
SliderWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
|
2004-10-04 16:25:15 -04:00
|
|
|
virtual ~SliderWidgetsPage(){};
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2004-11-19 14:03:04 -05:00
|
|
|
virtual wxControl *GetWidget() const { return m_slider; }
|
2006-04-16 19:39:11 -04:00
|
|
|
virtual void RecreateWidget() { CreateSlider(); }
|
2004-11-19 14:03:04 -05:00
|
|
|
|
2006-06-06 10:10:06 -04:00
|
|
|
// lazy creation of the content
|
|
|
|
virtual void CreateContent();
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
protected:
|
|
|
|
// event handlers
|
|
|
|
void OnButtonReset(wxCommandEvent& event);
|
|
|
|
void OnButtonClear(wxCommandEvent& event);
|
|
|
|
void OnButtonSetValue(wxCommandEvent& event);
|
|
|
|
void OnButtonSetMinAndMax(wxCommandEvent& event);
|
2006-07-27 01:05:21 -04:00
|
|
|
void OnButtonSetLineSize(wxCommandEvent& event);
|
|
|
|
void OnButtonSetPageSize(wxCommandEvent& event);
|
2001-06-26 17:05:06 -04:00
|
|
|
void OnButtonSetTickFreq(wxCommandEvent& event);
|
2003-01-24 06:55:29 -05:00
|
|
|
void OnButtonSetThumbLen(wxCommandEvent& event);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
void OnCheckOrRadioBox(wxCommandEvent& event);
|
|
|
|
|
2002-07-09 19:33:46 -04:00
|
|
|
void OnSlider(wxScrollEvent& event);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
void OnUpdateUIValueButton(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUIMinMaxButton(wxUpdateUIEvent& event);
|
2006-07-27 01:05:21 -04:00
|
|
|
void OnUpdateUILineSize(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUIPageSize(wxUpdateUIEvent& event);
|
2001-06-26 17:05:06 -04:00
|
|
|
void OnUpdateUITickFreq(wxUpdateUIEvent& event);
|
2003-01-24 06:55:29 -05:00
|
|
|
void OnUpdateUIThumbLen(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUIRadioSides(wxUpdateUIEvent& event);
|
|
|
|
void OnUpdateUIBothSides(wxUpdateUIEvent& event);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
void OnUpdateUICurValueText(wxUpdateUIEvent& event);
|
|
|
|
|
|
|
|
// reset the slider parameters
|
|
|
|
void Reset();
|
|
|
|
|
|
|
|
// (re)create the slider
|
|
|
|
void CreateSlider();
|
|
|
|
|
2006-07-27 01:05:21 -04:00
|
|
|
// set the line size from the text field value
|
|
|
|
void DoSetLineSize();
|
|
|
|
|
|
|
|
// set the page size from the text field value
|
|
|
|
void DoSetPageSize();
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// set the tick frequency from the text field value
|
|
|
|
void DoSetTickFreq();
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
// set the thumb len from the text field value
|
|
|
|
void DoSetThumbLen();
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// is this slider value in range?
|
|
|
|
bool IsValidValue(int val) const
|
|
|
|
{ return (val >= m_min) && (val <= m_max); }
|
|
|
|
|
|
|
|
// the slider range
|
|
|
|
int m_min, m_max;
|
|
|
|
|
|
|
|
// the controls
|
|
|
|
// ------------
|
|
|
|
|
|
|
|
// the check/radio boxes for styles
|
2009-11-14 11:31:06 -05:00
|
|
|
wxCheckBox *m_chkMinMaxLabels,
|
|
|
|
*m_chkValueLabel,
|
2005-01-23 15:17:21 -05:00
|
|
|
*m_chkInverse,
|
2003-01-24 06:55:29 -05:00
|
|
|
*m_chkTicks,
|
|
|
|
*m_chkBothSides;
|
|
|
|
|
|
|
|
wxRadioBox *m_radioSides;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
// the slider itself and the sizer it is in
|
|
|
|
wxSlider *m_slider;
|
|
|
|
wxSizer *m_sizerSlider;
|
|
|
|
|
|
|
|
// the text entries for set value/range
|
|
|
|
wxTextCtrl *m_textValue,
|
|
|
|
*m_textMin,
|
|
|
|
*m_textMax,
|
2006-07-27 01:05:21 -04:00
|
|
|
*m_textLineSize,
|
|
|
|
*m_textPageSize,
|
2003-01-24 06:55:29 -05:00
|
|
|
*m_textTickFreq,
|
|
|
|
*m_textThumbLen;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
private:
|
2001-11-25 10:18:38 -05:00
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
DECLARE_WIDGETS_PAGE(SliderWidgetsPage)
|
2001-06-26 17:05:06 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event tables
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(SliderWidgetsPage, WidgetsPage)
|
|
|
|
EVT_BUTTON(SliderPage_Reset, SliderWidgetsPage::OnButtonReset)
|
|
|
|
EVT_BUTTON(SliderPage_SetValue, SliderWidgetsPage::OnButtonSetValue)
|
|
|
|
EVT_BUTTON(SliderPage_SetMinAndMax, SliderWidgetsPage::OnButtonSetMinAndMax)
|
2006-07-27 01:05:21 -04:00
|
|
|
EVT_BUTTON(SliderPage_SetLineSize, SliderWidgetsPage::OnButtonSetLineSize)
|
|
|
|
EVT_BUTTON(SliderPage_SetPageSize, SliderWidgetsPage::OnButtonSetPageSize)
|
2001-06-26 17:05:06 -04:00
|
|
|
EVT_BUTTON(SliderPage_SetTickFreq, SliderWidgetsPage::OnButtonSetTickFreq)
|
2003-01-24 06:55:29 -05:00
|
|
|
EVT_BUTTON(SliderPage_SetThumbLen, SliderWidgetsPage::OnButtonSetThumbLen)
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
EVT_UPDATE_UI(SliderPage_SetValue, SliderWidgetsPage::OnUpdateUIValueButton)
|
|
|
|
EVT_UPDATE_UI(SliderPage_SetMinAndMax, SliderWidgetsPage::OnUpdateUIMinMaxButton)
|
2006-07-27 01:05:21 -04:00
|
|
|
EVT_UPDATE_UI(SliderPage_SetLineSize, SliderWidgetsPage::OnUpdateUILineSize)
|
|
|
|
EVT_UPDATE_UI(SliderPage_SetPageSize, SliderWidgetsPage::OnUpdateUIPageSize)
|
2001-06-26 17:05:06 -04:00
|
|
|
EVT_UPDATE_UI(SliderPage_SetTickFreq, SliderWidgetsPage::OnUpdateUITickFreq)
|
2003-01-24 06:55:29 -05:00
|
|
|
EVT_UPDATE_UI(SliderPage_SetThumbLen, SliderWidgetsPage::OnUpdateUIThumbLen)
|
|
|
|
EVT_UPDATE_UI(SliderPage_RadioSides, SliderWidgetsPage::OnUpdateUIRadioSides)
|
|
|
|
EVT_UPDATE_UI(SliderPage_BothSides, SliderWidgetsPage::OnUpdateUIBothSides)
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
EVT_UPDATE_UI(SliderPage_Reset, SliderWidgetsPage::OnUpdateUIResetButton)
|
|
|
|
|
|
|
|
EVT_UPDATE_UI(SliderPage_CurValueText, SliderWidgetsPage::OnUpdateUICurValueText)
|
|
|
|
|
2002-07-09 19:33:46 -04:00
|
|
|
EVT_COMMAND_SCROLL(SliderPage_Slider, SliderWidgetsPage::OnSlider)
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2003-12-11 05:32:15 -05:00
|
|
|
EVT_CHECKBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox)
|
|
|
|
EVT_RADIOBOX(wxID_ANY, SliderWidgetsPage::OnCheckOrRadioBox)
|
2001-06-26 17:05:06 -04:00
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
// implementation
|
|
|
|
// ============================================================================
|
|
|
|
|
2006-05-22 06:39:40 -04:00
|
|
|
#if defined(__WXUNIVERSAL__)
|
|
|
|
#define FAMILY_CTRLS UNIVERSAL_CTRLS
|
|
|
|
#else
|
|
|
|
#define FAMILY_CTRLS NATIVE_CTRLS
|
|
|
|
#endif
|
|
|
|
|
2009-07-23 16:30:22 -04:00
|
|
|
IMPLEMENT_WIDGETS_PAGE(SliderWidgetsPage, wxT("Slider"), FAMILY_CTRLS );
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-05-17 15:49:09 -04:00
|
|
|
SliderWidgetsPage::SliderWidgetsPage(WidgetsBookCtrl *book,
|
2004-11-23 06:45:07 -05:00
|
|
|
wxImageList *imaglist)
|
2006-05-26 10:07:47 -04:00
|
|
|
: WidgetsPage(book, imaglist, slider_xpm)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
// init everything
|
|
|
|
m_min = 0;
|
|
|
|
m_max = 100;
|
|
|
|
|
2005-01-28 15:56:09 -05:00
|
|
|
m_chkInverse =
|
2001-06-26 17:05:06 -04:00
|
|
|
m_chkTicks =
|
2009-11-14 11:31:06 -05:00
|
|
|
m_chkMinMaxLabels =
|
|
|
|
m_chkValueLabel =
|
2003-01-24 06:55:29 -05:00
|
|
|
m_chkBothSides = (wxCheckBox *)NULL;
|
|
|
|
|
|
|
|
m_radioSides = (wxRadioBox *)NULL;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
m_slider = (wxSlider *)NULL;
|
|
|
|
m_sizerSlider = (wxSizer *)NULL;
|
2006-06-06 10:10:06 -04:00
|
|
|
}
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2006-06-06 10:10:06 -04:00
|
|
|
void SliderWidgetsPage::CreateContent()
|
|
|
|
{
|
2001-06-26 17:05:06 -04:00
|
|
|
wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
|
|
|
|
|
|
|
|
// left pane
|
2009-07-23 16:30:22 -04:00
|
|
|
wxStaticBox *box = new wxStaticBox(this, wxID_ANY, wxT("&Set style"));
|
2001-06-26 17:05:06 -04:00
|
|
|
wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL);
|
|
|
|
|
2009-07-23 16:30:22 -04:00
|
|
|
m_chkInverse = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("&Inverse"));
|
|
|
|
m_chkTicks = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show &ticks"));
|
2009-11-14 11:31:06 -05:00
|
|
|
m_chkMinMaxLabels = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show min/max &labels"));
|
|
|
|
m_chkValueLabel = CreateCheckBoxAndAddToSizer(sizerLeft, wxT("Show &value label"));
|
2003-01-24 06:55:29 -05:00
|
|
|
static const wxString sides[] =
|
|
|
|
{
|
2009-11-14 18:15:27 -05:00
|
|
|
wxT("default"),
|
2009-07-23 16:30:22 -04:00
|
|
|
wxT("top"),
|
|
|
|
wxT("bottom"),
|
|
|
|
wxT("left"),
|
|
|
|
wxT("right"),
|
2003-01-24 06:55:29 -05:00
|
|
|
};
|
2009-11-14 18:15:27 -05:00
|
|
|
m_radioSides = new wxRadioBox(this, SliderPage_RadioSides, wxT("&Label position"),
|
2003-01-24 06:55:29 -05:00
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
WXSIZEOF(sides), sides,
|
|
|
|
1, wxRA_SPECIFY_COLS);
|
|
|
|
sizerLeft->Add(m_radioSides, 0, wxGROW | wxALL, 5);
|
|
|
|
m_chkBothSides = CreateCheckBoxAndAddToSizer
|
2009-07-23 16:30:22 -04:00
|
|
|
(sizerLeft, wxT("&Both sides"), SliderPage_BothSides);
|
2003-01-24 06:55:29 -05:00
|
|
|
#if wxUSE_TOOLTIPS
|
2009-07-23 16:30:22 -04:00
|
|
|
m_chkBothSides->SetToolTip( wxT("\"Both sides\" is only supported \nin Win95 and Universal") );
|
2003-01-24 06:55:29 -05:00
|
|
|
#endif // wxUSE_TOOLTIPS
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
sizerLeft->Add(5, 5, 0, wxGROW | wxALL, 5); // spacer
|
|
|
|
|
2009-07-23 16:30:22 -04:00
|
|
|
wxButton *btn = new wxButton(this, SliderPage_Reset, wxT("&Reset"));
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15);
|
|
|
|
|
|
|
|
// middle pane
|
2009-07-23 16:30:22 -04:00
|
|
|
wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, wxT("&Change slider value"));
|
2001-06-26 17:05:06 -04:00
|
|
|
wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL);
|
|
|
|
|
|
|
|
wxTextCtrl *text;
|
2009-07-23 16:30:22 -04:00
|
|
|
wxSizer *sizerRow = CreateSizerWithTextAndLabel(wxT("Current value"),
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_CurValueText,
|
|
|
|
&text);
|
2003-12-11 05:32:15 -05:00
|
|
|
text->SetEditable(false);
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
|
|
|
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetValue,
|
2009-07-23 16:30:22 -04:00
|
|
|
wxT("Set &value"),
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_ValueText,
|
|
|
|
&m_textValue);
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
|
|
|
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetMinAndMax,
|
2009-07-23 16:30:22 -04:00
|
|
|
wxT("&Min and max"),
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_MinText,
|
|
|
|
&m_textMin);
|
|
|
|
|
2003-12-11 05:32:15 -05:00
|
|
|
m_textMax = new wxTextCtrl(this, SliderPage_MaxText, wxEmptyString);
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5);
|
|
|
|
|
2009-07-23 16:30:22 -04:00
|
|
|
m_textMin->SetValue( wxString::Format(wxT("%d"), m_min) );
|
|
|
|
m_textMax->SetValue( wxString::Format(wxT("%d"), m_max) );
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2006-07-27 01:05:21 -04:00
|
|
|
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetLineSize,
|
2009-07-23 16:30:22 -04:00
|
|
|
wxT("Li&ne size"),
|
2006-07-27 01:05:21 -04:00
|
|
|
SliderPage_LineSizeText,
|
|
|
|
&m_textLineSize);
|
|
|
|
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
|
|
|
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetPageSize,
|
2009-07-23 16:30:22 -04:00
|
|
|
wxT("P&age size"),
|
2006-07-27 01:05:21 -04:00
|
|
|
SliderPage_PageSizeText,
|
|
|
|
&m_textPageSize);
|
|
|
|
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetTickFreq,
|
2009-07-23 16:30:22 -04:00
|
|
|
wxT("Tick &frequency"),
|
2001-06-26 17:05:06 -04:00
|
|
|
SliderPage_TickFreqText,
|
|
|
|
&m_textTickFreq);
|
|
|
|
|
2009-07-23 16:30:22 -04:00
|
|
|
m_textTickFreq->SetValue(wxT("10"));
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
sizerRow = CreateSizerWithTextAndButton(SliderPage_SetThumbLen,
|
2009-07-23 16:30:22 -04:00
|
|
|
wxT("Thumb &length"),
|
2003-01-24 06:55:29 -05:00
|
|
|
SliderPage_ThumbLenText,
|
|
|
|
&m_textThumbLen);
|
|
|
|
|
|
|
|
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// right pane
|
|
|
|
wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);
|
2003-01-24 06:55:29 -05:00
|
|
|
sizerRight->SetMinSize(150, 40);
|
2001-06-26 17:05:06 -04:00
|
|
|
m_sizerSlider = sizerRight; // save it to modify it later
|
|
|
|
|
|
|
|
Reset();
|
|
|
|
CreateSlider();
|
|
|
|
|
2009-07-23 16:30:22 -04:00
|
|
|
m_textLineSize->SetValue(wxString::Format(wxT("%d"), m_slider->GetLineSize()));
|
|
|
|
m_textPageSize->SetValue(wxString::Format(wxT("%d"), m_slider->GetPageSize()));
|
2006-07-27 01:05:21 -04:00
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// the 3 panes panes compose the window
|
|
|
|
sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10);
|
2002-04-09 06:31:37 -04:00
|
|
|
sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10);
|
2001-06-26 17:05:06 -04:00
|
|
|
sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10);
|
|
|
|
|
|
|
|
// final initializations
|
|
|
|
SetSizer(sizerTop);
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// operations
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SliderWidgetsPage::Reset()
|
|
|
|
{
|
2005-01-23 15:17:21 -05:00
|
|
|
m_chkInverse->SetValue(false);
|
2003-12-11 05:32:15 -05:00
|
|
|
m_chkTicks->SetValue(true);
|
2009-11-14 11:31:06 -05:00
|
|
|
m_chkValueLabel->SetValue(true);
|
|
|
|
m_chkMinMaxLabels->SetValue(true);
|
2003-12-11 05:32:15 -05:00
|
|
|
m_chkBothSides->SetValue(false);
|
2003-01-24 06:55:29 -05:00
|
|
|
|
2009-11-14 18:15:27 -05:00
|
|
|
m_radioSides->SetSelection(SliderTicks_None);
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::CreateSlider()
|
|
|
|
{
|
2006-04-16 19:39:11 -04:00
|
|
|
int flags = ms_defaultFlags;
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2005-01-23 15:17:21 -05:00
|
|
|
if ( m_chkInverse->GetValue() )
|
|
|
|
{
|
|
|
|
flags |= wxSL_INVERSE;
|
|
|
|
}
|
|
|
|
|
2009-11-14 11:31:06 -05:00
|
|
|
if ( m_chkMinMaxLabels->GetValue() )
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2009-11-14 11:31:06 -05:00
|
|
|
flags |= wxSL_MIN_MAX_LABELS;
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_chkValueLabel->GetValue() )
|
|
|
|
{
|
|
|
|
flags |= wxSL_VALUE_LABEL;
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_chkTicks->GetValue() )
|
|
|
|
{
|
|
|
|
flags |= wxSL_AUTOTICKS;
|
|
|
|
}
|
|
|
|
|
2009-11-14 18:15:27 -05:00
|
|
|
// notice that the style names refer to the _ticks_ positions while we want
|
|
|
|
// to allow the user to select the label(s) positions and the labels are on
|
|
|
|
// the opposite side from the ticks, hence the apparent reversal below
|
2003-01-24 06:55:29 -05:00
|
|
|
switch ( m_radioSides->GetSelection() )
|
|
|
|
{
|
2009-11-14 18:15:27 -05:00
|
|
|
case SliderTicks_None:
|
|
|
|
break;
|
|
|
|
|
2005-04-10 14:07:08 -04:00
|
|
|
case SliderTicks_Top:
|
2009-11-14 18:15:27 -05:00
|
|
|
flags |= wxSL_BOTTOM;
|
2003-01-24 06:55:29 -05:00
|
|
|
break;
|
2005-04-10 14:07:08 -04:00
|
|
|
|
|
|
|
case SliderTicks_Left:
|
2009-11-14 18:15:27 -05:00
|
|
|
flags |= wxSL_RIGHT | wxSL_VERTICAL;
|
2003-01-24 06:55:29 -05:00
|
|
|
break;
|
2005-04-10 14:07:08 -04:00
|
|
|
|
|
|
|
case SliderTicks_Bottom:
|
2009-11-14 18:15:27 -05:00
|
|
|
flags |= wxSL_TOP;
|
2003-01-24 06:55:29 -05:00
|
|
|
break;
|
2005-04-10 14:07:08 -04:00
|
|
|
|
2009-11-14 18:15:07 -05:00
|
|
|
case SliderTicks_Right:
|
2009-11-14 18:15:27 -05:00
|
|
|
flags |= wxSL_LEFT | wxSL_VERTICAL;
|
2003-01-24 06:55:29 -05:00
|
|
|
break;
|
2005-04-10 14:07:08 -04:00
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
default:
|
2009-07-23 16:30:22 -04:00
|
|
|
wxFAIL_MSG(wxT("unexpected radiobox selection"));
|
2003-01-24 06:55:29 -05:00
|
|
|
// fall through
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_chkBothSides->GetValue() )
|
|
|
|
{
|
|
|
|
flags |= wxSL_BOTH;
|
|
|
|
}
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
int val = m_min;
|
|
|
|
if ( m_slider )
|
|
|
|
{
|
|
|
|
int valOld = m_slider->GetValue();
|
|
|
|
if ( !IsValidValue(valOld) )
|
|
|
|
{
|
|
|
|
val = valOld;
|
|
|
|
}
|
|
|
|
|
Deprecated wxSizer::Remove( wxWindow* ), s/Remove/Detach/ in most places.
Made wxSizer child list typesafe. I've not added the wxList implicit
conversion kludge yet, let's see who complains first perhaps..
Deprecated wxSizer::{G,S}etOption in favour of {G,S}etProportion in line
with the parameter name change in the docs.
Added {G,S}etSpacer consistent with the accessors for windows/sizers.
Made all wxSizer index parameters size_t -- we support no sensible
interpretation for negative indexes in them. Hopefully this will
cause no real problems, but code doing (eg. Remove( 0 )) will need
to change to use 0u to resolve the ambiguity with overloaded members.
This is probably a Good Thing though, ymmv.
s/FALSE/false/g ; s/TRUE/true/g ; s/wxASSERT/wxASSERT_MSG/g in sizer.{cpp,h}
Fixed (I hope) the brokenness in wxSizer::Show -- I have no code to test
this yet, so it's a blind change, but spacers should now be hidden correctly
instead of ignored, and it should be properly reversable over multiple
calls now too.
removed pointless private scoping around DECLARE_CLASS macros.
Replace 0's I added previously with NULL -- not like that will end the
email thread either..
Added Add( wxSizerItem * ) & co. There are probably a couple of other
places we can usefully do something like this too. Stopped short of
refactoring everything to raise some issues about sizer method recursion
on -dev.
Updated wxSizer docs some more, they are still incomplete but getting
better.
wrapped KeyCode in wxDEPRECATED, converted all (gtk build) instances
to GetKeyCode. There may be a few left for other ports.
Fixed a couple of other random compile warnings along the way.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18616 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2003-01-07 05:22:07 -05:00
|
|
|
m_sizerSlider->Detach( m_slider );
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
if ( m_sizerSlider->GetChildren().GetCount() )
|
|
|
|
{
|
|
|
|
// we have 2 spacers, remove them too
|
2003-01-26 09:03:29 -05:00
|
|
|
m_sizerSlider->Remove( 0 );
|
|
|
|
m_sizerSlider->Remove( 0 );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
delete m_slider;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_slider = new wxSlider(this, SliderPage_Slider,
|
|
|
|
val, m_min, m_max,
|
|
|
|
wxDefaultPosition, wxDefaultSize,
|
|
|
|
flags);
|
|
|
|
|
2005-04-10 14:07:08 -04:00
|
|
|
if ( m_slider->HasFlag(wxSL_VERTICAL) )
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
m_sizerSlider->Add(0, 0, 1);
|
|
|
|
m_sizerSlider->Add(m_slider, 0, wxGROW | wxALL, 5);
|
|
|
|
m_sizerSlider->Add(0, 0, 1);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
m_sizerSlider->Add(m_slider, 1, wxCENTRE | wxALL, 5);
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( m_chkTicks->GetValue() )
|
|
|
|
{
|
|
|
|
DoSetTickFreq();
|
|
|
|
}
|
|
|
|
|
|
|
|
m_sizerSlider->Layout();
|
|
|
|
}
|
|
|
|
|
2006-07-27 01:05:21 -04:00
|
|
|
void SliderWidgetsPage::DoSetLineSize()
|
|
|
|
{
|
|
|
|
long lineSize;
|
|
|
|
if ( !m_textLineSize->GetValue().ToLong(&lineSize) )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid slider line size"));
|
2006-07-27 01:05:21 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_slider->SetLineSize(lineSize);
|
|
|
|
|
|
|
|
if ( m_slider->GetLineSize() != lineSize )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid line size in slider."));
|
2006-07-27 01:05:21 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::DoSetPageSize()
|
|
|
|
{
|
|
|
|
long pageSize;
|
|
|
|
if ( !m_textPageSize->GetValue().ToLong(&pageSize) )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid slider page size"));
|
2006-07-27 01:05:21 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_slider->SetPageSize(pageSize);
|
|
|
|
|
|
|
|
if ( m_slider->GetPageSize() != pageSize )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid page size in slider."));
|
2006-07-27 01:05:21 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
void SliderWidgetsPage::DoSetTickFreq()
|
|
|
|
{
|
|
|
|
long freq;
|
|
|
|
if ( !m_textTickFreq->GetValue().ToLong(&freq) )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid slider tick frequency"));
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2011-02-05 11:36:30 -05:00
|
|
|
m_slider->SetTickFreq(freq);
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
void SliderWidgetsPage::DoSetThumbLen()
|
|
|
|
{
|
|
|
|
long len;
|
|
|
|
if ( !m_textThumbLen->GetValue().ToLong(&len) )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid slider thumb length"));
|
2003-01-24 06:55:29 -05:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_slider->SetThumbLength(len);
|
|
|
|
}
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
// event handlers
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
Reset();
|
|
|
|
|
|
|
|
CreateSlider();
|
|
|
|
}
|
|
|
|
|
2006-07-27 01:05:21 -04:00
|
|
|
void SliderWidgetsPage::OnButtonSetLineSize(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
DoSetLineSize();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnButtonSetPageSize(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
DoSetPageSize();
|
|
|
|
}
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
void SliderWidgetsPage::OnButtonSetTickFreq(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
DoSetTickFreq();
|
|
|
|
}
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
void SliderWidgetsPage::OnButtonSetThumbLen(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
DoSetThumbLen();
|
|
|
|
}
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
void SliderWidgetsPage::OnButtonSetMinAndMax(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
long minNew,
|
|
|
|
maxNew = 0; // init to suppress compiler warning
|
|
|
|
if ( !m_textMin->GetValue().ToLong(&minNew) ||
|
|
|
|
!m_textMax->GetValue().ToLong(&maxNew) ||
|
|
|
|
minNew >= maxNew )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid min/max values for the slider."));
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_min = minNew;
|
|
|
|
m_max = maxNew;
|
|
|
|
|
|
|
|
m_slider->SetRange(minNew, maxNew);
|
2005-03-21 12:30:10 -05:00
|
|
|
|
|
|
|
if ( m_slider->GetMin() != m_min ||
|
|
|
|
m_slider->GetMax() != m_max )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid range in slider."));
|
2005-03-21 12:30:10 -05:00
|
|
|
}
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
|
|
|
|
{
|
|
|
|
long val;
|
|
|
|
if ( !m_textValue->GetValue().ToLong(&val) || !IsValidValue(val) )
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
wxLogWarning(wxT("Invalid slider value."));
|
2001-06-26 17:05:06 -04:00
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
m_slider->SetValue(val);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnUpdateUIValueButton(wxUpdateUIEvent& event)
|
|
|
|
{
|
|
|
|
long val;
|
|
|
|
event.Enable( m_textValue->GetValue().ToLong(&val) && IsValidValue(val) );
|
|
|
|
}
|
|
|
|
|
2006-07-27 01:05:21 -04:00
|
|
|
void SliderWidgetsPage::OnUpdateUILineSize(wxUpdateUIEvent& event)
|
|
|
|
{
|
|
|
|
long lineSize;
|
|
|
|
event.Enable( m_textLineSize->GetValue().ToLong(&lineSize) &&
|
|
|
|
(lineSize > 0) && (lineSize <= m_max - m_min) );
|
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnUpdateUIPageSize(wxUpdateUIEvent& event)
|
|
|
|
{
|
|
|
|
long pageSize;
|
|
|
|
event.Enable( m_textPageSize->GetValue().ToLong(&pageSize) &&
|
|
|
|
(pageSize > 0) && (pageSize <= m_max - m_min) );
|
|
|
|
}
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
void SliderWidgetsPage::OnUpdateUITickFreq(wxUpdateUIEvent& event)
|
|
|
|
{
|
|
|
|
long freq;
|
|
|
|
event.Enable( m_chkTicks->GetValue() &&
|
|
|
|
m_textTickFreq->GetValue().ToLong(&freq) &&
|
|
|
|
(freq > 0) && (freq <= m_max - m_min) );
|
|
|
|
}
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
void SliderWidgetsPage::OnUpdateUIThumbLen(wxUpdateUIEvent& event)
|
|
|
|
{
|
|
|
|
long val;
|
|
|
|
event.Enable( m_textThumbLen->GetValue().ToLong(&val));
|
|
|
|
}
|
|
|
|
|
2001-06-26 17:05:06 -04:00
|
|
|
void SliderWidgetsPage::OnUpdateUIMinMaxButton(wxUpdateUIEvent& event)
|
|
|
|
{
|
|
|
|
long mn, mx;
|
|
|
|
event.Enable( m_textMin->GetValue().ToLong(&mn) &&
|
|
|
|
m_textMax->GetValue().ToLong(&mx) &&
|
|
|
|
mn < mx);
|
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
|
|
|
|
{
|
2005-04-10 14:07:08 -04:00
|
|
|
event.Enable( m_chkInverse->GetValue() ||
|
2003-01-24 06:55:29 -05:00
|
|
|
!m_chkTicks->GetValue() ||
|
2009-11-14 11:31:06 -05:00
|
|
|
!m_chkValueLabel->GetValue() ||
|
|
|
|
!m_chkMinMaxLabels->GetValue() ||
|
2005-04-10 14:07:08 -04:00
|
|
|
m_chkBothSides->GetValue() ||
|
2009-11-14 18:15:27 -05:00
|
|
|
m_radioSides->GetSelection() != SliderTicks_None );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2003-07-31 09:59:28 -04:00
|
|
|
void SliderWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event))
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
|
|
|
CreateSlider();
|
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnUpdateUICurValueText(wxUpdateUIEvent& event)
|
|
|
|
{
|
2009-07-23 16:30:22 -04:00
|
|
|
event.SetText( wxString::Format(wxT("%d"), m_slider->GetValue()) );
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2003-01-24 06:55:29 -05:00
|
|
|
void SliderWidgetsPage::OnUpdateUIRadioSides(wxUpdateUIEvent& event)
|
|
|
|
{
|
2009-11-14 11:31:06 -05:00
|
|
|
event.Enable( m_chkValueLabel->GetValue() || m_chkTicks->GetValue() );
|
2003-01-24 06:55:29 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
void SliderWidgetsPage::OnUpdateUIBothSides(wxUpdateUIEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2005-12-19 05:47:44 -05:00
|
|
|
#if defined(__WXMSW__) || defined(__WXUNIVERSAL__)
|
2003-01-24 06:55:29 -05:00
|
|
|
event.Enable( m_chkTicks->GetValue() );
|
|
|
|
#else
|
2003-12-11 05:32:15 -05:00
|
|
|
event.Enable( false );
|
2005-12-19 05:47:44 -05:00
|
|
|
#endif // defined(__WXMSW__) || defined(__WXUNIVERSAL__)
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2002-07-09 19:33:46 -04:00
|
|
|
void SliderWidgetsPage::OnSlider(wxScrollEvent& event)
|
2001-06-26 17:05:06 -04:00
|
|
|
{
|
2002-12-04 09:11:26 -05:00
|
|
|
wxASSERT_MSG( event.GetInt() == m_slider->GetValue(),
|
|
|
|
wxT("slider value should be the same") );
|
2001-06-26 17:05:06 -04:00
|
|
|
|
2002-07-09 19:33:46 -04:00
|
|
|
wxEventType eventType = event.GetEventType();
|
|
|
|
|
|
|
|
/*
|
|
|
|
This array takes the EXACT order of the declarations in
|
|
|
|
include/wx/event.h
|
|
|
|
(section "wxScrollBar and wxSlider event identifiers")
|
|
|
|
*/
|
|
|
|
static const wxChar *eventNames[] =
|
|
|
|
{
|
|
|
|
wxT("wxEVT_SCROLL_TOP"),
|
|
|
|
wxT("wxEVT_SCROLL_BOTTOM"),
|
|
|
|
wxT("wxEVT_SCROLL_LINEUP"),
|
|
|
|
wxT("wxEVT_SCROLL_LINEDOWN"),
|
|
|
|
wxT("wxEVT_SCROLL_PAGEUP"),
|
|
|
|
wxT("wxEVT_SCROLL_PAGEDOWN"),
|
|
|
|
wxT("wxEVT_SCROLL_THUMBTRACK"),
|
|
|
|
wxT("wxEVT_SCROLL_THUMBRELEASE"),
|
2005-05-31 11:22:10 -04:00
|
|
|
wxT("wxEVT_SCROLL_CHANGED")
|
2002-07-09 19:33:46 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
int index = eventType - wxEVT_SCROLL_TOP;
|
|
|
|
|
|
|
|
/*
|
|
|
|
If this assert is triggered, there is an unknown slider event which
|
|
|
|
should be added to the above eventNames array.
|
|
|
|
*/
|
2002-08-22 15:22:52 -04:00
|
|
|
wxASSERT_MSG(index >= 0 && (size_t)index < WXSIZEOF(eventNames),
|
2002-07-09 19:33:46 -04:00
|
|
|
wxT("Unknown slider event") );
|
|
|
|
|
|
|
|
|
|
|
|
static int s_numSliderEvents = 0;
|
|
|
|
|
2006-04-28 13:07:14 -04:00
|
|
|
wxLogMessage(wxT("Slider event #%d: %s (pos = %d, int value = %d)"),
|
2002-07-10 10:11:05 -04:00
|
|
|
s_numSliderEvents++,
|
2002-07-09 19:33:46 -04:00
|
|
|
eventNames[index],
|
2005-01-23 15:17:21 -05:00
|
|
|
event.GetPosition(),
|
|
|
|
event.GetInt());
|
2001-06-26 17:05:06 -04:00
|
|
|
}
|
|
|
|
|
2004-11-23 06:45:07 -05:00
|
|
|
#endif // wxUSE_SLIDER
|