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);
|
wxWindow* GetWindowChild(wxWindowID id);
|
||||||
#endif // __WXUNIVERSAL__
|
#endif // __WXUNIVERSAL__
|
||||||
|
|
||||||
#if wxUSE_ACCEL
|
#if wxUSE_HOTKEY
|
||||||
// install and deinstall a system wide 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);
|
virtual bool UnregisterHotKey(int hotkeyId);
|
||||||
#endif
|
#endif // wxUSE_HOTKEY
|
||||||
|
|
||||||
// implementation from now on
|
// implementation from now on
|
||||||
// --------------------------
|
// --------------------------
|
||||||
|
@@ -517,12 +517,17 @@ public:
|
|||||||
wxAcceleratorTable *GetAcceleratorTable()
|
wxAcceleratorTable *GetAcceleratorTable()
|
||||||
{ return &m_acceleratorTable; }
|
{ 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
|
#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
|
// dialog units translations
|
||||||
// -------------------------
|
// -------------------------
|
||||||
|
|
||||||
|
@@ -2107,18 +2107,23 @@ void wxWindowBase::ReleaseMouse()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_HOTKEY
|
#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
|
// not implemented
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxWindowBase::UnregisterHotKey(int hotkeyId)
|
bool wxWindowBase::UnregisterHotKey(int WXUNUSED(hotkeyId))
|
||||||
{
|
{
|
||||||
// not implemented
|
// not implemented
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // wxUSE_HOTKEY
|
||||||
|
|
||||||
void wxWindowBase::SendDestroyEvent()
|
void wxWindowBase::SendDestroyEvent()
|
||||||
{
|
{
|
||||||
|
@@ -2553,7 +2553,7 @@ long wxWindowMSW::MSWWindowProc(WXUINT message, WXWPARAM wParam, WXLPARAM lParam
|
|||||||
case WM_HOTKEY:
|
case WM_HOTKEY:
|
||||||
processed = HandleHotKey((WORD)wParam, lParam);
|
processed = HandleHotKey((WORD)wParam, lParam);
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif // wxUSE_HOTKEY
|
||||||
|
|
||||||
case WM_HSCROLL:
|
case WM_HSCROLL:
|
||||||
case WM_VSCROLL:
|
case WM_VSCROLL:
|
||||||
@@ -5421,7 +5421,8 @@ wxPoint wxGetMousePosition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if wxUSE_HOTKEY
|
#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;
|
UINT win_modifiers=0;
|
||||||
if ( modifiers & wxMOD_ALT )
|
if ( modifiers & wxMOD_ALT )
|
||||||
@@ -5433,12 +5434,26 @@ bool wxWindowMSW::RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode
|
|||||||
if ( modifiers & wxMOD_WIN )
|
if ( modifiers & wxMOD_WIN )
|
||||||
win_modifiers |= MOD_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)
|
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)
|
bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam)
|
||||||
@@ -5446,24 +5461,16 @@ bool wxWindowMSW::HandleHotKey(WXWPARAM wParam, WXLPARAM lParam)
|
|||||||
int hotkeyId = wParam;
|
int hotkeyId = wParam;
|
||||||
int virtualKey = HIWORD(lParam);
|
int virtualKey = HIWORD(lParam);
|
||||||
int win_modifiers = LOWORD(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;
|
|
||||||
*/
|
|
||||||
wxKeyEvent event(CreateKeyEvent(wxEVT_HOTKEY, virtualKey, wParam, lParam));
|
wxKeyEvent event(CreateKeyEvent(wxEVT_HOTKEY, virtualKey, wParam, lParam));
|
||||||
event.SetId(hotkeyId);
|
event.SetId(hotkeyId);
|
||||||
event.m_shiftDown = (win_modifiers & MOD_SHIFT) != 0;
|
event.m_shiftDown = (win_modifiers & MOD_SHIFT) != 0;
|
||||||
event.m_controlDown = (win_modifiers & MOD_CONTROL) != 0;
|
event.m_controlDown = (win_modifiers & MOD_CONTROL) != 0;
|
||||||
event.m_altDown = (win_modifiers & MOD_ALT) != 0;
|
event.m_altDown = (win_modifiers & MOD_ALT) != 0;
|
||||||
event.m_metaDown = (win_modifiers & MOD_WIN) != 0;
|
event.m_metaDown = (win_modifiers & MOD_WIN) != 0;
|
||||||
|
|
||||||
return GetEventHandler()->ProcessEvent(event);
|
return GetEventHandler()->ProcessEvent(event);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
#endif // wxUSE_HOTKEY
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user