]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/button.cpp
remove file lists on exit
[wxWidgets.git] / samples / widgets / button.cpp
index 4a17b65be1d21ad794c65e1eefb4d0edc302a05c..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
 };
@@ -79,10 +79,14 @@ enum
 class ButtonWidgetsPage : public WidgetsPage
 {
 public:
 class ButtonWidgetsPage : public WidgetsPage
 {
 public:
-    ButtonWidgetsPage(wxBookCtrlBase *book, wxImageList *imaglist);
+    ButtonWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
     virtual ~ButtonWidgetsPage(){};
 
     virtual wxControl *GetWidget() const { return m_button; }
     virtual ~ButtonWidgetsPage(){};
 
     virtual wxControl *GetWidget() const { return m_button; }
+    virtual void RecreateWidget() { CreateButton(); }
+
+    // lazy creation of the content
+    virtual void CreateContent();
 
 protected:
     // event handlers
 
 protected:
     // event handlers
@@ -153,14 +157,18 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(ButtonWidgetsPage, _T("Button"));
+#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(wxBookCtrlBase *book,
+ButtonWidgetsPage::ButtonWidgetsPage(WidgetsBookCtrl *book,
                                      wxImageList *imaglist)
                                      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 =
@@ -178,7 +186,10 @@ ButtonWidgetsPage::ButtonWidgetsPage(wxBookCtrlBase *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
@@ -311,7 +322,7 @@ void ButtonWidgetsPage::CreateButton()
         label = m_textLabel->GetValue();
     }
 
         label = m_textLabel->GetValue();
     }
 
-    int flags = 0;
+    int flags = ms_defaultFlags;
     switch ( m_radioHAlign->GetSelection() )
     {
         case ButtonHAlign_Left:
     switch ( m_radioHAlign->GetSelection() )
     {
         case ButtonHAlign_Left:
@@ -341,7 +352,7 @@ void ButtonWidgetsPage::CreateButton()
             // fall through
 
         case ButtonVAlign_Centre:
             // fall through
 
         case ButtonVAlign_Centre:
-            flags |= wxALIGN_CENTRE_VERTICAL;
+            // centre vertical alignment is the default (no style)
             break;
 
         case ButtonVAlign_Bottom:
             break;
 
         case ButtonVAlign_Bottom: