]> git.saurik.com Git - wxWidgets.git/commitdiff
cursor cleanup
authorStefan Csomor <csomor@advancedconcepts.ch>
Mon, 13 Jan 2003 19:19:35 +0000 (19:19 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Mon, 13 Jan 2003 19:19:35 +0000 (19:19 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@18713 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/toplevel.cpp
src/mac/carbon/utils.cpp
src/mac/carbon/window.cpp
src/mac/toplevel.cpp
src/mac/utils.cpp
src/mac/window.cpp

index e074c7fb31d6ad8be3e6464ec1776e31102db14a..66aadb583068f3c022a287dba0aabe1fbfb5b3cb 100644 (file)
@@ -59,10 +59,6 @@ wxWindowList       wxModelessWindows;
 static   Point     gs_lastWhere;
 static   long      gs_lastWhen = 0;
 
-// cursor stuff
-extern   int       wxBusyCursorCount;
-
-
 // ============================================================================
 // wxTopLevelWindowMac implementation
 // ============================================================================
@@ -535,7 +531,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
         if ( ev->what == mouseUp )
         {
             wxTheApp->s_captureWindow = NULL ;
-            if ( wxBusyCursorCount == 0 )
+            if ( !wxIsBusy() )
             {
                 m_cursor.MacInstall() ;
             }
index 7e68c37b03b670068dad02e4a2ed224fd244fb03..aae75333d7117258d6e46a5cc37e97212645e675 100644 (file)
@@ -317,49 +317,38 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
 }
 #endif // wxUSE_RESOURCES
 
-int wxBusyCursorCount = 0;
-extern CursHandle      gMacCurrentCursor ;
-CursHandle                     gMacStoredActiveCursor = NULL ;
+int gs_wxBusyCursorCount = 0;
+extern wxCursor        gMacCurrentCursor ;
+wxCursor               gMacStoredActiveCursor ;
 
 // Set the cursor to the busy cursor for all windows
 void wxBeginBusyCursor(wxCursor *cursor)
 {
-  wxBusyCursorCount ++;
-  if (wxBusyCursorCount == 1)
+  if (gs_wxBusyCursorCount++ == 0)
   {
        gMacStoredActiveCursor = gMacCurrentCursor ;
-               ::SetCursor( *::GetCursor( watchCursor ) ) ;
-  }
-  else
-  {
-        // TODO
+       cursor->MacInstall() ;
   }
+  //else: nothing to do, already set
 }
 
 // Restore cursor to normal
 void wxEndBusyCursor()
 {
-  if (wxBusyCursorCount == 0)
-    return;
+    wxCHECK_RET( gs_wxBusyCursorCount > 0,
+                 wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
 
-  wxBusyCursorCount --;
-  if (wxBusyCursorCount == 0)
+  if (--gs_wxBusyCursorCount == 0)
   {
-    if ( gMacStoredActiveCursor )
-       ::SetCursor( *gMacStoredActiveCursor ) ;
-    else
-    {
-               Cursor          MacArrow ;
-       ::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
-    }
-       gMacStoredActiveCursor = NULL ;
+       gMacStoredActiveCursor.MacInstall() ;
+       gMacStoredActiveCursor = wxNullCursor ;
   }
 }
 
 // TRUE if we're between the above two calls
 bool wxIsBusy()
 {
-  return (wxBusyCursorCount > 0);
+  return (gs_wxBusyCursorCount > 0);
 }
 
 wxString wxMacFindFolder( short        vol,
index 0528ad58db9902ea4016aa58df63421f190a3e15..61a23f38cbfcc2e2db8f438d7816db632a8fcd7d 100644 (file)
@@ -1478,7 +1478,6 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa
     return FALSE ;
 }
 
-extern int wxBusyCursorCount ;
 static wxWindow *gs_lastWhich = NULL;
 
 bool wxWindowMac::MacSetupCursor( const wxPoint& pt) 
index e074c7fb31d6ad8be3e6464ec1776e31102db14a..66aadb583068f3c022a287dba0aabe1fbfb5b3cb 100644 (file)
@@ -59,10 +59,6 @@ wxWindowList       wxModelessWindows;
 static   Point     gs_lastWhere;
 static   long      gs_lastWhen = 0;
 
-// cursor stuff
-extern   int       wxBusyCursorCount;
-
-
 // ============================================================================
 // wxTopLevelWindowMac implementation
 // ============================================================================
@@ -535,7 +531,7 @@ void wxTopLevelWindowMac::MacFireMouseEvent( WXEVENTREF evr )
         if ( ev->what == mouseUp )
         {
             wxTheApp->s_captureWindow = NULL ;
-            if ( wxBusyCursorCount == 0 )
+            if ( !wxIsBusy() )
             {
                 m_cursor.MacInstall() ;
             }
index 7e68c37b03b670068dad02e4a2ed224fd244fb03..aae75333d7117258d6e46a5cc37e97212645e675 100644 (file)
@@ -317,49 +317,38 @@ bool wxGetResource(const wxString& section, const wxString& entry, int *value, c
 }
 #endif // wxUSE_RESOURCES
 
-int wxBusyCursorCount = 0;
-extern CursHandle      gMacCurrentCursor ;
-CursHandle                     gMacStoredActiveCursor = NULL ;
+int gs_wxBusyCursorCount = 0;
+extern wxCursor        gMacCurrentCursor ;
+wxCursor               gMacStoredActiveCursor ;
 
 // Set the cursor to the busy cursor for all windows
 void wxBeginBusyCursor(wxCursor *cursor)
 {
-  wxBusyCursorCount ++;
-  if (wxBusyCursorCount == 1)
+  if (gs_wxBusyCursorCount++ == 0)
   {
        gMacStoredActiveCursor = gMacCurrentCursor ;
-               ::SetCursor( *::GetCursor( watchCursor ) ) ;
-  }
-  else
-  {
-        // TODO
+       cursor->MacInstall() ;
   }
+  //else: nothing to do, already set
 }
 
 // Restore cursor to normal
 void wxEndBusyCursor()
 {
-  if (wxBusyCursorCount == 0)
-    return;
+    wxCHECK_RET( gs_wxBusyCursorCount > 0,
+                 wxT("no matching wxBeginBusyCursor() for wxEndBusyCursor()") );
 
-  wxBusyCursorCount --;
-  if (wxBusyCursorCount == 0)
+  if (--gs_wxBusyCursorCount == 0)
   {
-    if ( gMacStoredActiveCursor )
-       ::SetCursor( *gMacStoredActiveCursor ) ;
-    else
-    {
-               Cursor          MacArrow ;
-       ::SetCursor( GetQDGlobalsArrow( &MacArrow ) ) ;
-    }
-       gMacStoredActiveCursor = NULL ;
+       gMacStoredActiveCursor.MacInstall() ;
+       gMacStoredActiveCursor = wxNullCursor ;
   }
 }
 
 // TRUE if we're between the above two calls
 bool wxIsBusy()
 {
-  return (wxBusyCursorCount > 0);
+  return (gs_wxBusyCursorCount > 0);
 }
 
 wxString wxMacFindFolder( short        vol,
index 0528ad58db9902ea4016aa58df63421f190a3e15..61a23f38cbfcc2e2db8f438d7816db632a8fcd7d 100644 (file)
@@ -1478,7 +1478,6 @@ bool wxWindowMac::MacGetWindowFromPoint( const wxPoint &screenpoint , wxWindowMa
     return FALSE ;
 }
 
-extern int wxBusyCursorCount ;
 static wxWindow *gs_lastWhich = NULL;
 
 bool wxWindowMac::MacSetupCursor( const wxPoint& pt)