X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/261357eb0ad855b642fe68a84c9ad2b727a926cb..78eecde0860f23a11932c53b1e59e41a6effd6bb:/samples/widgets/radiobox.cpp diff --git a/samples/widgets/radiobox.cpp b/samples/widgets/radiobox.cpp index 9f647fd92e..ae54443838 100644 --- a/samples/widgets/radiobox.cpp +++ b/samples/widgets/radiobox.cpp @@ -89,6 +89,9 @@ public: virtual wxControl *GetWidget() const { return m_radio; } virtual void RecreateWidget() { CreateRadio(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnCheckOrRadioBox(wxCommandEvent& event); @@ -119,7 +122,7 @@ protected: // ------------ // the check/radio boxes for styles - wxCheckBox *m_chkVert; + wxCheckBox *m_chkSpecifyRows; wxCheckBox *m_chkEnableItem; wxCheckBox *m_chkShowItem; wxRadioBox *m_radioDir; @@ -188,7 +191,7 @@ RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book, : WidgetsPage(book, imaglist, radio_xpm) { // init everything - m_chkVert = (wxCheckBox *)NULL; + m_chkSpecifyRows = (wxCheckBox *)NULL; m_chkEnableItem = (wxCheckBox *)NULL; m_chkShowItem = (wxCheckBox *)NULL; @@ -199,7 +202,10 @@ RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book, m_radio = m_radioDir = (wxRadioBox *)NULL; m_sizerRadio = (wxSizer *)NULL; +} +void RadioWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -207,7 +213,11 @@ RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book, wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - m_chkVert = CreateCheckBoxAndAddToSizer(sizerLeft, _T("&Vertical layout")); + m_chkSpecifyRows = CreateCheckBoxAndAddToSizer + ( + sizerLeft, + "Major specifies &rows count" + ); static const wxString layoutDir[] = { @@ -296,8 +306,6 @@ RadioWidgetsPage::RadioWidgetsPage(WidgetsBookCtrl *book, // final initializations SetSizer(sizerTop); - - sizerTop->Fit(this); } // ---------------------------------------------------------------------------- @@ -311,7 +319,7 @@ void RadioWidgetsPage::Reset() m_textLabel->SetValue(_T("I'm a radiobox")); m_textLabelBtns->SetValue(_T("item")); - m_chkVert->SetValue(false); + m_chkSpecifyRows->SetValue(false); m_chkEnableItem->SetValue(true); m_chkShowItem->SetValue(true); m_radioDir->SetSelection(RadioDir_Default); @@ -360,8 +368,8 @@ void RadioWidgetsPage::CreateRadio() labelBtn.c_str(), (unsigned long)n + 1); } - int flags = m_chkVert->GetValue() ? wxRA_VERTICAL - : wxRA_HORIZONTAL; + int flags = m_chkSpecifyRows->GetValue() ? wxRA_SPECIFY_ROWS + : wxRA_SPECIFY_COLS; flags |= ms_defaultFlags; @@ -487,7 +495,7 @@ void RadioWidgetsPage::OnUpdateUISelection(wxUpdateUIEvent& event) void RadioWidgetsPage::OnUpdateUIReset(wxUpdateUIEvent& event) { // only enable it if something is not set to default - bool enable = m_chkVert->GetValue(); + bool enable = m_chkSpecifyRows->GetValue(); if ( !enable ) {