]>
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
7 // Copyright: (c) Kevin Ollivier
8 // (c) 2010 Steven Lamerton
9 // (c) 2010 Vadim Zeitlin
10 // Licence: wxWindows licence
11 /////////////////////////////////////////////////////////////////////////////
13 #include "wx/wxprec.h"
15 #if wxUSE_UIACTIONSIMULATOR
17 #include "wx/uiaction.h"
19 bool wxUIActionSimulator::MouseClick(int button
)
29 bool wxUIActionSimulator::MouseDblClick(int button
)
39 bool wxUIActionSimulator::MouseDragDrop(long x1
, long y1
, long x2
, long y2
,
53 wxUIActionSimulator::Key(int keycode
, int modifiers
, bool isDown
)
55 wxASSERT_MSG( (modifiers
& wxMOD_ALTGR
) != wxMOD_ALTGR
,
56 "wxMOD_ALTGR is not implemented" );
57 wxASSERT_MSG( !(modifiers
& wxMOD_META
),
58 "wxMOD_META is not implemented" );
59 wxASSERT_MSG( !(modifiers
& wxMOD_WIN
),
60 "wxMOD_WIN is not implemented" );
63 SimulateModifiers(modifiers
, true);
65 bool rc
= DoKey(keycode
, modifiers
, isDown
);
68 SimulateModifiers(modifiers
, false);
73 void wxUIActionSimulator::SimulateModifiers(int modifiers
, bool isDown
)
75 if ( modifiers
& wxMOD_SHIFT
)
76 DoKey(WXK_SHIFT
, modifiers
, isDown
);
77 if ( modifiers
& wxMOD_ALT
)
78 DoKey(WXK_ALT
, modifiers
, isDown
);
79 if ( modifiers
& wxMOD_CONTROL
)
80 DoKey(WXK_CONTROL
, modifiers
, isDown
);
83 bool wxUIActionSimulator::Char(int keycode
, int modifiers
)
130 Key(keycode
, modifiers
, true);
131 Key(keycode
, modifiers
, false);
136 bool wxUIActionSimulator::Text(const char *s
)
140 const char ch
= *s
++;
141 if ( !Char(ch
, isupper(ch
) ? wxMOD_SHIFT
: 0) )
148 #endif // wxUSE_UIACTIONSIMULATOR