]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/uiaction.cpp
Get the page title from the IHtmlDocument rather than the bowser as it actually retur...
[wxWidgets.git] / src / msw / uiaction.cpp
index 293cf510784e4a92c9b3d4f6f798e25b2d072599..eb5bfd1e34567522b04efbf19496fce891cdd85b 100644 (file)
 #if wxUSE_UIACTIONSIMULATOR
 
 #include "wx/uiaction.h"
-#include "wx/window.h" //for wxCharCodeWXToMSW
 #include "wx/msw/wrapwin.h"
 
+#include "wx/msw/private/keyboard.h"
+
 namespace
 {
 
@@ -41,11 +42,6 @@ DWORD EventTypeForMouseButton(int button, bool isDown)
     }
 }
 
-void DoSimulateKbdEvent(DWORD vk, bool isDown)
-{
-    keybd_event(vk, 0, isDown ? 0 : KEYEVENTF_KEYUP, 0);
-}
-
 } // anonymous namespace
 
 bool wxUIActionSimulator::MouseDown(int button)
@@ -76,30 +72,19 @@ bool wxUIActionSimulator::MouseUp(int button)
     return true;
 }
 
-bool wxUIActionSimulator::DoKey(int keycode, int modifiers, bool isDown)
+bool
+wxUIActionSimulator::DoKey(int keycode, int WXUNUSED(modifiers), bool isDown)
 {
-    if (isDown)
-    {
-        if (modifiers & wxMOD_SHIFT)
-            DoSimulateKbdEvent(VK_SHIFT, true);
-        if (modifiers & wxMOD_ALT)
-            DoSimulateKbdEvent(VK_MENU, true);
-        if (modifiers & wxMOD_CMD)
-            DoSimulateKbdEvent(VK_CONTROL, true);
-    }
+    bool isExtended;
+    DWORD vkkeycode = wxMSWKeyboard::WXToVK(keycode, &isExtended);
 
-    DWORD vkkeycode = wxCharCodeWXToMSW(keycode);
-    keybd_event(vkkeycode, 0, isDown ? 0 : KEYEVENTF_KEYUP, 0);
+    DWORD flags = 0;
+    if ( isExtended )
+        flags |= KEYEVENTF_EXTENDEDKEY;
+    if ( !isDown )
+        flags |= KEYEVENTF_KEYUP;
 
-    if (!isDown)
-    {
-        if (modifiers & wxMOD_SHIFT)
-            DoSimulateKbdEvent(VK_SHIFT, false);
-        if (modifiers & wxMOD_ALT)
-            DoSimulateKbdEvent(VK_MENU, false);
-        if (modifiers & wxMOD_CMD)
-            DoSimulateKbdEvent(VK_CONTROL, false);
-    }
+    keybd_event(vkkeycode, 0, flags, 0);
 
     return true;
 }