SetCursor() works now

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@1779 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
1999-02-24 23:48:32 +00:00
parent db2150a19b
commit 1aff8b0241
4 changed files with 48 additions and 42 deletions

View File

@@ -346,7 +346,7 @@ bool wxApp::RegisterWindowClasses()
wndclass2.cbWndExtra = sizeof( DWORD ); // was 4 wndclass2.cbWndExtra = sizeof( DWORD ); // was 4
wndclass2.hInstance = wxhInstance; wndclass2.hInstance = wxhInstance;
wndclass2.hIcon = (HICON) NULL; wndclass2.hIcon = (HICON) NULL;
wndclass2.hCursor = (HCURSOR) NULL; wndclass2.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
// wndclass2.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1) ; // wndclass2.hbrBackground = (HBRUSH)(COLOR_BTNFACE+1) ;
wndclass2.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH ); wndclass2.hbrBackground = (HBRUSH) GetStockObject( LTGRAY_BRUSH );
wndclass2.lpszMenuName = NULL; wndclass2.lpszMenuName = NULL;
@@ -371,7 +371,7 @@ bool wxApp::RegisterWindowClasses()
wndclass3.cbWndExtra = sizeof( DWORD ); // was 4 wndclass3.cbWndExtra = sizeof( DWORD ); // was 4
wndclass3.hInstance = wxhInstance; wndclass3.hInstance = wxhInstance;
wndclass3.hIcon = (HICON) NULL; wndclass3.hIcon = (HICON) NULL;
wndclass3.hCursor = (HCURSOR) NULL; wndclass3.hCursor = LoadCursor( (HINSTANCE) NULL, IDC_ARROW );
// wndclass3.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ; // wndclass3.hbrBackground = (HBRUSH)(COLOR_WINDOW+1) ;
wndclass3.hbrBackground = (HBRUSH) NULL; wndclass3.hbrBackground = (HBRUSH) NULL;
wndclass3.lpszMenuName = NULL; wndclass3.lpszMenuName = NULL;

View File

@@ -460,12 +460,12 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
// It's a labelled toggle // It's a labelled toggle
textRadioButton = wxGetWindowText(m_radioButtons[i]); textRadioButton = wxGetWindowText(m_radioButtons[i]);
GetTextExtent(textRadioButton, &current_width, &cyf, GetTextExtent(textRadioButton, &current_width, &cyf,
NULL,NULL, & this->GetFont()); NULL, NULL, &GetFont());
if ( calcWidth ) if ( calcWidth )
eachWidth = (int)(current_width + RADIO_SIZE); eachWidth = current_width + RADIO_SIZE;
if ( calcHeight ) if ( calcHeight )
eachHeight = (int)((3*cyf)/2); eachHeight = (3*cyf)/2;
} }
else else
{ {
@@ -500,7 +500,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
totHeight = nbVer * (maxHeight+cy1/2) ; totHeight = nbVer * (maxHeight+cy1/2) ;
totWidth = nbHor * (maxWidth+cx1) ; totWidth = nbHor * (maxWidth+cx1) ;
#if (!wxUSE_CTL3D) #if !defined(__WIN32__) && (!wxUSE_CTL3D)
// Requires a bigger group box in plain Windows // Requires a bigger group box in plain Windows
MoveWindow((HWND) m_hWnd,x_offset,y_offset,totWidth+cx1,totHeight+(3*cy1)/2,TRUE) ; MoveWindow((HWND) m_hWnd,x_offset,y_offset,totWidth+cx1,totHeight+(3*cy1)/2,TRUE) ;
#else #else
@@ -510,7 +510,7 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
y_offset += cy1; y_offset += cy1;
} }
#if (!wxUSE_CTL3D) #if !defined(__WIN32__) && (!wxUSE_CTL3D)
y_offset += (int)(cy1/2); // Fudge factor since buttons overlapped label y_offset += (int)(cy1/2); // Fudge factor since buttons overlapped label
// JACS 2/12/93. CTL3D draws group label quite high. // JACS 2/12/93. CTL3D draws group label quite high.
#endif #endif
@@ -535,19 +535,19 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
y_offset += cy1/2 ; y_offset += cy1/2 ;
} }
} }
int eachWidth ;
int eachHeight ; int eachWidth;
if (m_radioWidth[i]<0) int eachHeight;
if ( m_radioWidth[i] < 0 )
{ {
// It's a labeled item // It's a labeled item
textRadioButton = wxGetWindowText(m_radioButtons[i]); textRadioButton = wxGetWindowText(m_radioButtons[i]);
GetTextExtent(textRadioButton, &current_width, &cyf, GetTextExtent(textRadioButton, &current_width, &cyf,
NULL,NULL, & this->GetFont()); NULL,NULL, & this->GetFont());
// How do we find out radio button bitmap size!! eachWidth = current_width + RADIO_SIZE;
// By adjusting them carefully, manually :-) eachHeight = (3*cyf)/2;
eachWidth = (int)(current_width + RADIO_SIZE);
eachHeight = (int)((3*cyf)/2);
} }
else else
{ {
@@ -555,15 +555,19 @@ void wxRadioBox::SetSize(int x, int y, int width, int height, int sizeFlags)
eachHeight = m_radioHeight[i] ; 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) if (m_windowStyle & wxRA_SPECIFY_ROWS)
{ {
y_offset += maxHeight; y_offset += maxHeight;
if (m_radioWidth[0]>0) if ( m_radioWidth[0] > 0 )
y_offset += cy1/2 ; y_offset += cy1/2 ;
} }
else else
{
x_offset += maxWidth + cx1; x_offset += maxWidth + cx1;
}
} }
} }
#endif #endif

