From e32bcef6e78f78eb8d692d50ee3f3783f350b394 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Thu, 24 Aug 2006 20:26:59 +0000 Subject: [PATCH] added tests for setting the cursor git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40804 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/widgets/widgets.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/samples/widgets/widgets.cpp b/samples/widgets/widgets.cpp index b97c3e33a8..fdf3ceb1d9 100644 --- a/samples/widgets/widgets.cpp +++ b/samples/widgets/widgets.cpp @@ -82,6 +82,9 @@ enum Widgets_BorderDouble, Widgets_BorderDefault, + Widgets_GlobalBusyCursor, + Widgets_BusyCursor, + Widgets_GoToPage, Widgets_GoToPageLast = Widgets_GoToPage + 100 }; @@ -145,6 +148,9 @@ protected: void OnSetFont(wxCommandEvent& event); void OnEnable(wxCommandEvent& event); void OnSetBorder(wxCommandEvent& event); + + void OnToggleGlobalBusyCursor(wxCommandEvent& event); + void OnToggleBusyCursor(wxCommandEvent& event); #endif // wxUSE_MENUS // initialize the book: add all pages to it @@ -274,6 +280,9 @@ BEGIN_EVENT_TABLE(WidgetsFrame, wxFrame) EVT_MENU_RANGE(Widgets_BorderNone, Widgets_BorderDefault, WidgetsFrame::OnSetBorder) + EVT_MENU(Widgets_GlobalBusyCursor, WidgetsFrame::OnToggleGlobalBusyCursor) + EVT_MENU(Widgets_BusyCursor, WidgetsFrame::OnToggleBusyCursor) + EVT_MENU(wxID_EXIT, WidgetsFrame::OnExit) #endif // wxUSE_MENUS END_EVENT_TABLE() @@ -360,6 +369,12 @@ WidgetsFrame::WidgetsFrame(const wxString& title) menuBorders->AppendRadioItem(Widgets_BorderSunken, _T("S&unken\tCtrl-Shift-5")); menuWidget->AppendSubMenu(menuBorders, _T("Set &border")); + menuWidget->AppendSeparator(); + menuWidget->AppendCheckItem(Widgets_GlobalBusyCursor, + _T("Toggle &global busy cursor\tCtrl-Shift-U")); + menuWidget->AppendCheckItem(Widgets_BusyCursor, + _T("Toggle b&usy cursor\tCtrl-U")); + menuWidget->AppendSeparator(); menuWidget->Append(wxID_EXIT, _T("&Quit\tCtrl-Q")); mbar->Append(menuWidget, _T("&Widget")); @@ -822,6 +837,21 @@ void WidgetsFrame::OnSetBorder(wxCommandEvent& event) page->RecreateWidget(); } +void WidgetsFrame::OnToggleGlobalBusyCursor(wxCommandEvent& event) +{ + if ( event.IsChecked() ) + wxBeginBusyCursor(); + else + wxEndBusyCursor(); +} + +void WidgetsFrame::OnToggleBusyCursor(wxCommandEvent& event) +{ + WidgetsPage *page = CurrentPage(); + page->GetWidget()->SetCursor(*(event.IsChecked() ? wxHOURGLASS_CURSOR + : wxSTANDARD_CURSOR)); +} + #endif // wxUSE_MENUS // ---------------------------------------------------------------------------- -- 2.45.2