X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f2fdc4d56e41711ce7c547484bf97aa0c2bd997a..e960c20e389061c0db09e03fdaf9ffe3a418779b:/samples/widgets/static.cpp?ds=inline diff --git a/samples/widgets/static.cpp b/samples/widgets/static.cpp index 1866e8d469..c40d3bccc0 100644 --- a/samples/widgets/static.cpp +++ b/samples/widgets/static.cpp @@ -51,7 +51,7 @@ // control ids enum { - StaticPage_Reset = 100, + StaticPage_Reset = wxID_HIGHEST, StaticPage_BoxText, StaticPage_LabelText }; @@ -145,6 +145,9 @@ public: virtual wxControl *GetWidget() const { return m_statText; } virtual void RecreateWidget() { CreateStatic(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnCheckOrRadioBox(wxCommandEvent& event); @@ -205,15 +208,13 @@ END_EVENT_TABLE() // ============================================================================ IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, _T("Static"), - (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS) + (int)wxPlatform(GENERIC_CTRLS).If(wxOS_WINDOWS,NATIVE_CTRLS) ); StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) - : WidgetsPage(book) + : WidgetsPage(book, imaglist, statbox_xpm) { - imaglist->Add(wxBitmap(statbox_xpm)); - // init everything m_chkVert = m_chkAutoResize = (wxCheckBox *)NULL; @@ -229,7 +230,10 @@ StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book, m_staticBox = (wxStaticBox *)NULL; m_sizerStatBox = (wxStaticBoxSizer *)NULL; m_sizerStatic = (wxSizer *)NULL; +} +void StaticWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -303,8 +307,6 @@ StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book, Reset(); SetSizer(sizerTop); - - sizerTop->Fit(this); } // ----------------------------------------------------------------------------