From eebe401675d1c558516d20506a4e43cccb36d182 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Karsten=20Ball=C3=BCder?= Date: Thu, 12 Aug 1999 15:36:50 +0000 Subject: [PATCH] Useful little fix that automatically hides the busy cursor in modal dialogs. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3360 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/cursor.h | 22 ++++++++++++++++++++++ modules | 9 ++------- src/gtk/dialog.cpp | 3 +++ src/gtk1/dialog.cpp | 3 +++ 4 files changed, 30 insertions(+), 7 deletions(-) diff --git a/include/wx/cursor.h b/include/wx/cursor.h index 2e793baa8a..f163125fa6 100644 --- a/include/wx/cursor.h +++ b/include/wx/cursor.h @@ -17,5 +17,27 @@ #include "wx/stubs/cursor.h" #endif +#include "wx/utils.h" +/* This is a small class which can be used by all ports + to temporarily suspend the busy cursor. Useful in modal + dialogs. +*/ +class wxBusyCursorSuspender +{ +public: + wxBusyCursorSuspender() + { + m_wasBusy = wxIsBusy(); + if(m_wasBusy) + wxEndBusyCursor(); + } + ~wxBusyCursorSuspender() + { + if(m_wasBusy) + wxBeginBusyCursor(); + } + private: + bool m_wasBusy; +}; #endif // _WX_CURSOR_H_BASE_ diff --git a/modules b/modules index 0a7d7da39c..f6f3a0de2a 100644 --- a/modules +++ b/modules @@ -1,14 +1,9 @@ wxGTK -a wxWindows !wxWindows/docs/latex \ - !wxWindows/docs/msw !wxWindows/docs/motif wxWindows/include/wx \ + !wxWindows/docs/msw !wxWindows/docs/motif \ !wxWindows/include/wx/msw !wxWindows/include/wx/motif !wxWindows/include/wx/qt \ !wxWindows/include/wx/stubs !wxWindows/src/msw !wxWindows/src/qt !wxWindows/src/motif \ !wxWindows/include/wx/mac wxWindows/src/jpeg \ - !wxWindows/src/stubs wxWindows/src/gdk_imlib wxWindows/src/generic wxWindows/src/common \ - wxWindows/src/png wxWindows/src/zlib wxWindows/src/gtk wxWindows/src/unix \ - wxWindows/lib wxWindows/src/gtk.inc wxWindows/setup \ - wxWindows/configure.in wxWindows/configure wxWindows/config.sub \ - wxWindows/config.guess wxWindows/wx-config.in wxWindows/src/Makefile wxWindows/src/Makefile.in \ - !wxWindows/misc !wxWindows/user !wxWindows/samples !wxWindows/utils + !wxWindows/src/stubs !wxWindows/misc !wxWindows/user !wxWindows/samples !wxWindows/utils wxQt -a wxWindows/Makefile wxWindows/install/unix wxWindows/install-sh \ wxWindows/template.mak wxWindows/docs !wxWindows/docs/latex !wxWindows/docs/msw \ diff --git a/src/gtk/dialog.cpp b/src/gtk/dialog.cpp index bed7d500ff..9812ec9c7b 100644 --- a/src/gtk/dialog.cpp +++ b/src/gtk/dialog.cpp @@ -18,6 +18,7 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" +#include "wx/cursor.h" //----------------------------------------------------------------------------- // idle system @@ -595,6 +596,8 @@ int wxDialog::ShowModal() return GetReturnCode(); } + wxBusyCursorSuspender cs; // temporarily suppress the busy cursor + Show( TRUE ); m_modalShowing = TRUE; diff --git a/src/gtk1/dialog.cpp b/src/gtk1/dialog.cpp index bed7d500ff..9812ec9c7b 100644 --- a/src/gtk1/dialog.cpp +++ b/src/gtk1/dialog.cpp @@ -18,6 +18,7 @@ #include "gdk/gdk.h" #include "gtk/gtk.h" #include "wx/gtk/win_gtk.h" +#include "wx/cursor.h" //----------------------------------------------------------------------------- // idle system @@ -595,6 +596,8 @@ int wxDialog::ShowModal() return GetReturnCode(); } + wxBusyCursorSuspender cs; // temporarily suppress the busy cursor + Show( TRUE ); m_modalShowing = TRUE; -- 2.47.2