X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f7a546d9cb38a62a5d626b38e67bcc94f12a0fb..2d4511658de32250af399378ce4cd059adbc925d:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 628d0b76ec..fe4e04543c 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -111,7 +111,11 @@ #if wxUSE_MOUSEWHEEL #ifndef WM_MOUSEWHEEL #define WM_MOUSEWHEEL 0x020A + #endif + #ifndef WHEEL_DELTA #define WHEEL_DELTA 120 + #endif + #ifndef SPI_GETWHEELSCROLLLINES #define SPI_GETWHEELSCROLLLINES 104 #endif #endif @@ -375,7 +379,7 @@ wxWindow *wxWindowBase::FindFocus() HWND hWnd = ::GetFocus(); if ( hWnd ) { - return wxFindWinFromHandle((WXHWND) hWnd); + return wxGetWindowFromHWND((WXHWND)hWnd); } return NULL; @@ -392,7 +396,7 @@ bool wxWindow::Enable(bool enable) // VZ: no, this is a bad idea: imagine that you have a dialog with some // disabled controls and disable it - you really wouldn't like the - // disabled controls eb reenabled too when you reenable the dialog! + // disabled controls be reenabled too when you reenable the dialog! #if 0 wxWindowList::Node *node = GetChildren().GetFirst(); while ( node ) @@ -2222,10 +2226,29 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId) ; helpEvent.SetEventObject(this); processed = GetEventHandler()->ProcessEvent(helpEvent); + } else processed = FALSE; break; } + case WM_CONTEXTMENU: + { + HWND hWnd = (HWND) wParam; + + // we don't convert from screen to client coordinates as + // the event may be handled by a parent window + wxPoint p(LOWORD(lParam), HIWORD(lParam)); + + wxContextMenuEvent contextEvent(wxEVT_CONTEXT_MENU, GetId(), p); + GetEventHandler()->ProcessEvent(contextEvent); + + // set processed to true even if the event is not handled because if we don't + // windows will propogate the WM_CONTEXTMENU up the parent window chain, which + // we have already done ourselves. + processed = true; + + break; + } #endif } @@ -2479,11 +2502,10 @@ bool wxWindow::MSWCreate(int id, { int controlId = 0; if ( style & WS_CHILD ) - { controlId = id; - // all child windows should clip their siblings - // style |= /* WS_CLIPSIBLINGS */ ; - } + + if ( GetWindowStyleFlag() & wxCLIP_SIBLINGS ) + style |= WS_CLIPSIBLINGS; wxString className(wclass); if ( GetWindowStyleFlag() & wxNO_FULL_REPAINT_ON_RESIZE ) @@ -3351,7 +3373,7 @@ bool wxWindow::HandleMouseMove(int x, int y, WXUINT flags) if ( (m_lastMouseEvent == wxEVT_RIGHT_DOWN || m_lastMouseEvent == wxEVT_LEFT_DOWN || m_lastMouseEvent == wxEVT_MIDDLE_DOWN) && - (m_lastMouseX == event.m_x && m_lastMouseY == event.m_y) ) + (m_lastMouseX == x && m_lastMouseY == y) ) { m_lastMouseEvent = wxEVT_MOTION; @@ -3917,24 +3939,37 @@ extern wxWindow *wxGetWindowFromHWND(WXHWND hWnd) win = wxFindWinFromHandle((WXHWND)hwnd); if ( !win ) { - // the radiobox pointer is stored in GWL_USERDATA only under Win32 + // all these hacks only work under Win32 anyhow #ifdef __WIN32__ + +#if wxUSE_RADIOBOX // native radiobuttons return DLGC_RADIOBUTTON here and for any // wxWindow class which overrides WM_GETDLGCODE processing to // do it as well, win would be already non NULL - if ( ::SendMessage((HWND)hwnd, WM_GETDLGCODE, - 0, 0) & DLGC_RADIOBUTTON ) + if ( ::SendMessage(hwnd, WM_GETDLGCODE, 0, 0) & DLGC_RADIOBUTTON ) { win = (wxWindow *)::GetWindowLong(hwnd, GWL_USERDATA); } - else + //else: it's a wxRadioButton, not a radiobutton from wxRadioBox +#endif // wxUSE_RADIOBOX + + // spin control text buddy window should be mapped to spin ctrl + // itself so try it too +#if wxUSE_SPINCTRL + if ( !win ) + { + win = wxSpinCtrl::GetSpinForTextCtrl((WXHWND)hwnd); + } +#endif // wxUSE_SPINCTRL + #endif // Win32 + + if ( !win ) { // hwnd is not a wxWindow, try its parent next below hwnd = ::GetParent(hwnd); } } - //else: it's a wxRadioButton, not a radiobutton from wxRadioBox } while ( hwnd && !win )