]>
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"
18 #include "wx/uiaction.h"
22 DWORD
EventTypeForMouseButton(int button
, bool isDown
)
26 case wxMOUSE_BTN_LEFT
:
28 return MOUSEEVENTF_LEFTDOWN
;
30 return MOUSEEVENTF_LEFTUP
;
31 case wxMOUSE_BTN_RIGHT
:
33 return MOUSEEVENTF_RIGHTDOWN
;
35 return MOUSEEVENTF_RIGHTUP
;
36 case wxMOUSE_BTN_MIDDLE
:
38 return MOUSEEVENTF_MIDDLEDOWN
;
40 return MOUSEEVENTF_MIDDLEUP
;
43 wxFAIL_MSG("Unsupported button passed in.");
48 bool wxUIActionSimulator::MouseDown(int button
)
52 mouse_event(EventTypeForMouseButton(button
, true), p
.x
, p
.y
, 0, 0);
56 bool wxUIActionSimulator::MouseMove(long x
, long y
)
58 mouse_event(MOUSEEVENTF_MOVE
, x
, y
, 0, 0);
62 bool wxUIActionSimulator::MouseUp(int button
)
66 mouse_event(EventTypeForMouseButton(button
, false), p
.x
, p
.y
, 0, 0);
70 bool wxUIActionSimulator::Key(int keycode
, bool isDown
, bool shiftDown
, bool cmdDown
, bool altDown
)
74 flags
= KEYEVENTF_KEYUP
;
75 keybd_event(keycode
, 0, flags
, 0);