]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/button.cpp
Rebaked makefiles after htmllistbox and collapsable panel additions.
[wxWidgets.git] / samples / widgets / button.cpp
index 1056653e389a70b9e7e81886ba62ac7efa78c06b..c06a28bf6929a29a8423549ee6922fd5de410c45 100644 (file)
@@ -52,7 +52,7 @@
 // control ids
 enum
 {
 // control ids
 enum
 {
-    ButtonPage_Reset = 100,
+    ButtonPage_Reset = wxID_HIGHEST,
     ButtonPage_ChangeLabel,
     ButtonPage_Button
 };
     ButtonPage_ChangeLabel,
     ButtonPage_Button
 };
@@ -85,6 +85,9 @@ public:
     virtual wxControl *GetWidget() const { return m_button; }
     virtual void RecreateWidget() { CreateButton(); }
 
     virtual wxControl *GetWidget() const { return m_button; }
     virtual void RecreateWidget() { CreateButton(); }
 
+    // lazy creation of the content
+    virtual void CreateContent();
+
 protected:
     // event handlers
     void OnCheckOrRadioBox(wxCommandEvent& event);
 protected:
     // event handlers
     void OnCheckOrRadioBox(wxCommandEvent& event);
@@ -154,16 +157,18 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"),
-                       (int)wxPlatform(GENERIC_CTRLS).If(wxMSW,NATIVE_CTRLS)
-                       );
+#if defined(__WXUNIVERSAL__)
+    #define FAMILY_CTRLS UNIVERSAL_CTRLS
+#else
+    #define FAMILY_CTRLS NATIVE_CTRLS
+#endif
+
+IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"), FAMILY_CTRLS );
 
 ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
 
 ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
-                  : WidgetsPage(book)
+                  : WidgetsPage(book, imaglist, button_xpm)
 {
 {
-    imaglist->Add(wxBitmap(button_xpm));
-
     // init everything
     m_chkBitmap =
     m_chkImage =
     // init everything
     m_chkBitmap =
     m_chkImage =
@@ -181,7 +186,10 @@ ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
 
     m_button = (wxButton *)NULL;
     m_sizerButton = (wxSizer *)NULL;
 
     m_button = (wxButton *)NULL;
     m_sizerButton = (wxSizer *)NULL;
+}
 
 
+void ButtonWidgetsPage::CreateContent()
+{
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane