diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index d9e4102a5a..2475913f79 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -78,6 +78,7 @@ enum Widgets_SetPageBg, Widgets_SetFont, Widgets_Enable, + Widgets_Show, Widgets_BorderNone, Widgets_BorderStatic, @@ -172,6 +173,7 @@ protected: void OnSetPageBg(wxCommandEvent& event); void OnSetFont(wxCommandEvent& event); void OnEnable(wxCommandEvent& event); + void OnShow(wxCommandEvent &event); void OnSetBorder(wxCommandEvent& event); void OnSetVariant(wxCommandEvent& event); @@ -297,6 +299,7 @@ wxBEGIN_EVENT_TABLE(WidgetsFrame, wxFrame) EVT_MENU(Widgets_SetPageBg, WidgetsFrame::OnSetPageBg) EVT_MENU(Widgets_SetFont, WidgetsFrame::OnSetFont) EVT_MENU(Widgets_Enable, WidgetsFrame::OnEnable) + EVT_MENU(Widgets_Show, WidgetsFrame::OnShow) EVT_MENU_RANGE(Widgets_BorderNone, Widgets_BorderDefault, WidgetsFrame::OnSetBorder) @@ -396,6 +399,7 @@ WidgetsFrame::WidgetsFrame(const wxString& title) menuWidget->Append(Widgets_SetPageBg, wxT("Set &page background...\tShift-Ctrl-B")); menuWidget->Append(Widgets_SetFont, wxT("Set f&ont...\tCtrl-O")); menuWidget->AppendCheckItem(Widgets_Enable, wxT("&Enable/disable\tCtrl-E")); + menuWidget->AppendCheckItem(Widgets_Show, wxT("Show/Hide")); wxMenu *menuBorders = new wxMenu; menuBorders->AppendRadioItem(Widgets_BorderDefault, wxT("De&fault\tCtrl-Shift-9")); @@ -447,6 +451,8 @@ WidgetsFrame::WidgetsFrame(const wxString& title) SetMenuBar(mbar); mbar->Check(Widgets_Enable, true); + mbar->Check(Widgets_Show, true); + mbar->Check(Widgets_VariantNormal, true); #endif // wxUSE_MENUS @@ -880,6 +886,13 @@ void WidgetsFrame::OnEnable(wxCommandEvent& event) CurrentPage()->SetUpWidget(); } +void WidgetsFrame::OnShow(wxCommandEvent &event) +{ + WidgetsPage::GetAttrs().m_show = event.IsChecked(); + + CurrentPage()->SetUpWidget(); +} + void WidgetsFrame::OnSetBorder(wxCommandEvent& event) { int border; @@ -1276,6 +1289,7 @@ void WidgetsPage::SetUpWidget() (*it)->SetLayoutDirection(GetAttrs().m_dir); (*it)->Enable(GetAttrs().m_enabled); + (*it)->Show(GetAttrs().m_show); if ( GetAttrs().m_cursor.IsOk() ) { diff --git a/samples/widgets/widgets.h b/samples/widgets/widgets.h index 4613bd7972..eb3bc2106a 100644 --- a/samples/widgets/widgets.h +++ b/samples/widgets/widgets.h @@ -98,6 +98,7 @@ struct WidgetAttributes m_tooltip = "This is a tooltip"; #endif // wxUSE_TOOLTIPS m_enabled = true; + m_show = true; m_dir = wxLayout_LeftToRight; m_variant = wxWINDOW_VARIANT_NORMAL; m_cursor = *wxSTANDARD_CURSOR; @@ -114,6 +115,7 @@ struct WidgetAttributes wxColour m_colBg; wxColour m_colPageBg; bool m_enabled; + bool m_show; wxLayoutDirection m_dir; wxWindowVariant m_variant; wxCursor m_cursor;