// Created: 16.04.01
// Id: $Id$
// Copyright: (c) 2001 Vadim Zeitlin
-// License: wxWindows license
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// ============================================================================
SpinBtnPage_Clear,
SpinBtnPage_SetValue,
SpinBtnPage_SetMinAndMax,
+ SpinBtnPage_SetBase,
SpinBtnPage_CurValueText,
SpinBtnPage_ValueText,
SpinBtnPage_MinText,
SpinBtnPage_MaxText,
+ SpinBtnPage_BaseText,
SpinBtnPage_SpinBtn,
SpinBtnPage_SpinCtrl,
SpinBtnPage_SpinCtrlDouble
void OnButtonClear(wxCommandEvent& event);
void OnButtonSetValue(wxCommandEvent& event);
void OnButtonSetMinAndMax(wxCommandEvent& event);
+ void OnButtonSetBase(wxCommandEvent& event);
void OnCheckOrRadioBox(wxCommandEvent& event);
void OnUpdateUIValueButton(wxUpdateUIEvent& event);
void OnUpdateUIMinMaxButton(wxUpdateUIEvent& event);
+ void OnUpdateUIBaseButton(wxUpdateUIEvent& event);
void OnUpdateUIResetButton(wxUpdateUIEvent& event);
// the spinbtn range
int m_min, m_max;
+ // and numeric base
+ int m_base;
+
// the controls
// ------------
*m_chkArrowKeys,
*m_chkWrap,
*m_chkProcessEnter;
- wxRadioBox *m_radioAlign;
+ wxRadioBox *m_radioAlign;
// the spinbtn and the spinctrl and the sizer containing them
wxSpinButton *m_spinbtn;
// the text entries for set value/range
wxTextCtrl *m_textValue,
*m_textMin,
- *m_textMax;
+ *m_textMax,
+ *m_textBase;
private:
DECLARE_EVENT_TABLE()
EVT_BUTTON(SpinBtnPage_Reset, SpinBtnWidgetsPage::OnButtonReset)
EVT_BUTTON(SpinBtnPage_SetValue, SpinBtnWidgetsPage::OnButtonSetValue)
EVT_BUTTON(SpinBtnPage_SetMinAndMax, SpinBtnWidgetsPage::OnButtonSetMinAndMax)
+ EVT_BUTTON(SpinBtnPage_SetBase, SpinBtnWidgetsPage::OnButtonSetBase)
EVT_UPDATE_UI(SpinBtnPage_SetValue, SpinBtnWidgetsPage::OnUpdateUIValueButton)
EVT_UPDATE_UI(SpinBtnPage_SetMinAndMax, SpinBtnWidgetsPage::OnUpdateUIMinMaxButton)
+ EVT_UPDATE_UI(SpinBtnPage_SetBase, SpinBtnWidgetsPage::OnUpdateUIBaseButton)
EVT_UPDATE_UI(SpinBtnPage_Reset, SpinBtnWidgetsPage::OnUpdateUIResetButton)
EVT_TEXT(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinText)
EVT_TEXT_ENTER(SpinBtnPage_SpinCtrl, SpinBtnWidgetsPage::OnSpinTextEnter)
EVT_TEXT(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinText)
+ EVT_TEXT_ENTER(SpinBtnPage_SpinCtrlDouble, SpinBtnWidgetsPage::OnSpinTextEnter)
EVT_CHECKBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox)
EVT_RADIOBOX(wxID_ANY, SpinBtnWidgetsPage::OnCheckOrRadioBox)
m_spinbtn = NULL;
m_spinctrl = NULL;
m_spinctrldbl = NULL;
- m_textValue = NULL;
- m_textMin = NULL;
- m_textMax = NULL;
+ m_textValue =
+ m_textMin =
+ m_textMax =
+ m_textBase = NULL;
m_min = 0;
m_max = 10;
+ m_base = 10;
+
m_sizerSpin = NULL;
}
sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
+ sizerRow = CreateSizerWithTextAndButton(SpinBtnPage_SetBase,
+ "Set &base",
+ SpinBtnPage_BaseText,
+ &m_textBase);
+ m_textBase->SetValue("10");
+ sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5);
+
// right pane
wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL);
sizerRight->SetMinSize(150, 0);
m_min = minNew;
m_max = maxNew;
+ wxString smax('9', m_textMax->GetValue().length());
+ wxSize
+ size = m_spinctrl->GetSizeFromTextSize(m_spinctrl->GetTextExtent(smax));
+
+ m_spinctrl->SetMinSize(size);
+ m_spinctrl->SetSize(size);
+
+ smax += ".0";
+ size = m_spinctrldbl->GetSizeFromTextSize(
+ m_spinctrldbl->GetTextExtent(smax)
+ );
+ m_spinctrldbl->SetMinSize(size);
+ m_spinctrldbl->SetSize(size);
m_spinbtn->SetRange(minNew, maxNew);
m_spinctrl->SetRange(minNew, maxNew);
m_spinctrldbl->SetRange(minNew, maxNew);
}
+void SpinBtnWidgetsPage::OnButtonSetBase(wxCommandEvent& WXUNUSED(event))
+{
+ unsigned long base;
+ if ( !m_textBase->GetValue().ToULong(&base) || !base )
+ {
+ wxLogWarning("Invalid base value.");
+ return;
+ }
+
+ m_base = base;
+ if ( !m_spinctrl->SetBase(m_base) )
+ {
+ wxLogWarning("Setting base %d failed.", m_base);
+ }
+}
+
void SpinBtnWidgetsPage::OnButtonSetValue(wxCommandEvent& WXUNUSED(event))
{
long val;
mn <= mx);
}
+void SpinBtnWidgetsPage::OnUpdateUIBaseButton(wxUpdateUIEvent& event)
+{
+ unsigned long base;
+ event.Enable( m_textBase->GetValue().ToULong(&base) && base );
+}
+
void SpinBtnWidgetsPage::OnUpdateUIResetButton(wxUpdateUIEvent& event)
{
event.Enable( !m_chkVert->GetValue() ||