X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f2fdc4d56e41711ce7c547484bf97aa0c2bd997a..084ad0c2424aa998a640c151f8fa762435364449:/samples/widgets/datepick.cpp diff --git a/samples/widgets/datepick.cpp b/samples/widgets/datepick.cpp index 89e9173e2e..f72112cf8b 100644 --- a/samples/widgets/datepick.cpp +++ b/samples/widgets/datepick.cpp @@ -75,6 +75,9 @@ public: virtual wxControl *GetWidget() const { return m_datePicker; } virtual void RecreateWidget() { CreateDatePicker(); } + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnButtonSet(wxCommandEvent& event); @@ -119,17 +122,24 @@ END_EVENT_TABLE() // implementation // ============================================================================ +#if defined(__WXMSW__) + #define FAMILY_CTRLS NATIVE_CTRLS +#else + #define FAMILY_CTRLS GENERIC_CTRLS +#endif + IMPLEMENT_WIDGETS_PAGE(DatePickerWidgetsPage, wxT("DatePicker"), - (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS) - | PICKER_CTRLS + FAMILY_CTRLS | PICKER_CTRLS ); DatePickerWidgetsPage::DatePickerWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist) - :WidgetsPage(book) + :WidgetsPage(book, imaglist, datepick_xpm) { - imaglist->Add(wxBitmap(datepick_xpm)); +} +void DatePickerWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -137,17 +147,17 @@ DatePickerWidgetsPage::DatePickerWidgetsPage(WidgetsBookCtrl *book, wxSizer *sizerLeft = new wxStaticBoxSizer(box, wxVERTICAL); - sizerLeft->Add( CreateSizerWithTextAndLabel( wxT("&Day"), DatePickerPage_Day , &m_day ), - wxALL | wxALIGN_LEFT , 5 ); + sizerLeft->Add( CreateSizerWithTextAndLabel( wxT("&Day:"), DatePickerPage_Day , &m_day ), + 0, wxALL | wxALIGN_RIGHT , 5 ); - sizerLeft->Add( CreateSizerWithTextAndLabel( wxT("&Month"), DatePickerPage_Month , &m_month ), - wxALL | wxALIGN_LEFT , 5 ); + sizerLeft->Add( CreateSizerWithTextAndLabel( wxT("&Month:"), DatePickerPage_Month , &m_month ), + 0, wxALL | wxALIGN_RIGHT , 5 ); - sizerLeft->Add( CreateSizerWithTextAndLabel( wxT("&Year"), DatePickerPage_Year , &m_year ), - wxALL | wxALIGN_LEFT , 5 ); + sizerLeft->Add( CreateSizerWithTextAndLabel( wxT("&Year:"), DatePickerPage_Year , &m_year ), + 0, wxALL | wxALIGN_RIGHT , 5 ); sizerLeft->Add( new wxButton( this, wxID_ANY, wxT("&Set date") ), - wxALL , 5 ); + 0, wxALL , 5 ); // right pane wxSizer *sizerRight = new wxBoxSizer(wxHORIZONTAL);