Remove assert checking for wxMOD_CONTROL from wxUIActionSimulator.
[wxWidgets.git] / src / common / uiactioncmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/uiactioncmn.cpp
3 // Purpose: wxUIActionSimulator common implementation
4 // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
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 // (c) 2010 Steven Lamerton
10 // (c) 2010 Vadim Zeitlin
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
13
14 #include "wx/wxprec.h"
15
16 #if wxUSE_UIACTIONSIMULATOR
17
18 #include "wx/uiaction.h"
19
20 bool wxUIActionSimulator::MouseClick(int button)
21 {
22 MouseDown(button);
23 MouseUp(button);
24
25 return true;
26 }
27
28 bool wxUIActionSimulator::MouseDblClick(int button)
29 {
30 MouseDown(button);
31 MouseUp(button);
32 MouseDown(button);
33 MouseUp(button);
34
35 return true;
36 }
37
38 bool
39 wxUIActionSimulator::MouseDragDrop(long x1, long y1, long x2, long y2,
40 int button)
41 {
42 MouseMove(x1, y1);
43 MouseDown(button);
44 MouseMove(x2, y2);
45 MouseUp(button);
46
47 return true;
48 }
49
50 bool
51 wxUIActionSimulator::Key(int keycode, int modifiers, bool isDown)
52 {
53 wxASSERT_MSG( (modifiers & wxMOD_ALTGR) != wxMOD_ALTGR,
54 "wxMOD_ALTGR is not implemented" );
55 wxASSERT_MSG( !(modifiers & wxMOD_META ),
56 "wxMOD_META is not implemented" );
57 wxASSERT_MSG( !(modifiers & wxMOD_WIN ),
58 "wxMOD_WIN is not implemented" );
59
60 return DoKey(keycode, modifiers, isDown);
61 }
62
63 bool wxUIActionSimulator::Char(int keycode, int modifiers)
64 {
65 Key(keycode, modifiers, true);
66 Key(keycode, modifiers, false);
67
68 return true;
69 }
70
71 bool wxUIActionSimulator::Text(const char *s)
72 {
73 while ( *s != '\0' )
74 {
75 const char ch = *s++;
76
77 wxASSERT_MSG( ch, "Only letters are allowed" );
78
79 if ( !Char(ch, isupper(ch) ? wxMOD_SHIFT : 0) )
80 return false;
81 }
82
83 return true;
84 }
85
86 #endif // wxUSE_UIACTIONSIMULATOR