X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/efb349e4f321856db92535f05d92ac7e24d49124..a87f2821adee59d00f99cad1f9bcf61b0accbcb6:/samples/widgets/gauge.cpp diff --git a/samples/widgets/gauge.cpp b/samples/widgets/gauge.cpp index d887d13754..7093f874c4 100644 --- a/samples/widgets/gauge.cpp +++ b/samples/widgets/gauge.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Program: wxWindows Widgets Sample +// Program: wxWidgets Widgets Sample // Name: gauge.cpp // Purpose: Part of the widgets sample showing wxGauge // Author: Vadim Zeitlin @@ -52,7 +52,7 @@ // control ids enum { - GaugePage_Reset = 100, + GaugePage_Reset = wxID_HIGHEST, GaugePage_Progress, GaugePage_Clear, GaugePage_SetValue, @@ -71,9 +71,15 @@ enum class GaugeWidgetsPage : public WidgetsPage { public: - GaugeWidgetsPage(wxNotebook *notebook, wxImageList *imaglist); + GaugeWidgetsPage(WidgetsBookCtrl *book, wxImageList *imaglist); virtual ~GaugeWidgetsPage(); + virtual wxControl *GetWidget() const { return m_gauge; } + virtual void RecreateWidget() { CreateGauge(); } + + // lazy creation of the content + virtual void CreateContent(); + protected: // event handlers void OnButtonReset(wxCommandEvent& event); @@ -154,14 +160,18 @@ END_EVENT_TABLE() // implementation // ============================================================================ -IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge")); +#if defined(__WXUNIVERSAL__) + #define FAMILY_CTRLS UNIVERSAL_CTRLS +#else + #define FAMILY_CTRLS NATIVE_CTRLS +#endif -GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook, - wxImageList *imaglist) - : WidgetsPage(notebook) -{ - imaglist->Add(wxBitmap(gauge_xpm)); +IMPLEMENT_WIDGETS_PAGE(GaugeWidgetsPage, _T("Gauge"), FAMILY_CTRLS ); +GaugeWidgetsPage::GaugeWidgetsPage(WidgetsBookCtrl *book, + wxImageList *imaglist) + :WidgetsPage(book, imaglist, gauge_xpm) +{ // init everything m_range = 100; @@ -172,7 +182,10 @@ GaugeWidgetsPage::GaugeWidgetsPage(wxNotebook *notebook, m_gauge = (wxGauge *)NULL; m_sizerGauge = (wxSizer *)NULL; +} +void GaugeWidgetsPage::CreateContent() +{ wxSizer *sizerTop = new wxBoxSizer(wxHORIZONTAL); // left pane @@ -257,7 +270,7 @@ void GaugeWidgetsPage::Reset() void GaugeWidgetsPage::CreateGauge() { - int flags = 0; + int flags = ms_defaultFlags; if ( m_chkVert->GetValue() ) flags |= wxGA_VERTICAL;