]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/datepick.cpp
PCH support.
[wxWidgets.git] / samples / widgets / datepick.cpp
index b9aab44eebaf67953b144f93b5a8fc94fd5b3e79..f72112cf8b7a78bc71972fa034ea2361b39f1028 100644 (file)
@@ -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