diff --git a/src/msw/app.cpp b/src/msw/app.cpp index 055aa2f3b1..91d1c05287 100644 --- a/src/msw/app.cpp +++ b/src/msw/app.cpp @@ -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; diff --git a/src/msw/radiobox.cpp b/src/msw/radiobox.cpp index 66ee17fea5..0351dbd19d 100644 --- a/src/msw/radiobox.cpp +++ b/src/msw/radiobox.cpp @@ -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, ¤t_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, ¤t_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 diff --git a/src/msw/utils.cpp b/src/msw/utils.cpp index 0f5ebc51ab..d2d584162b 100644 --- a/src/msw/utils.cpp +++ b/src/msw/utils.cpp @@ -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); diff --git a/src/msw/window.cpp b/src/msw/window.cpp index de29a1e22d..f2e428fccd 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -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) {