X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/12a3f2275c94a345cf83abf5151db68391859623..1e72e3cc53f04cc79189ab5d0f6fecca3f68a2ee:/samples/widgets/button.cpp diff --git a/samples/widgets/button.cpp b/samples/widgets/button.cpp index 973ba9f9d1..ebe6d45887 100644 --- a/samples/widgets/button.cpp +++ b/samples/widgets/button.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Program: wxWindows Widgets Sample +// Program: wxWidgets Widgets Sample // Name: button.cpp // Purpose: Part of the widgets sample showing wxButton // Author: Vadim Zeitlin @@ -78,7 +78,7 @@ class ButtonWidgetsPage : public WidgetsPage { public: ButtonWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); - virtual ~ButtonWidgetsPage(); + virtual ~ButtonWidgetsPage(){}; protected: // event handlers @@ -105,7 +105,7 @@ protected: wxRadioBox *m_radioHAlign, *m_radioVAlign; - // the gauge itself and the sizer it is in + // the button itself and the sizer it is in wxButton *m_button; wxSizer *m_sizerButton; @@ -127,8 +127,8 @@ BEGIN_EVENT_TABLE(ButtonWidgetsPage, WidgetsPage) EVT_BUTTON(ButtonPage_Reset, ButtonWidgetsPage::OnButtonReset) EVT_BUTTON(ButtonPage_ChangeLabel, ButtonWidgetsPage::OnButtonChangeLabel) - EVT_CHECKBOX(-1, ButtonWidgetsPage::OnCheckOrRadioBox) - EVT_RADIOBOX(-1, ButtonWidgetsPage::OnCheckOrRadioBox) + EVT_CHECKBOX(wxID_ANY, ButtonWidgetsPage::OnCheckOrRadioBox) + EVT_RADIOBOX(wxID_ANY, ButtonWidgetsPage::OnCheckOrRadioBox) END_EVENT_TABLE() // ============================================================================ @@ -159,7 +159,7 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane - wxStaticBox *box = new wxStaticBox(this, -1, _T("&Set style")); + wxStaticBox *box = new wxStaticBox(this, wxID_ANY, _T("&Set style")); wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); @@ -168,7 +168,7 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, m_chkDefault = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Default")); #ifndef __WXUNIVERSAL__ - // only wxUniv currently supoprts buttons with images + // only wxUniv currently supports buttons with images m_chkImage->Disable(); #endif // !wxUniv @@ -189,10 +189,10 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, _T("bottom"), }; - m_radioHAlign = new wxRadioBox(this, -1, _T("&Horz alignment"), + m_radioHAlign = new wxRadioBox(this, wxID_ANY, _T("&Horz alignment"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(halign), halign); - m_radioVAlign = new wxRadioBox(this, -1, _T("&Vert alignment"), + m_radioVAlign = new wxRadioBox(this, wxID_ANY, _T("&Vert alignment"), wxDefaultPosition, wxDefaultSize, WXSIZEOF(valign), valign); @@ -205,12 +205,12 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, sizerLeft->Add(btn, 0, wxALIGN_CENTRE_HORIZONTAL | wxALL, 15); // middle pane - wxStaticBox *box2 = new wxStaticBox(this, -1, _T("&Operations")); + wxStaticBox *box2 = new wxStaticBox(this, wxID_ANY, _T("&Operations")); wxSizer *sizerMiddle = new wxStaticBoxSizer(box2, wxVERTICAL); wxSizer *sizerRow = CreateSizerWithTextAndButton(ButtonPage_ChangeLabel, _T("Change label"), - -1, + wxID_ANY, &m_textLabel); sizerMiddle->Add(sizerRow, 0, wxALL | wxGROW, 5); @@ -232,25 +232,20 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxNotebook *notebook, // final initializations Reset(); - SetAutoLayout(TRUE); SetSizer(sizerTop); sizerTop->Fit(this); } -ButtonWidgetsPage::~ButtonWidgetsPage() -{ -} - // ---------------------------------------------------------------------------- // operations // ---------------------------------------------------------------------------- void ButtonWidgetsPage::Reset() { - m_chkFit->SetValue(TRUE); - m_chkImage->SetValue(FALSE); - m_chkDefault->SetValue(FALSE); + m_chkFit->SetValue(true); + m_chkImage->SetValue(false); + m_chkDefault->SetValue(false); m_radioHAlign->SetSelection(ButtonHAlign_Centre); m_radioVAlign->SetSelection(ButtonVAlign_Centre); @@ -266,7 +261,7 @@ void ButtonWidgetsPage::CreateButton() size_t count = m_sizerButton->GetChildren().GetCount(); for ( size_t n = 0; n < count; n++ ) { - m_sizerButton->Remove( 0u ); + m_sizerButton->Remove( 0 ); } delete m_button; @@ -355,7 +350,7 @@ void ButtonWidgetsPage::OnButtonReset(wxCommandEvent& WXUNUSED(event)) CreateButton(); } -void ButtonWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& event) +void ButtonWidgetsPage::OnCheckOrRadioBox(wxCommandEvent& WXUNUSED(event)) { CreateButton(); } @@ -365,7 +360,7 @@ void ButtonWidgetsPage::OnButtonChangeLabel(wxCommandEvent& WXUNUSED(event)) m_button->SetLabel(m_textLabel->GetValue()); } -void ButtonWidgetsPage::OnButton(wxCommandEvent& event) +void ButtonWidgetsPage::OnButton(wxCommandEvent& WXUNUSED(event)) { wxLogMessage(_T("Test button clicked.")); }