]>
git.saurik.com Git - wxWidgets.git/blob - src/common/uiactioncmn.cpp
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: src/common/uiactioncmn.cpp
3 // Purpose: wxUIActionSimulator common implementation
4 // Author: Kevin Ollivier, Steven Lamerton, Vadim Zeitlin
8 // Copyright: (c) Kevin Ollivier
9 // (c) 2010 Steven Lamerton
10 // (c) 2010 Vadim Zeitlin
11 // Licence: wxWindows licence
12 /////////////////////////////////////////////////////////////////////////////
14 #include "wx/wxprec.h"
16 #if wxUSE_UIACTIONSIMULATOR
18 #include "wx/uiaction.h"
20 bool wxUIActionSimulator::MouseClick(int button
)
28 bool wxUIActionSimulator::MouseDblClick(int button
)
39 wxUIActionSimulator::MouseDragDrop(long x1
, long y1
, long x2
, long y2
,
51 wxUIActionSimulator::Key(int keycode
, int modifiers
, bool isDown
)
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" );
61 SimulateModifiers(modifiers
, true);
63 bool rc
= DoKey(keycode
, modifiers
, isDown
);
66 SimulateModifiers(modifiers
, false);
71 void wxUIActionSimulator::SimulateModifiers(int modifiers
, bool isDown
)
73 if ( modifiers
& wxMOD_SHIFT
)
74 DoKey(WXK_SHIFT
, modifiers
, isDown
);
75 if ( modifiers
& wxMOD_ALT
)
76 DoKey(WXK_ALT
, modifiers
, isDown
);
77 if ( modifiers
& wxMOD_CONTROL
)
78 DoKey(WXK_CONTROL
, modifiers
, isDown
);
81 bool wxUIActionSimulator::Char(int keycode
, int modifiers
)
86 keycode
= WXK_NUMPAD0
;
89 keycode
= WXK_NUMPAD1
;
92 keycode
= WXK_NUMPAD2
;
95 keycode
= WXK_NUMPAD3
;
98 keycode
= WXK_NUMPAD4
;
101 keycode
= WXK_NUMPAD5
;
104 keycode
= WXK_NUMPAD6
;
107 keycode
= WXK_NUMPAD7
;
110 keycode
= WXK_NUMPAD8
;
113 keycode
= WXK_NUMPAD9
;
116 keycode
= WXK_NUMPAD_ADD
;
119 keycode
= WXK_NUMPAD_SUBTRACT
;
122 keycode
= WXK_NUMPAD_DECIMAL
;
128 Key(keycode
, modifiers
, true);
129 Key(keycode
, modifiers
, false);
134 bool wxUIActionSimulator::Text(const char *s
)
138 const char ch
= *s
++;
139 if ( !Char(ch
, isupper(ch
) ? wxMOD_SHIFT
: 0) )
146 #endif // wxUSE_UIACTIONSIMULATOR