]> git.saurik.com Git - wxWidgets.git/blobdiff - samples/widgets/static.cpp
Correct 'markup' for GetResourceHandle after recent change in wx/gdiobj.h.
[wxWidgets.git] / samples / widgets / static.cpp
index f8872d648d6990b38d628e88fdc2490adb965f44..fe33e6667cab7b31b650bea5838380c3e0234d77 100644 (file)
@@ -51,7 +51,7 @@
 // control ids
 enum
 {
 // control ids
 enum
 {
-    StaticPage_Reset = 100,
+    StaticPage_Reset = wxID_HIGHEST,
     StaticPage_BoxText,
     StaticPage_LabelText
 };
     StaticPage_BoxText,
     StaticPage_LabelText
 };
@@ -139,8 +139,14 @@ END_EVENT_TABLE()
 class StaticWidgetsPage : public WidgetsPage
 {
 public:
 class StaticWidgetsPage : public WidgetsPage
 {
 public:
-    StaticWidgetsPage(wxNotebook *notebook, wxImageList *imaglist);
-    virtual ~StaticWidgetsPage();
+    StaticWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist);
+    virtual ~StaticWidgetsPage(){};
+
+    virtual wxControl *GetWidget() const { return m_statText; }
+    virtual void RecreateWidget() { CreateStatic(); }
+
+    // lazy creation of the content
+    virtual void CreateContent();
 
 protected:
     // event handlers
 
 protected:
     // event handlers
@@ -170,7 +176,9 @@ protected:
     wxStaticBox *m_staticBox;
     wxStaticBoxSizer *m_sizerStatBox;
     wxStaticText *m_statText;
     wxStaticBox *m_staticBox;
     wxStaticBoxSizer *m_sizerStatBox;
     wxStaticText *m_statText;
+#if wxUSE_STATLINE
     wxStaticLine *m_statLine;
     wxStaticLine *m_statLine;
+#endif // wxUSE_STATLINE
     wxSizer *m_sizerStatic;
 
     // the text entries for command parameters
     wxSizer *m_sizerStatic;
 
     // the text entries for command parameters
@@ -199,14 +207,14 @@ END_EVENT_TABLE()
 // implementation
 // ============================================================================
 
 // implementation
 // ============================================================================
 
-IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, _T("Static"));
+IMPLEMENT_WIDGETS_PAGE(StaticWidgetsPage, _T("Static"),
+                       (int)wxPlatform(GENERIC_CTRLS).If(wxOS_WINDOWS,NATIVE_CTRLS)
+                       );
 
 
-StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook,
-                                       wxImageList *imaglist)
-                  : WidgetsPage(notebook)
+StaticWidgetsPage::StaticWidgetsPage(WidgetsBookCtrl *book,
+                                     wxImageList *imaglist)
+                  : WidgetsPage(book, imaglist, statbox_xpm)
 {
 {
-    imaglist->Add(wxBitmap(statbox_xpm));
-
     // init everything
     m_chkVert =
     m_chkAutoResize = (wxCheckBox *)NULL;
     // init everything
     m_chkVert =
     m_chkAutoResize = (wxCheckBox *)NULL;
@@ -214,13 +222,18 @@ StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook,
     m_radioHAlign =
     m_radioVAlign = (wxRadioBox *)NULL;
 
     m_radioHAlign =
     m_radioVAlign = (wxRadioBox *)NULL;
 
+#if wxUSE_STATLINE
     m_statLine = (wxStaticLine *)NULL;
     m_statLine = (wxStaticLine *)NULL;
+#endif // wxUSE_STATLINE
     m_statText = (wxStaticText *)NULL;
 
     m_staticBox = (wxStaticBox *)NULL;
     m_sizerStatBox = (wxStaticBoxSizer *)NULL;
     m_sizerStatic = (wxSizer *)NULL;
     m_statText = (wxStaticText *)NULL;
 
     m_staticBox = (wxStaticBox *)NULL;
     m_sizerStatBox = (wxStaticBoxSizer *)NULL;
     m_sizerStatic = (wxSizer *)NULL;
+}
 
 
+void StaticWidgetsPage::CreateContent()
+{
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
     wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL);
 
     // left pane
@@ -298,10 +311,6 @@ StaticWidgetsPage::StaticWidgetsPage(wxNotebook *notebook,
     sizerTop->Fit(this);
 }
 
     sizerTop->Fit(this);
 }
 
-StaticWidgetsPage::~StaticWidgetsPage()
-{
-}
-
 // ----------------------------------------------------------------------------
 // operations
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // operations
 // ----------------------------------------------------------------------------
@@ -325,11 +334,13 @@ void StaticWidgetsPage::CreateStatic()
         // delete m_sizerStatBox; -- deleted by Remove()
         m_sizerStatic->Remove(m_sizerStatBox);
         delete m_statText;
         // delete m_sizerStatBox; -- deleted by Remove()
         m_sizerStatic->Remove(m_sizerStatBox);
         delete m_statText;
+#if wxUSE_STATLINE
         delete m_statLine;
         delete m_statLine;
+#endif // wxUSE_STATLINE
     }
 
     int flagsBox = 0,
     }
 
     int flagsBox = 0,
-        flagsText = 0;
+        flagsText = ms_defaultFlags;
 
     if ( !m_chkAutoResize->GetValue() )
     {
 
     if ( !m_chkAutoResize->GetValue() )
     {
@@ -388,12 +399,16 @@ void StaticWidgetsPage::CreateStatic()
                                   wxDefaultPosition, wxDefaultSize,
                                   flagsText);
 
                                   wxDefaultPosition, wxDefaultSize,
                                   flagsText);
 
+#if wxUSE_STATLINE
     m_statLine = new wxStaticLine(this, wxID_ANY,
                                   wxDefaultPosition, wxDefaultSize,
                                   isVert ? wxLI_VERTICAL : wxLI_HORIZONTAL);
     m_statLine = new wxStaticLine(this, wxID_ANY,
                                   wxDefaultPosition, wxDefaultSize,
                                   isVert ? wxLI_VERTICAL : wxLI_HORIZONTAL);
+#endif // wxUSE_STATLINE
 
     m_sizerStatBox->Add(m_statText, 1, wxGROW | wxALL, 5);
 
     m_sizerStatBox->Add(m_statText, 1, wxGROW | wxALL, 5);
+#if wxUSE_STATLINE
     m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxALL, 5);
     m_sizerStatBox->Add(m_statLine, 0, wxGROW | wxALL, 5);
+#endif // wxUSE_STATLINE
     m_sizerStatBox->Add(0, 0, 1);
 
     m_sizerStatic->Add(m_sizerStatBox, 1, wxGROW);
     m_sizerStatBox->Add(0, 0, 1);
 
     m_sizerStatic->Add(m_sizerStatBox, 1, wxGROW);