X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/267a7108512069169a855457d027cd68fed5bf2e..2d19ad25782b1b370cd26d0f17d45856d201fc70:/src/msw/window.cpp diff --git a/src/msw/window.cpp b/src/msw/window.cpp index 84786c91e8..c7b28bac0b 100644 --- a/src/msw/window.cpp +++ b/src/msw/window.cpp @@ -2170,6 +2170,36 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam) rc.result = TRUE; } break; +#ifdef __WIN32__ + case WM_HELP: + { + HELPINFO* info = (HELPINFO*) lParam; + // Don't yet process menu help events, just windows + if (info->iContextType == HELPINFO_WINDOW) + { + wxWindow* subjectOfHelp = this; + bool eventProcessed = FALSE; + while (subjectOfHelp && !eventProcessed) + { + wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(), wxPoint(info->MousePos.x, info->MousePos.y) ) ; // info->iCtrlId); + helpEvent.SetEventObject(this); + eventProcessed = GetEventHandler()->ProcessEvent(helpEvent); + + // Go up the window hierarchy until the event is handled (or not) + subjectOfHelp = subjectOfHelp->GetParent(); + } + processed = eventProcessed; + } + else if (info->iContextType == HELPINFO_MENUITEM) + { + wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId) ; + helpEvent.SetEventObject(this); + processed = GetEventHandler()->ProcessEvent(helpEvent); + } + else processed = FALSE; + break; + } +#endif } if ( !processed ) @@ -2354,6 +2384,29 @@ bool wxWindow::MSWCreate(int id, return FALSE; } + if (extendedStyle != 0) + { + ::SetWindowLong(GetHwnd(), GWL_EXSTYLE, extendedStyle); + ::SetWindowPos(GetHwnd(), NULL, 0, 0, 0, 0, + SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_NOACTIVATE); + } +#if defined(__WIN95__) + // For some reason, the system menu is activated when we use the + // WS_EX_CONTEXTHELP style, so let's set a reasonable icon + if (extendedStyle & WS_EX_CONTEXTHELP) + { + if (wxTheApp->GetTopWindow() && (wxTheApp->GetTopWindow()->IsKindOf(CLASSINFO(wxFrame)))) + { + wxIcon icon = ((wxFrame*)wxTheApp->GetTopWindow())->GetIcon(); + if (icon.Ok()) + SendMessage(GetHwnd(), WM_SETICON, + (WPARAM)TRUE, (LPARAM)(HICON) icon.GetHICON()); + } + } +#endif // __WIN95__ + + + // JACS: is the following still necessary? The above seems to work. // ::SetWindowLong(GWL_EXSTYLE) doesn't work for the dialogs, so try // to take care of (at least some) extended style flags ourselves @@ -3173,7 +3226,7 @@ void wxWindow::InitMouseEvent(wxMouseEvent& event, int x, int y, WXUINT flags) event.m_leftDown = ((flags & MK_LBUTTON) != 0); event.m_middleDown = ((flags & MK_MBUTTON) != 0); event.m_rightDown = ((flags & MK_RBUTTON) != 0); - event.m_altDown = ::GetKeyState(VK_MENU) & 0x80000000; + event.m_altDown = (::GetKeyState(VK_MENU) & 0x80000000) != 0; event.SetTimestamp(s_currentMsg.time); event.m_eventObject = this; @@ -4331,3 +4384,38 @@ static TEXTMETRIC wxGetTextMetrics(const wxWindow *win) return tm; } + +// Find the wxWindow at the current mouse position, returning the mouse +// position. +wxWindow* wxFindWindowAtPointer(wxPoint& pt) +{ + return wxFindWindowAtPoint(wxGetMousePosition()); +} + +wxWindow* wxFindWindowAtPoint(const wxPoint& pt) +{ + POINT pt2; + pt2.x = pt.x; + pt2.y = pt.y; + HWND hWndHit = ::WindowFromPoint(pt2); + + wxWindow* win = wxFindWinFromHandle((WXHWND) hWndHit) ; + HWND hWnd = hWndHit; + + // Try to find a window with a wxWindow associated with it + while (!win && (hWnd != 0)) + { + hWnd = ::GetParent(hWnd); + win = wxFindWinFromHandle((WXHWND) hWnd) ; + } + return win; +} + +// Get the current mouse position. +wxPoint wxGetMousePosition() +{ + POINT pt; + GetCursorPos( & pt ); + return wxPoint(pt.x, pt.y); +} +