X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/32b8ec418aee4e38877d4cb79e2984c766dcc358..0689c79e4eb0df289a03b2727ea9069d823f929a:/samples/widgets/spinbtn.cpp diff --git a/samples/widgets/spinbtn.cpp b/samples/widgets/spinbtn.cpp index 99862dfd6b..1d39412359 100644 --- a/samples/widgets/spinbtn.cpp +++ b/samples/widgets/spinbtn.cpp @@ -28,6 +28,7 @@ #ifndef WX_PRECOMP #include "wx/log.h" + #include "wx/bitmap.h" #include "wx/button.h" #include "wx/checkbox.h" #include "wx/radiobox.h" @@ -41,7 +42,7 @@ #include "wx/sizer.h" #include "widgets.h" - +#if wxUSE_SPINBTN #include "icons/spinbtn.xpm" // ---------------------------------------------------------------------------- @@ -126,8 +127,8 @@ protected: *m_textMax; private: - DECLARE_EVENT_TABLE(); - DECLARE_WIDGETS_PAGE(SpinBtnWidgetsPage); + DECLARE_EVENT_TABLE() + DECLARE_WIDGETS_PAGE(SpinBtnWidgetsPage) }; // ---------------------------------------------------------------------------- @@ -165,6 +166,13 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, wxImageList *imaglist) : WidgetsPage(notebook) { + m_chkVert = NULL; + m_chkWrap = NULL; + m_spinbtn = NULL; + m_spinctrl = NULL; + m_textValue = NULL; + m_textMin = NULL; + m_textMax = NULL; imaglist->Add(wxBitmap(spinbtn_xpm)); // init everything @@ -217,14 +225,14 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, m_textMax = new wxTextCtrl(this, SpinBtnPage_MaxText, _T("")); sizerRow->Add(m_textMax, 1, wxLEFT | wxALIGN_CENTRE_VERTICAL, 5); - m_textMin->SetValue(wxString::Format(_T("%lu"), m_min)); - m_textMax->SetValue(wxString::Format(_T("%lu"), m_max)); + m_textMin->SetValue( wxString::Format(_T("%d"), m_min) ); + m_textMax->SetValue( wxString::Format(_T("%d"), m_max) ); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); // right pane wxSizer *sizerRight = new wxBoxSizer(wxVERTICAL); - sizerRight->SetMinSize(250, 0); + sizerRight->SetMinSize(150, 0); m_sizerSpin = sizerRight; // save it to modify it later Reset(); @@ -232,7 +240,7 @@ SpinBtnWidgetsPage::SpinBtnWidgetsPage(wxNotebook *notebook, // the 3 panes panes compose the window sizerTop->Add(sizerLeft, 0, wxGROW | (wxALL & ~wxLEFT), 10); - sizerTop->Add(sizerMiddle, 1, wxGROW | wxALL, 10); + sizerTop->Add(sizerMiddle, 0, wxGROW | wxALL, 10); sizerTop->Add(sizerRight, 1, wxGROW | (wxALL & ~wxRIGHT), 10); // final initializations @@ -278,13 +286,13 @@ void SpinBtnWidgetsPage::CreateSpin() val = valOld; } - m_sizerSpin->Remove(m_spinbtn); - m_sizerSpin->Remove(m_spinctrl); + m_sizerSpin->Detach( m_spinbtn ); + m_sizerSpin->Detach( m_spinctrl ); // there are 3 spacers left - m_sizerSpin->Remove((int)0); - m_sizerSpin->Remove((int)0); - m_sizerSpin->Remove((int)0); + m_sizerSpin->Remove( 0 ); + m_sizerSpin->Remove( 0 ); + m_sizerSpin->Remove( 0 ); delete m_spinbtn; delete m_spinctrl; @@ -398,18 +406,20 @@ void SpinBtnWidgetsPage::OnSpinBtn(wxCommandEvent& event) void SpinBtnWidgetsPage::OnSpinBtnUp(wxCommandEvent& event) { - wxLogMessage(_T("Spin button value incremented, will be %d (was %d)"), - event.GetInt(), m_spinbtn->GetValue()); + wxLogMessage( _T("Spin button value incremented, will be %ld (was %d)"), + event.GetInt(), m_spinbtn->GetValue() ); } void SpinBtnWidgetsPage::OnSpinBtnDown(wxCommandEvent& event) { - wxLogMessage(_T("Spin button value decremented, will be %d (was %d)"), - event.GetInt(), m_spinbtn->GetValue()); + wxLogMessage( _T("Spin button value decremented, will be %ld (was %d)"), + event.GetInt(), m_spinbtn->GetValue() ); } void SpinBtnWidgetsPage::OnSpinCtrl(wxCommandEvent& event) { + if (!m_spinctrl) + return; int value = event.GetInt(); wxASSERT_MSG( value == m_spinctrl->GetValue(), @@ -417,3 +427,5 @@ void SpinBtnWidgetsPage::OnSpinCtrl(wxCommandEvent& event) wxLogMessage(_T("Spin control value changed, now %d"), value); } +#endif + // wxUSE_SPINBTN