--enable-metafiles use wxMetaFile (Win32 only)
--enable-dragimage use wxDragImage
--enable-accessibility enable accessibility support
+ --enable-uiactionsim use wxUIActionSimulator (experimental)
--enable-palette use wxPalette class
--enable-image use wxImage class
--enable-gif use gif images (GIF file format)
DEFAULT_wxUSE_ACCESSIBILITY=no
DEFAULT_wxUSE_IPV6=no
DEFAULT_wxUSE_GSTREAMER8=no
+DEFAULT_wxUSE_UIACTIONSIMULATOR=no
DEFAULT_wxUSE_UNICODE_UTF8=auto
DEFAULT_wxUSE_OPENGL=auto
echo "${ECHO_T}$result" >&6; }
+ enablestring=
+ defaultval=$wxUSE_ALL_FEATURES
+ if test -z "$defaultval"; then
+ if test x"$enablestring" = xdisable; then
+ defaultval=yes
+ else
+ defaultval=no
+ fi
+ fi
+
+ { echo "$as_me:$LINENO: checking for --${enablestring:-enable}-uiactionsim" >&5
+echo $ECHO_N "checking for --${enablestring:-enable}-uiactionsim... $ECHO_C" >&6; }
+ # Check whether --enable-uiactionsim was given.
+if test "${enable_uiactionsim+set}" = set; then
+ enableval=$enable_uiactionsim;
+ if test "$enableval" = yes; then
+ wx_cv_use_uiactionsim='wxUSE_UIACTIONSIMULATOR=yes'
+ else
+ wx_cv_use_uiactionsim='wxUSE_UIACTIONSIMULATOR=no'
+ fi
+
+else
+
+ wx_cv_use_uiactionsim='wxUSE_UIACTIONSIMULATOR=${'DEFAULT_wxUSE_UIACTIONSIMULATOR":-$defaultval}"
+
+fi
+
+
+ eval "$wx_cv_use_uiactionsim"
+
+ if test x"$enablestring" = xdisable; then
+ if test $wxUSE_UIACTIONSIMULATOR = no; then
+ result=yes
+ else
+ result=no
+ fi
+ else
+ result=$wxUSE_UIACTIONSIMULATOR
+ fi
+
+ { echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
+
+
enablestring=
fi
+if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
+ cat >>confdefs.h <<\_ACEOF
+#define wxUSE_UIACTIONSIMULATOR 1
+_ACEOF
+
+fi
+
USES_CONTROLS=0
if test "$wxUSE_CONTROLS" = "yes"; then
DEFAULT_wxUSE_ACCESSIBILITY=no
DEFAULT_wxUSE_IPV6=no
DEFAULT_wxUSE_GSTREAMER8=no
+DEFAULT_wxUSE_UIACTIONSIMULATOR=no
dnl automatic features
DEFAULT_wxUSE_UNICODE_UTF8=auto
WX_ARG_FEATURE(metafile, [ --enable-metafiles use wxMetaFile (Win32 only)], wxUSE_METAFILE)
WX_ARG_FEATURE(dragimage, [ --enable-dragimage use wxDragImage], wxUSE_DRAGIMAGE)
WX_ARG_FEATURE(accessibility,[ --enable-accessibility enable accessibility support], wxUSE_ACCESSIBILITY)
+WX_ARG_FEATURE(uiactionsim, [ --enable-uiactionsim use wxUIActionSimulator (experimental)], wxUSE_UIACTIONSIMULATOR)
dnl ---------------------------------------------------------------------------
dnl support for image formats that do not rely on external library
AC_DEFINE(wxUSE_MOUSEWHEEL)
fi
+if test "$wxUSE_UIACTIONSIMULATOR" = "yes" ; then
+ AC_DEFINE(wxUSE_UIACTIONSIMULATOR)
+fi
+
dnl ---------------------------------------------------------------------------
dnl GUI controls
dnl ---------------------------------------------------------------------------
# endif
#endif /* !defined(wxUSE_TREECTRL) */
+#ifndef wxUSE_UIACTIONSIMULATOR
+# ifdef wxABORT_ON_CONFIG_ERROR
+# error "wxUSE_UIACTIONSIMULATOR must be defined, please read comment near the top of this file."
+# else
+# define wxUSE_UIACTIONSIMULATOR 0
+# endif
+#endif /* !defined(wxUSE_UIACTIONSIMULATOR) */
+
#ifndef wxUSE_VALIDATORS
# ifdef wxABORT_ON_CONFIG_ERROR
# error "wxUSE_VALIDATORS must be defined, please read comment near the top of this file."
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#ifndef _UIACTIONSIMULATOR_H_
-#define _UIACTIONSIMULATOR_H_
+#ifndef _WX_UIACTIONSIMULATOR_H_
+#define _WX_UIACTIONSIMULATOR_H_
-#include <wx/defs.h>
-#include <wx/event.h>
-#include <wx/dynarray.h>
+#include "wx/defs.h"
+
+#if wxUSE_UIACTIONSIMULATOR
+
+#include "wx/event.h"
+#include "wx/dynarray.h"
class WXDLLIMPEXP_CORE wxUIActionSimulator
{
public:
wxUIActionSimulator();
~wxUIActionSimulator();
-
+
// Mouse related
bool MouseMove(long x, long y);
bool MouseDown(int button = wxMOUSE_BTN_LEFT);
bool MouseClick(int button = wxMOUSE_BTN_LEFT);
bool MouseDblClick(int button = wxMOUSE_BTN_LEFT);
bool MouseDragDrop(long x1, long y1, long x2, long y2, int button = wxMOUSE_BTN_LEFT);
-
+
// Keyboard related:
bool KeyDown(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false)
{ return Key(keycode, true, shiftDown, cmdDown, altDown); }
-
+
bool KeyUp(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false)
{ return Key(keycode, false, shiftDown, cmdDown, altDown); }
-
+
bool Char(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
protected:
// Implementation-wise, since key events take more code to set up on GTK and Mac, it makes
// sense to handle both key down and key up in one method. However, I wanted the API for pressing
- // and releasing the mouse and keyboard to be consistent, and I don't really like using a bool
- // for pressed state, so I'm leaving this as an implementation detail.
+ // and releasing the mouse and keyboard to be consistent, and I don't really like using a bool
+ // for pressed state, so I'm leaving this as an implementation detail.
bool Key(int keycode, bool isDown=true, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
};
-#endif
+#endif // wxUSE_UIACTIONSIMULATOR
+
+#endif // _WX_UIACTIONSIMULATOR_H_
#define wxUSE_MOUSEWHEEL 1
// Include mouse wheel support
+// Compile wxUIActionSimulator class?
+//
+// This is experimental code subject to change. It's not fully implemented yet.
+#define wxUSE_UIACTIONSIMULATOR 0
+
// ----------------------------------------------------------------------------
// wxDC classes for various output formats
// ----------------------------------------------------------------------------
@class wxUIActionSimulator
wxUIActionSimulator is a class used to simulate user interface actions
- such as a mouse click or a key press.
-
+ such as a mouse click or a key press.
+
+ @note that this class is currently experimental and disabled by default,
+ you must set @c wxUSE_UIACTIONSIMULATOR to 1 in your setup.h file or use
+ configure @c --enable-uiactionsim option to enable it.
+
Common usages for this class would be to provide playback and record (aka macro recording)
functionality for users, or to drive unit tests by simulating user sessions.
-
+
See the uiaction sample for example usage of this class.
-
+
NOTE: For keyboard operations, currently you must pass the keycode of the actual
key on the keyboard. To simulate, e.g. IME actions, you'd need to simulate the actual
keypresses needed to active the IME, then the keypresses needed to type and select
the desired character.
-
+
@library{wxcore}
*/
*/
wxUIActionSimulator();
~wxUIActionSimulator();
-
+
/**
Move the mouse to the specified coordinates.
-
+
@param x
x coordinate to move to, in screen coordinates.
-
+
@param y
y coordinate to move to, in screen coordinates.
*/
bool MouseMove(long x, long y);
-
+
/**
Press a mouse button.
-
+
@param button
Button to press. Valid constants are wxMOUSE_BTN_LEFT, wxMOUSE_BTN_MIDDLE, and wxMOUSE_BTN_RIGHT.
*/
bool MouseDown(int button = wxMOUSE_BTN_LEFT);
-
+
/**
Release a mouse button.
-
+
@param button
Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
*/
bool MouseUp(int button = wxMOUSE_BTN_LEFT);
/**
Click a mouse button.
-
+
@param button
Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
*/
bool MouseClick(int button = wxMOUSE_BTN_LEFT);
/**
Double-click a mouse button.
-
+
@param button
Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
*/
/**
Perform a drag and drop operation.
-
+
@param x1
x start coordinate, in screen coordinates.
-
+
@param y1
y start coordinate, in screen coordinates.
-
+
@param x2
x desintation coordinate, in screen coordinates.
-
+
@param y2
y destination coordinate, in screen coordinates.
-
+
@param button
Button to press. See wxUIActionSimulator::MouseDown for a list of valid constants.
*/
bool MouseDragDrop(long x1, long y1, long x2, long y2, int button = wxMOUSE_BTN_LEFT);
-
+
/**
- Press a key.
-
+ Press a key.
+
@param keycode
key to operate on, as an integer.
-
+
@param shiftDown
true if the shift key should be pressed, false otherwise.
-
+
@param cmdDown
true if the cmd key should be pressed, false otherwise.
-
+
@param altDown
true if the alt key should be pressed, false otherwise.
*/
bool KeyDown(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
-
+
/**
- Release a key.
-
+ Release a key.
+
@param keycode
key to operate on, as an integer.
-
+
@param shiftDown
true if the shift key should be pressed, false otherwise.
-
+
@param cmdDown
true if the cmd key should be pressed, false otherwise.
-
+
@param altDown
true if the alt key should be pressed, false otherwise.
*/
bool KeyUp(int keycode, bool shiftDown=false, bool cmdDown=false, bool altDown=false);
-
+
/**
- Press and release a key.
-
+ Press and release a key.
+
@param keycode
key to operate on, as an integer.
-
+
@param shiftDown
true if the shift key should be pressed, false otherwise.
-
+
@param cmdDown
true if the cmd key should be pressed, false otherwise.
-
+
@param altDown
true if the alt key should be pressed, false otherwise.
*/
#pragma hdrstop
#endif
+#if wxUSE_UIACTIONSIMULATOR
+
// for all others, include the necessary headers (this file is usually all you
// need because it includes almost all "standard" wxWidgets headers)
#ifndef WX_PRECOMP
{
m_buttonPressed = true;
}
+
+#endif // wxUSE_UIACTIONSIMULATOR
#define wxUSE_MOUSEWHEEL 0
+#define wxUSE_UIACTIONSIMULATOR 0
+
#define wxUSE_POSTSCRIPT 0
#include "wx/wxprec.h"
+#if wxUSE_UIACTIONSIMULATOR
+
#include "wx/uiaction.h"
wxUIActionSimulator::wxUIActionSimulator()
}
-bool wxUIActionSimulator::MouseClick(int button)
+bool wxUIActionSimulator::MouseClick(int button)
{
MouseDown(button);
MouseUp(button);
-
+
return true;
}
-bool wxUIActionSimulator::MouseDblClick(int button)
+bool wxUIActionSimulator::MouseDblClick(int button)
{
MouseDown(button);
MouseUp(button);
MouseDown(button);
MouseUp(button);
-
+
return true;
}
{
MouseMove(x1, y1);
MouseDown(button);
- MouseMove(x2, y2);
+ MouseMove(x2, y2);
MouseUp(button);
-
+
return true;
}
{
Key(keycode, false, shiftDown, cmdDown, altDown);
Key(keycode, true, shiftDown, cmdDown, altDown);
-
+
return true;
-}
+}
+
+#endif // wxUSE_UIACTIONSIMULATOR
#include "wx/wxprec.h"
-#ifndef WX_PRECOMP
-#include "wx/defs.h"
-#endif
+#if wxUSE_UIACTIONSIMULATOR
#include "wx/uiaction.h"
-#include <windows.h>
+#include "wx/msw/wrapwin.h"
DWORD EventTypeForMouseButton(int button, bool isDown)
{
return MOUSEEVENTF_MIDDLEDOWN;
else
return MOUSEEVENTF_MIDDLEUP;
-
+
default:
wxFAIL_MSG("Unsupported button passed in.");
return -1;
}
bool wxUIActionSimulator::MouseMove(long x, long y)
-{
+{
mouse_event(MOUSEEVENTF_MOVE, x, y, 0, 0);
return true;
}
return true;
}
+#endif // wxUSE_UIACTIONSIMULATOR
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include <wx/defs.h>
-#include <wx/uiaction.h>
+#include "wx/defs.h"
+
+#if wxUSE_UIACTIONSIMULATOR
+
+#include "wx/uiaction.h"
#include <ApplicationServices/ApplicationServices.h>
return kCGEventRightMouseDown;
else
return kCGEventRightMouseUp;
-
- // Apparently all other buttons use the constant OtherMouseDown
-
+
+ // Apparently all other buttons use the constant OtherMouseDown
+
default:
if (isDown)
return kCGEventOtherMouseDown;
{
CGPoint pos;
int x, y;
- wxGetMousePosition(&x, &y);
+ wxGetMousePosition(&x, &y);
pos.x = x;
pos.y = y;
CGEventType type = CGEventTypeForMouseButton(button, true);
CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, button);
CGEventSetType(event, type);
-
+
if (event)
{
CGEventPost(tap, event);
CGEventType type = kCGEventMouseMoved;
CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, kCGMouseButtonLeft);
CGEventSetType(event, type);
-
+
if (event)
{
CGEventPost(tap, event);
}
CFRelease(event);
-
+
return true;
}
{
CGPoint pos;
int x, y;
- wxGetMousePosition(&x, &y);
+ wxGetMousePosition(&x, &y);
pos.x = x;
pos.y = y;
CGEventType type = CGEventTypeForMouseButton(button, false);
CGEventRef event = CGEventCreateMouseEvent(NULL, type, pos, button);
CGEventSetType(event, type);
-
+
if (event)
{
CGEventPost(tap, event);
SendCharCode((CGCharCode)58, false);
if (cmdDown)
SendCharCode((CGCharCode)55, false);
-
+
return true;
}
+#endif // wxUSE_UIACTIONSIMULATOR
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#include <wx/defs.h>
-#include <wx/uiaction.h>
+#include "wx/defs.h"
+
+#if wxUSE_UIACTIONSIMULATOR
+
+#include "wx/uiaction.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
}
XEvent event;
-
+
Display *display = XOpenDisplay(0);
wxASSERT_MSG(display, "No display available!");
-
+
memset(&event, 0x00, sizeof(event));
-
+
if (isDown)
event.type = ButtonPress;
else
event.xbutton.button = xbutton;
event.xbutton.same_screen = True;
-
+
XQueryPointer(display, RootWindow(display, DefaultScreen(display)), &event.xbutton.root, &event.xbutton.window, &event.xbutton.x_root, &event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, &event.xbutton.state);
event.xbutton.subwindow = event.xbutton.window;
-
+
while (event.xbutton.subwindow)
{
event.xbutton.window = event.xbutton.subwindow;
XQueryPointer(display, event.xbutton.window, &event.xbutton.root, &event.xbutton.subwindow, &event.xbutton.x_root, &event.xbutton.y_root, &event.xbutton.x, &event.xbutton.y, &event.xbutton.state);
}
-
+
XSendEvent(display, PointerWindow, True, 0xfff, &event);
XFlush(display);
XCloseDisplay(display);
}
bool wxUIActionSimulator::MouseMove(long x, long y)
-{
+{
Display *display = XOpenDisplay(0);
wxASSERT_MSG(display, "No display available!");
Window root = DefaultRootWindow(display);
{
Display *display = XOpenDisplay(0);
wxASSERT_MSG(display, "No display available!");
-
+
XKeyEvent event;
int mask = 0xfff;
memset(&event, 0x00, sizeof(event));
-
+
if (isDown) {
event.type = KeyPress;
mask = KeyPressMask;
mask = KeyReleaseMask;
}
event.same_screen = True;
-
+
XQueryPointer(display, RootWindow(display, DefaultScreen(display)), &event.root, &event.window, &event.x_root, &event.y_root, &event.x, &event.y, &event.state);
event.subwindow = event.window;
-
+
while (event.subwindow)
{
event.window = event.subwindow;
XQueryPointer(display, event.window, &event.root, &event.subwindow, &event.x_root, &event.y_root, &event.x, &event.y, &event.state);
}
-
+
XSendEvent(display, PointerWindow, True, mask, (XEvent*) &event);
XFlush(display);
XCloseDisplay(display);
return true;
}
+#endif // wxUSE_UIACTIONSIMULATOR