]> git.saurik.com Git - wxWidgets.git/commitdiff
linking fixes and code cleanup after hotkey patch
authorVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Jul 2003 09:56:47 +0000 (09:56 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Thu, 10 Jul 2003 09:56:47 +0000 (09:56 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21848 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/msw/window.h
include/wx/window.h
src/common/wincmn.cpp
src/msw/window.cpp

index 0e0f8317df02e84b9ba8c606860b2ad76f9b2df5..63cdaf66dd1a811b7e7aaa6ea4928c8049f4135a 100644 (file)
@@ -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
     // --------------------------
index 959f775c7090eb569a17b0bd631812f677fe144b..877456d967a889a4928ce3568e2ce5cec635e186 100644 (file)
@@ -517,11 +517,16 @@ public:
     wxAcceleratorTable *GetAcceleratorTable()
         { return &m_acceleratorTable; }
 
-    // install and deinstall a system wide hotkey
-    virtual bool RegisterHotKey(int hotkeyId, int modifiers, int virtualKeyCode);
+#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
 
-#endif // wxUSE_ACCEL
 
     // dialog units translations
     // -------------------------
index 06582f8f98596d8bbe0a3c05060ef74ef98ed1ea..61402fabf07df6ae8a03f26cfd473fc83ee13881 100644 (file)
@@ -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()
 {
index e910670307c0f640c334f13e0780364220c0f51d..df95abf3a7043890ac7e7b31491f58d31aa2de56 100644 (file)
@@ -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;
+
+    if ( !::RegisterHotKey(GetHwnd(), hotkeyId, win_modifiers, keycode) )
+    {
+        wxLogLastError(_T("RegisterHotKey"));
 
-    return ::RegisterHotKey(GetHwnd(), hotkeyId, win_modifiers, virtualKeyCode)!=FALSE;
+        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);    
+
+    return GetEventHandler()->ProcessEvent(event);
 }
-#endif
+
+#endif // wxUSE_HOTKEY