]>
Commit | Line | Data |
---|---|---|
a02a5cfc KO |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: include/wx/uiaction.cpp | |
3 | // Purpose: wxUIActionSimulator interface | |
4 | // Author: Kevin Ollivier | |
5 | // Modified by: | |
6 | // Created: 2010-03-06 | |
7 | // RCS-ID: $Id: menu.cpp 54129 2008-06-11 19:30:52Z SC $ | |
8 | // Copyright: (c) Kevin Ollivier | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #ifndef _UIACTIONSIMULATOR_H_ | |
13 | #define _UIACTIONSIMULATOR_H_ | |
14 | ||
15 | #include <wx/defs.h> | |
16 | #include <wx/event.h> | |
17 | #include <wx/dynarray.h> | |
18 | ||
19 | class WXDLLIMPEXP_CORE wxUIActionSimulator | |
20 | { | |
21 | public: | |
22 | wxUIActionSimulator(); | |
23 | ~wxUIActionSimulator(); | |
24 | ||
25 | // Mouse related | |
26 | bool MouseMove(long x, long y); | |
27 | bool MouseDown(int button = wxMOUSE_BTN_LEFT); | |
28 | bool MouseUp(int button = wxMOUSE_BTN_LEFT); | |
29 | bool MouseClick(int button = wxMOUSE_BTN_LEFT); | |
30 | bool MouseDblClick(int button = wxMOUSE_BTN_LEFT); | |
31 | bool MouseDragDrop(long x1, long y1, long x2, long y2, int button = wxMOUSE_BTN_LEFT); | |
32 | ||
33 | // Keyboard related: | |
34 | ||
35 | bool KeyDown(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false) | |
36 | { return Key(keycode, true, shiftDown, cmdDown, altDown); } | |
37 | ||
38 | bool KeyUp(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false) | |
39 | { return Key(keycode, false, shiftDown, cmdDown, altDown); } | |
40 | ||
41 | bool Char(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false); | |
42 | ||
43 | protected: | |
44 | // Implementation-wise, since key events take more code to set up on GTK and Mac, it makes | |
45 | // sense to handle both key down and key up in one method. However, I wanted the API for pressing | |
46 | // and releasing the mouse and keyboard to be consistent, and I don't really like using a bool | |
47 | // for pressed state, so I'm leaving this as an implementation detail. | |
48 | bool Key(int keycode, bool isDown=true, bool shiftDown=false, bool cmdDown=false, bool altDown=false); | |
49 | }; | |
50 | ||
51 | #endif |