1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxUIActionSimulator interface
4 // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
7 // RCS-ID: $Id: menu.cpp 54129 2008-06-11 19:30:52Z SC $
8 // Copyright: (c) Kevin Ollivier
9 // (c) 2010 Steven Lamerton
10 // (c) 2010 Vadim Zeitlin
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #ifndef _WX_UIACTIONSIMULATOR_H_
15 #define _WX_UIACTIONSIMULATOR_H_
19 #if wxUSE_UIACTIONSIMULATOR
21 #include "wx/mousestate.h" // for wxMOUSE_BTN_XXX constants
23 class WXDLLIMPEXP_CORE wxUIActionSimulator
26 wxUIActionSimulator() { }
29 // Default dtor, copy ctor and assignment operator are ok (even though the
30 // last two don't make much sense for this class).
37 bool MouseMove(long x
, long y
);
38 bool MouseMove(const wxPoint
& point
) { return MouseMove(point
.x
, point
.y
); }
40 bool MouseDown(int button
= wxMOUSE_BTN_LEFT
);
41 bool MouseUp(int button
= wxMOUSE_BTN_LEFT
);
43 // Higher level interface, use it if possible instead
44 bool MouseClick(int button
= wxMOUSE_BTN_LEFT
);
45 bool MouseDblClick(int button
= wxMOUSE_BTN_LEFT
);
46 bool MouseDragDrop(long x1
, long y1
, long x2
, long y2
,
47 int button
= wxMOUSE_BTN_LEFT
);
50 // Keyboard simulation
51 // -------------------
53 // Low level methods for generating key presses and releases
54 bool KeyDown(int keycode
, int modifiers
= wxMOD_NONE
)
55 { return Key(keycode
, modifiers
, true); }
57 bool KeyUp(int keycode
, int modifiers
= wxMOD_NONE
)
58 { return Key(keycode
, modifiers
, false); }
60 // Higher level methods for generating both the key press and release for a
61 // single key or for all characters in the ASCII string "text" which can
62 // currently contain letters only (no digits, no punctuation).
63 bool Char(int keycode
, int modifiers
= wxMOD_NONE
);
65 bool Text(const char *text
);
68 // This is the common part of Key{Down,Up}() methods: while we keep them
69 // separate at public API level for consistency with Mouse{Down,Up}(), at
70 // implementation level it makes more sense to have them in a single
73 // This is a simple wrapper verifying the input parameters validity around
74 // the platform-specific DoKey() method implemented in platform-specific
76 bool Key(int keycode
, int modifiers
, bool isDown
);
78 bool DoKey(int keycode
, int modifiers
, bool isDown
);
81 #endif // wxUSE_UIACTIONSIMULATOR
83 #endif // _WX_UIACTIONSIMULATOR_H_