]>
git.saurik.com Git - wxWidgets.git/blob - src/msw/uiaction.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/msw/uiaction.cpp
3 // Purpose: wxUIActionSimulator implementation
4 // Author: Kevin Ollivier
7 // RCS-ID: $Id: menu.cpp 54129 2008-06-11 19:30:52Z SC $
8 // Copyright: (c) Kevin Ollivier
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #include "wx/wxprec.h"
14 #if wxUSE_UIACTIONSIMULATOR
16 #include "wx/uiaction.h"
18 #include "wx/msw/wrapwin.h"
20 DWORD
EventTypeForMouseButton(int button
, bool isDown
)
24 case wxMOUSE_BTN_LEFT
:
26 return MOUSEEVENTF_LEFTDOWN
;
28 return MOUSEEVENTF_LEFTUP
;
29 case wxMOUSE_BTN_RIGHT
:
31 return MOUSEEVENTF_RIGHTDOWN
;
33 return MOUSEEVENTF_RIGHTUP
;
34 case wxMOUSE_BTN_MIDDLE
:
36 return MOUSEEVENTF_MIDDLEDOWN
;
38 return MOUSEEVENTF_MIDDLEUP
;
41 wxFAIL_MSG("Unsupported button passed in.");
46 bool wxUIActionSimulator::MouseDown(int button
)
50 mouse_event(EventTypeForMouseButton(button
, true), p
.x
, p
.y
, 0, 0);
54 bool wxUIActionSimulator::MouseMove(long x
, long y
)
56 mouse_event(MOUSEEVENTF_MOVE
, x
, y
, 0, 0);
60 bool wxUIActionSimulator::MouseUp(int button
)
64 mouse_event(EventTypeForMouseButton(button
, false), p
.x
, p
.y
, 0, 0);
68 bool wxUIActionSimulator::Key(int keycode
, bool isDown
, bool shiftDown
, bool cmdDown
, bool altDown
)
72 flags
= KEYEVENTF_KEYUP
;
73 keybd_event(keycode
, 0, flags
, 0);
77 #endif // wxUSE_UIACTIONSIMULATOR