]>
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
)
30 bool wxUIActionSimulator::MouseDblClick(int button
)
40 bool wxUIActionSimulator::MouseClickAndDragTo(long x
, long y
, int button
)
51 wxUIActionSimulator::MouseDragDrop(long x1
, long y1
, long x2
, long y2
,
63 wxUIActionSimulator::Key(int keycode
, int modifiers
, bool isDown
)
65 wxASSERT_MSG( (modifiers
& wxMOD_ALTGR
) != wxMOD_ALTGR
,
66 "wxMOD_ALTGR is not implemented" );
67 wxASSERT_MSG( !(modifiers
& wxMOD_META
),
68 "wxMOD_META is not implemented" );
69 wxASSERT_MSG( !(modifiers
& wxMOD_WIN
),
70 "wxMOD_WIN is not implemented" );
73 SimulateModifiers(modifiers
, true);
75 bool rc
= DoKey(keycode
, modifiers
, isDown
);
78 SimulateModifiers(modifiers
, false);
83 void wxUIActionSimulator::SimulateModifiers(int modifiers
, bool isDown
)
85 if ( modifiers
& wxMOD_SHIFT
)
86 DoKey(WXK_SHIFT
, modifiers
, isDown
);
87 if ( modifiers
& wxMOD_ALT
)
88 DoKey(WXK_ALT
, modifiers
, isDown
);
89 if ( modifiers
& wxMOD_CONTROL
)
90 DoKey(WXK_CONTROL
, modifiers
, isDown
);
93 bool wxUIActionSimulator::Char(int keycode
, int modifiers
)
140 Key(keycode
, modifiers
, true);
141 Key(keycode
, modifiers
, false);
146 bool wxUIActionSimulator::Text(const char *s
)
150 const char ch
= *s
++;
151 if ( !Char(ch
, isupper(ch
) ? wxMOD_SHIFT
: 0) )
158 #endif // wxUSE_UIACTIONSIMULATOR