linking fixes and code cleanup after hotkey patch
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -177,11 +177,11 @@ public:
|
||||
wxWindow* GetWindowChild(wxWindowID id);
|
||||
#endif // __WXUNIVERSAL__
|
||||
|
||||
#if wxUSE_ACCEL
|
||||
#if wxUSE_HOTKEY
|
||||
// install and deinstall a system wide hotkey
|
||||
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode);
|
||||
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode);
|
||||
virtual bool UnregisterHotKey(int hotkeyId);
|
||||
#endif
|
||||
#endif // wxUSE_HOTKEY
|
||||
|
||||
// implementation from now on
|
||||
// --------------------------
|
||||
|
@@ -517,12 +517,17 @@ public:
|
||||
wxAcceleratorTable *GetAcceleratorTable()
|
||||
{ return &m_acceleratorTable; }
|
||||
|
||||
// install and deinstall a system wide hotkey
|
||||
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode);
|
||||
virtual bool UnregisterHotKey(int hotkeyId);
|
||||
|
||||
#endif // wxUSE_ACCEL
|
||||
|
||||
#if wxUSE_HOTKEY
|
||||
// hot keys (system wide accelerators)
|
||||
// -----------------------------------
|
||||
|
||||
virtual bool RegisterHotKey(int hotkeyId, int modifiers, int keycode);
|
||||
virtual bool UnregisterHotKey(int hotkeyId);
|
||||
#endif // wxUSE_HOTKEY
|
||||
|
||||
|
||||
// dialog units translations
|
||||
// -------------------------
|
||||
|
||||
|
@@ -2107,18 +2107,23 @@ void wxWindowBase::ReleaseMouse()
|
||||
}
|
||||
|
||||
#if wxUSE_HOTKEY
|
||||
bool wxWindowBase::RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode)
|
||||
|
||||
bool
|
||||
wxWindowBase::RegisterHotKey(int WXUNUSED(hotkeyId),
|
||||
int WXUNUSED(modifiers),
|
||||
int WXUNUSED(keycode))
|
||||
{
|
||||
// not implemented
|
||||
return false;
|
||||
}
|
||||
|
||||
bool wxWindowBase::UnregisterHotKey(int hotkeyId)
|
||||
bool wxWindowBase::UnregisterHotKey(int WXUNUSED(hotkeyId))
|
||||
{
|
||||
// not implemented
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // wxUSE_HOTKEY
|
||||
|
||||
void wxWindowBase::SendDestroyEvent()
|
||||
{
|
||||
|
@@ -2170,21 +2170,21 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
|
||||
break;
|
||||
|
||||
case WM_MOVING:
|
||||
{
|
||||
LPRECT pRect = (LPRECT)lParam;
|
||||
wxRect rc;
|
||||
rc.SetLeft(pRect->left);
|
||||
rc.SetTop(pRect->top);
|
||||
rc.SetRight(pRect->right);
|
||||
rc.SetBottom(pRect->bottom);
|
||||
processed = HandleMoving(rc);
|
||||
if (processed) {
|
||||
pRect->left = rc.GetLeft();
|
||||
pRect->top = rc.GetTop();
|
||||
pRect->right = rc.GetRight();
|
||||
pRect->bottom = rc.GetBottom();
|
||||
}
|
||||
}
|
||||
{
|
||||
LPRECT pRect = (LPRECT)lParam;
|
||||
wxRect rc;
|
||||
rc.SetLeft(pRect->left);
|
||||
rc.SetTop(pRect->top);
|
||||
rc.SetRight(pRect->right);
|
||||
rc.SetBottom(pRect->bottom);
|
||||
processed = HandleMoving(rc);
|
||||
if (processed) {
|
||||
pRect->left = rc.GetLeft();
|
||||
pRect->top = rc.GetTop();
|
||||
pRect->right = rc.GetRight();
|
||||
pRect->bottom = rc.GetBottom();
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_SIZE:
|
||||
@@ -2553,7 +2553,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
|
||||
case WM_HOTKEY:
|
||||
processed = HandleHotKey((WORD)wParam, lParam);
|
||||
break;
|
||||
#endif
|
||||
#endif // wxUSE_HOTKEY
|
||||
|
||||
case WM_HSCROLL:
|
||||
case WM_VSCROLL:
|
||||
@@ -5421,49 +5421,56 @@ wxPoint wxGetMousePosition()
|
||||
}
|
||||
|
||||
#if wxUSE_HOTKEY
|
||||
bool wxWindowMSW::RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode)
|
||||
|
||||
bool wxWindowMSW::RegisterHotKey(int hotkeyId, int modifiers, int keycode)
|
||||
{
|
||||
UINT win_modifiers=0;
|
||||
if (modifiers & wxMOD_ALT)
|
||||
win_modifiers|=MOD_ALT;
|
||||
if (modifiers & wxMOD_SHIFT)
|
||||
win_modifiers|=MOD_SHIFT;
|
||||
if (modifiers & wxMOD_CONTROL)
|
||||
win_modifiers|=MOD_CONTROL;
|
||||
if (modifiers & wxMOD_WIN)
|
||||
win_modifiers|=MOD_WIN;
|
||||
if ( modifiers & wxMOD_ALT )
|
||||
win_modifiers |= MOD_ALT;
|
||||
if ( modifiers & wxMOD_SHIFT )
|
||||
win_modifiers |= MOD_SHIFT;
|
||||
if ( modifiers & wxMOD_CONTROL )
|
||||
win_modifiers |= MOD_CONTROL;
|
||||
if ( modifiers & wxMOD_WIN )
|
||||
win_modifiers |= MOD_WIN;
|
||||
|
||||
return ::RegisterHotKey(GetHwnd(), hotkeyId, win_modifiers, virtualKeyCode)!=FALSE;
|
||||
if ( !::RegisterHotKey(GetHwnd(), hotkeyId, win_modifiers, keycode) )
|
||||
{
|
||||
wxLogLastError(_T("RegisterHotKey"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxWindowMSW::UnregisterHotKey(int hotkeyId)
|
||||
{
|
||||
return ::UnregisterHotKey(GetHwnd(), hotkeyId)!=FALSE;
|
||||
if ( !::UnregisterHotKey(GetHwnd(), hotkeyId) )
|
||||
{
|
||||
wxLogLastError(_T("UnregisterHotKey"));
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam)
|
||||
{
|
||||
int hotkeyId=wParam;
|
||||
int virtualKey=HIWORD(lParam);
|
||||
int win_modifiers=LOWORD(lParam);
|
||||
/*
|
||||
wxHotkeyModifier modifiers=wxMOD_NONE;
|
||||
if (win_modifiers & MOD_ALT)
|
||||
modifiers|=wxMOD_ALT;
|
||||
if (win_modifiers & MOD_SHIFT)
|
||||
modifiers|=wxMOD_SHIFT;
|
||||
if (win_modifiers & MOD_CONTROL)
|
||||
modifiers|=wxMOD_CONTROL;
|
||||
if (win_modifiers & MOD_WIN)
|
||||
modifiers|=wxMOD_WIN;
|
||||
*/
|
||||
int hotkeyId = wParam;
|
||||
int virtualKey = HIWORD(lParam);
|
||||
int win_modifiers = LOWORD(lParam);
|
||||
|
||||
wxKeyEvent event(CreateKeyEvent(wxEVT_HOTKEY, virtualKey, wParam, lParam));
|
||||
event.SetId(hotkeyId);
|
||||
event.m_shiftDown = (win_modifiers & MOD_SHIFT) != 0;
|
||||
event.m_controlDown = (win_modifiers & MOD_CONTROL) != 0;
|
||||
event.m_altDown = (win_modifiers & MOD_ALT) != 0;
|
||||
event.m_metaDown = (win_modifiers & MOD_WIN) != 0;
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
#endif
|
||||
|
||||
return GetEventHandler()->ProcessEvent(event);
|
||||
}
|
||||
|
||||
#endif // wxUSE_HOTKEY
|
||||
|
||||
|
Reference in New Issue
Block a user