]> git.saurik.com Git - wxWidgets.git/commitdiff
SetCursor() works now
authorVadim Zeitlin <vadim@wxwidgets.org>
Wed, 24 Feb 1999 23:48:32 +0000 (23:48 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Wed, 24 Feb 1999 23:48:32 +0000 (23:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1779 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/app.cpp
src/msw/radiobox.cpp
src/msw/utils.cpp
src/msw/window.cpp

index 055aa2f3b19cfe923411fbf1535291ac667d4bb1..91d1c05287ec05e8cf8945ac2626e85b5e0cd579 100644 (file)
@@ -346,7 +346,7 @@ bool wxApp::RegisterWindowClasses()
     wndclass2.cbWndExtra    = sizeof( DWORD ); // was 4
     wndclass2.hInstance     = wxhInstance;
     wndclass2.hIcon         = (HICON) NULL;
-    wndclass2.hCursor       = (HCURSOR) NULL;
+    wndclass2.hCursor       = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
     //  wndclass2.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1) ;
     wndclass2.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
     wndclass2.lpszMenuName  = NULL;
@@ -371,7 +371,7 @@ bool wxApp::RegisterWindowClasses()
     wndclass3.cbWndExtra    = sizeof( DWORD ); // was 4
     wndclass3.hInstance     = wxhInstance;
     wndclass3.hIcon         = (HICON) NULL;
-    wndclass3.hCursor       = (HCURSOR) NULL;
+    wndclass3.hCursor       = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
     //  wndclass3.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ;
     wndclass3.hbrBackground = (HBRUSH) NULL;
     wndclass3.lpszMenuName  = NULL;
index 66ee17fea5148b1a85e495c00c8267c815396b31..0351dbd19df230f502a6a3246d24d0413534b11d 100644 (file)
@@ -460,12 +460,12 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
                 // It's a labelled toggle
                 textRadioButton = wxGetWindowText(m_radioButtons[i]);
                 GetTextExtent(textRadioButton, &current_width, &cyf,
-                        NULL,NULL, & this->GetFont());
+                              NULL, NULL, &GetFont());
 
                 if ( calcWidth )
-                    eachWidth = (int)(current_width + RADIO_SIZE);
+                    eachWidth = current_width + RADIO_SIZE;
                 if ( calcHeight )
-                    eachHeight = (int)((3*cyf)/2);
+                    eachHeight = (3*cyf)/2;
             }
             else
             {
@@ -500,7 +500,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
             totHeight = nbVer * (maxHeight+cy1/2) ;
         totWidth  = nbHor * (maxWidth+cx1) ;
 
-#if (!wxUSE_CTL3D)
+#if !defined(__WIN32__) && (!wxUSE_CTL3D)
         // Requires a bigger group box in plain Windows
         MoveWindow((HWND) m_hWnd,x_offset,y_offset,totWidth+cx1,totHeight+(3*cy1)/2,TRUE) ;
 #else
@@ -510,7 +510,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
         y_offset += cy1;
     }
 
-#if (!wxUSE_CTL3D)
+#if !defined(__WIN32__) && (!wxUSE_CTL3D)
     y_offset += (int)(cy1/2); // Fudge factor since buttons overlapped label
     // JACS 2/12/93. CTL3D draws group label quite high.
 #endif
@@ -535,19 +535,19 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
                     y_offset += cy1/2 ;
             }
         }
-        int eachWidth ;
-        int eachHeight ;
-        if (m_radioWidth[i]<0)
+
+        int eachWidth;
+        int eachHeight;
+
+        if ( m_radioWidth[i] < 0 )
         {
             // It's a labeled item
             textRadioButton = wxGetWindowText(m_radioButtons[i]);
             GetTextExtent(textRadioButton, &current_width, &cyf,
                           NULL,NULL, & this->GetFont());
 
-            // How do we find out radio button bitmap size!!
-            // By adjusting them carefully, manually :-)
-            eachWidth = (int)(current_width + RADIO_SIZE);
-            eachHeight = (int)((3*cyf)/2);
+            eachWidth = current_width + RADIO_SIZE;
+            eachHeight = (3*cyf)/2;
         }
         else
         {
@@ -555,15 +555,19 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
             eachHeight = m_radioHeight[i] ;
         }
 