View File

@@ -537,7 +537,6 @@ void wxEndBusyCursor()
wxCHECK_RET( gs_wxBusyCursorCount > 0, wxCHECK_RET( gs_wxBusyCursorCount > 0,
"no matching wxBeginBusyCursor() for wxEndBusyCursor()" ); "no matching wxBeginBusyCursor() for wxEndBusyCursor()" );
gs_wxBusyCursorCount--;
if ( --gs_wxBusyCursorCount == 0 ) if ( --gs_wxBusyCursorCount == 0 )
{ {
::SetCursor(gs_wxBusyCursorOld); ::SetCursor(gs_wxBusyCursorOld);

View File

@@ -239,7 +239,6 @@ void wxWindow::Init()
m_windowStyle = 0; m_windowStyle = 0;
m_windowParent = NULL; m_windowParent = NULL;
m_windowEventHandler = this; m_windowEventHandler = this;
m_windowCursor = *wxSTANDARD_CURSOR;
m_children = new wxList; m_children = new wxList;
m_doubleClickAllowed = 0 ; m_doubleClickAllowed = 0 ;
m_winCaptured = FALSE; m_winCaptured = FALSE;
@@ -1487,33 +1486,42 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
case WM_SETCURSOR: case WM_SETCURSOR:
{ {
HCURSOR hcursor = 0; // don't set cursor when the mouse is not in the client part
if ( wxIsBusy() ) 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; hcursor = gs_wxBusyCursor;
} }
else else if ( m_windowCursor.Ok() )
{ {
extern wxCursor *g_globalCursor; // from msw\data.cpp hcursor = (HCURSOR)m_windowCursor.GetHCURSOR();
}
else
{
extern wxCursor *g_globalCursor; // from msw\data.cpp
if ( g_globalCursor && g_globalCursor->Ok() ) if ( g_globalCursor && g_globalCursor->Ok() )
hcursor = (HCURSOR)g_globalCursor->GetHCURSOR(); hcursor = (HCURSOR)g_globalCursor->GetHCURSOR();
} }
if ( hcursor ) if ( hcursor )
{ {
::SetCursor(hcursor); ::SetCursor(hcursor);
// returning TRUE stops the DefWindowProc() from further // returning TRUE stops the DefWindowProc() from further
// processing this message - exactly what we need because we've // processing this message - exactly what we need because
// just set the cursor // we've just set the cursor
return TRUE; return TRUE;
}
} }
} }
break; // leave it to DefWindowProc() return MSWDefWindowProc(message, wParam, lParam );
default: default:
return MSWDefWindowProc(message, wParam, lParam ); 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) void wxWindow::MSWOnMouseMove(int x, int y, WXUINT flags)
{ {
// 'normal' move event... // '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) if (!m_mouseInWindow)
{ {