fixed usage of LOWORD/HIWORD instead of GET_[XY]_LPARAM

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10251 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-05-21 00:17:04 +00:00
parent 889f0b7c67
commit 4cdc2c137e

View File

@@ -2201,55 +2201,61 @@ long wxWindow::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam)
rc.result = TRUE; rc.result = TRUE;
} }
break; break;
#ifdef __WIN32__ #ifdef __WIN32__
case WM_HELP: case WM_HELP:
{
HELPINFO* info = (HELPINFO*) lParam;
// Don't yet process menu help events, just windows
if (info->iContextType == HELPINFO_WINDOW)
{ {
wxWindow* subjectOfHelp = this; HELPINFO* info = (HELPINFO*) lParam;
bool eventProcessed = FALSE; // Don't yet process menu help events, just windows
while (subjectOfHelp && !eventProcessed) if (info->iContextType == HELPINFO_WINDOW)
{ {
wxHelpEvent helpEvent(wxEVT_HELP, subjectOfHelp->GetId(), wxPoint(info->MousePos.x, info->MousePos.y) ) ; // info->iCtrlId); wxWindow* subjectOfHelp = this;
helpEvent.SetEventObject(this); bool eventProcessed = FALSE;
eventProcessed = GetEventHandler()->ProcessEvent(helpEvent); while (subjectOfHelp && !eventProcessed)
{
wxHelpEvent helpEvent(wxEVT_HELP,
subjectOfHelp->GetId(),
wxPoint(info->MousePos.x,
info->MousePos.y) );
helpEvent.SetEventObject(this);
eventProcessed =
GetEventHandler()->ProcessEvent(helpEvent);
// Go up the window hierarchy until the event is handled (or not) // Go up the window hierarchy until the event is
subjectOfHelp = subjectOfHelp->GetParent(); // handled (or not)
subjectOfHelp = subjectOfHelp->GetParent();
}
processed = eventProcessed;
} }
processed = eventProcessed; else if (info->iContextType == HELPINFO_MENUITEM)
} {
else if (info->iContextType == HELPINFO_MENUITEM) wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId);
{ helpEvent.SetEventObject(this);
wxHelpEvent helpEvent(wxEVT_HELP, info->iCtrlId) ; processed = GetEventHandler()->ProcessEvent(helpEvent);
helpEvent.SetEventObject(this);
processed = GetEventHandler()->ProcessEvent(helpEvent);
}
//else: processed is already FALSE
} }
else processed = FALSE;
break; break;
}
case WM_CONTEXTMENU: 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
// we don't convert from screen to client coordinates as wxPoint pt(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
// the event may be handled by a parent window
wxPoint p(LOWORD(lParam), HIWORD(lParam)); wxContextMenuEvent evtCtx(wxEVT_CONTEXT_MENU, GetId(), pt);
GetEventHandler()->ProcessEvent(evtCtx);
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
// set processed to true even if the event is not handled because if we don't // WM_CONTEXTMENU up the parent window chain, which we have
// windows will propogate the WM_CONTEXTMENU up the parent window chain, which // already done ourselves.
// we have already done ourselves. processed = true;
processed = true; }
break; break;
} #endif // __WIN32__
#endif
} }
if ( !processed ) if ( !processed )
@@ -4006,8 +4012,9 @@ void wxSetKeyboardHook(bool doIt)
else else
{ {
UnhookWindowsHookEx(wxTheKeyboardHook); UnhookWindowsHookEx(wxTheKeyboardHook);
// avoids warning about statement with no effect (FreeProcInstance
// doesn't do anything under Win32) // avoids warning about statement with no effect (FreeProcInstance
// doesn't do anything under Win32)
#if !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(__NT__) && !defined(__GNUWIN32__) #if !defined(WIN32) && !defined(_WIN32) && !defined(__WIN32__) && !defined(__NT__) && !defined(__GNUWIN32__)
FreeProcInstance(wxTheKeyboardHookProc); FreeProcInstance(wxTheKeyboardHookProc);
#endif #endif