-        MoveWindow((HWND) m_radioButtons[i],x_offset,y_offset,eachWidth,eachHeight,TRUE);
+        MoveWindow((HWND)m_radioButtons[i], x_offset, y_offset,
+                   eachWidth,eachHeight,TRUE);
+        if ( m_windowStyle & wxRA_VERTICAL )
         if (m_windowStyle & wxRA_SPECIFY_ROWS)
         {
             y_offset += maxHeight;
-            if (m_radioWidth[0]>0)
+            if ( m_radioWidth[0] > 0 )
                 y_offset += cy1/2 ;
         }
         else
+        {
             x_offset += maxWidth + cx1;
+        }
     }
 }
 #endif
index 0f5ebc51abc8cb85d755685c2973cf9607efa4ca..d2d584162bf5de8aac0fc8c5057a70f13d094270 100644 (file)
@@ -537,7 +537,6 @@ void wxEndBusyCursor()
     wxCHECK_RET( gs_wxBusyCursorCount > 0,
                  "no matching wxBeginBusyCursor() for wxEndBusyCursor()" );
 
-    gs_wxBusyCursorCount--;
     if ( --gs_wxBusyCursorCount == 0 )
     {
         ::SetCursor(gs_wxBusyCursorOld);
index de29a1e22d687f6b79c336f7dc9057276f47a792..f2e428fccd2f05df737e83688c5bf8ad5de3bb92 100644 (file)
@@ -239,7 +239,6 @@ void wxWindow::Init()
     m_windowStyle = 0;
     m_windowParent = NULL;
     m_windowEventHandler = this;
-    m_windowCursor = *wxSTANDARD_CURSOR;
     m_children = new wxList;
     m_doubleClickAllowed = 0 ;
     m_winCaptured = FALSE;
@@ -1487,33 +1486,42 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
 
     case WM_SETCURSOR:
         {
-            HCURSOR hcursor = 0;
-            if ( wxIsBusy() )
+            // don't set cursor when the mouse is not in the client part
+            short nHitTest = LOWORD(lParam);
+            if ( nHitTest == HTCLIENT || nHitTest == HTERROR )
             {
-                extern HCURSOR gs_wxBusyCursor; // from msw\utils.cpp
+                HCURSOR hcursor = 0;
+                if ( wxIsBusy() )
+                {
+                    extern HCURSOR gs_wxBusyCursor; // from msw\utils.cpp
 
-                hcursor = gs_wxBusyCursor;
-            }
-            else
-            {
-                extern wxCursor *g_globalCursor; // from msw\data.cpp
+                    hcursor = gs_wxBusyCursor;
+                }
+                else if ( m_windowCursor.Ok() )
+                {
+                    hcursor = (HCURSOR)m_windowCursor.GetHCURSOR();
+                }
+                else
+                {
+                    extern wxCursor *g_globalCursor; // from msw\data.cpp
 
-                if ( g_globalCursor && g_globalCursor->Ok() )
-                    hcursor = (HCURSOR)g_globalCursor->GetHCURSOR();
-            }
+                    if ( g_globalCursor && g_globalCursor->Ok() )
+                        hcursor = (HCURSOR)g_globalCursor->GetHCURSOR();
+                }
 
-            if ( hcursor )
-            {
-                ::SetCursor(hcursor);
+                if ( hcursor )
+                {
+                    ::SetCursor(hcursor);
 
-                // returning TRUE stops the DefWindowProc() from further
-                // processing this message - exactly what we need because we've
-                // just set the cursor
-                return TRUE;
+                    // returning TRUE stops the DefWindowProc() from further
+                    // processing this message - exactly what we need because
+                    // we've just set the cursor
+                    return TRUE;
+                }
             }
         }
 
-        break;  // leave it to DefWindowProc()
+        return MSWDefWindowProc(message, wParam, lParam );
 
     default:
         return MSWDefWindowProc(message, wParam, lParam );
@@ -2429,11 +2437,6 @@ void wxWindow::MSWOnRButtonDClick(int x, int y, WXUINT flags)
 void wxWindow::MSWOnMouseMove(int x, int y, WXUINT flags)
 {
     // 'normal' move event...
-    // Set cursor, but only if we're not in 'busy' mode
-
-    // Trouble with this is that it sets the cursor for controls too :-(
-    if (m_windowCursor.Ok() && !wxIsBusy())
-        ::SetCursor((HCURSOR) m_windowCursor.GetHCURSOR());
 
     if (!m_mouseInWindow)
     {