]> git.saurik.com Git - wxWidgets.git/blame - include/wx/uiaction.h
Only link with libwxscintilla if using Scintilla is enabled.
[wxWidgets.git] / include / wx / uiaction.h
CommitLineData
a02a5cfc 1/////////////////////////////////////////////////////////////////////////////
233f5738 2// Name: wx/uiaction.h
a02a5cfc 3// Purpose: wxUIActionSimulator interface
571d991b 4// Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
a02a5cfc
KO
5// Modified by:
6// Created: 2010-03-06
a9a4f229 7// RCS-ID: $Id$
a02a5cfc 8// Copyright: (c) Kevin Ollivier
571d991b
VZ
9// (c) 2010 Steven Lamerton
10// (c) 2010 Vadim Zeitlin
a02a5cfc
KO
11// Licence: wxWindows licence
12/////////////////////////////////////////////////////////////////////////////
13
9b7e0226
VZ
14#ifndef _WX_UIACTIONSIMULATOR_H_
15#define _WX_UIACTIONSIMULATOR_H_
a02a5cfc 16
9b7e0226
VZ
17#include "wx/defs.h"
18
19#if wxUSE_UIACTIONSIMULATOR
20
571d991b 21#include "wx/mousestate.h" // for wxMOUSE_BTN_XXX constants
a02a5cfc
KO
22
23class WXDLLIMPEXP_CORE wxUIActionSimulator
24{
25public:
571d991b 26 wxUIActionSimulator() { }
9b7e0226 27
9b7e0226 28
571d991b
VZ
29 // Default dtor, copy ctor and assignment operator are ok (even though the
30 // last two don't make much sense for this class).
a02a5cfc 31
9b7e0226 32
571d991b
VZ
33 // Mouse simulation
34 // ----------------
9b7e0226 35
571d991b
VZ
36 // Low level methods
37 bool MouseMove(long x, long y);
38 bool MouseMove(const wxPoint& point) { return MouseMove(point.x, point.y); }
a02a5cfc 39
571d991b
VZ
40 bool MouseDown(int button = wxMOUSE_BTN_LEFT);
41 bool MouseUp(int button = wxMOUSE_BTN_LEFT);
42
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);
12bb29f5
SC
48 bool MouseDragDrop(const wxPoint& p1, const wxPoint& p2,
49 int button = wxMOUSE_BTN_LEFT)
50 { return MouseDragDrop(p1.x, p1.y, p2.x, p2.y, button); }
571d991b 51
571d991b
VZ
52 // Keyboard simulation
53 // -------------------
54
55 // Low level methods for generating key presses and releases
56 bool KeyDown(int keycode, int modifiers = wxMOD_NONE)
57 { return Key(keycode, modifiers, true); }
58
59 bool KeyUp(int keycode, int modifiers = wxMOD_NONE)
60 { return Key(keycode, modifiers, false); }
61
62 // Higher level methods for generating both the key press and release for a
c0c9009c
VZ
63 // single key or for all characters in the ASCII string "text" which can currently
64 // contain letters, digits and characters for the definition of numbers [+-., ].
571d991b
VZ
65 bool Char(int keycode, int modifiers = wxMOD_NONE);
66
67 bool Text(const char *text);
68
69private:
70 // This is the common part of Key{Down,Up}() methods: while we keep them
71 // separate at public API level for consistency with Mouse{Down,Up}(), at
72 // implementation level it makes more sense to have them in a single
73 // function.
74 //
37141214
VZ
75 // It calls DoModifiers() to simulate pressing the modifier keys if
76 // necessary and then DoKey() for the key itself.
571d991b
VZ
77 bool Key(int keycode, int modifiers, bool isDown);
78
37141214
VZ
79 // Call DoKey() for all modifier keys whose bits are set in the parameter.
80 void SimulateModifiers(int modifier, bool isDown);
81
82
83 // The low-level port-specific function which really generates the key
84 // presses. It should generate exactly one key event with the given
85 // parameters.
571d991b 86 bool DoKey(int keycode, int modifiers, bool isDown);
a02a5cfc
KO
87};
88
9b7e0226
VZ
89#endif // wxUSE_UIACTIONSIMULATOR
90
91#endif // _WX_UIACTIONSIMULATOR_H_