/** * current setting what to do if mouse is moved outside Sikuli's mouse protection * * @return current setting see {@link #setMouseMovedAction(int)} */ public static int getMouseMovedResponse() { return get().device.mouseMovedResponse; }
public static void setMouseMovedHighlight(boolean state) { get().device.MouseMovedHighlight = state; }
/** * what to do if mouse is moved outside Sikuli's mouse protection <br> * only 3 is honored:<br> * in case of event the user provided callBack.happened is called * * @param callBack ObserverCallBack */ public static void setMouseMovedCallback(Object callBack) { if (callBack != null) { get().device.mouseMovedResponse = 3; get().device.mouseMovedCallback = new ObserverCallBack(callBack, ObserveEvent.Type.GENERIC); } }
public static void reset() { if (mouse == null) { return; } get().device.unblock(get().device.owner); mouse.get().device.let(get().device.owner); get().device.let(get().device.owner); get().device.mouseMovedResponse = get().device.MouseMovedIgnore; get().device.mouseMovedCallback = null; get().device.callback = null; get().device.lastPos = null; Screen.getPrimaryScreen().getRobot().mouseReset(); }
/** * what to do if mouse is moved outside Sikuli's mouse protection <br> * - Mouse.MouseMovedIgnore (0) ignore it (default) <br> * - Mouse.MouseMovedShow (1) show and ignore it <br> * - Mouse.MouseMovedPause (2) show it and pause until user says continue <br> * (2 not implemented yet - 1 is used) * * @param movedAction value */ public static void setMouseMovedAction(int movedAction) { if (movedAction > -1 && movedAction < 3) { get().device.mouseMovedResponse = movedAction; get().device.mouseMovedCallback = null; log(lvl, "setMouseMovedAction: %d", get().device.mouseMovedResponse); } }
public static Location at() { return get().device.getLocation(); }
protected static boolean use() { return get().device.use(null); }
protected static boolean use(Object owner) { return get().device.use(owner); }
protected static boolean keep(Object owner) { return get().device.keep(owner); }
protected static boolean let() { return get().device.let(null); }
protected static void wheel(int direction, int steps, Region region, int stepDelay) { if (get().device.isSuspended()) { return; } IRobot r = Screen.getRobot(region); get().device.use(region); Debug.log(3, "Region: wheel: %s steps: %d", (direction == WHEEL_UP ? "WHEEL_UP" : "WHEEL_DOWN"), steps); for (int i = 0; i < steps; i++) { r.mouseWheel(direction); r.delay(stepDelay); } get().device.let(region); } }
protected static int move(Location loc, Region region) { if (get().device.isSuspended()) { return 0; } if (loc != null) { IRobot r = null; IScreen s = loc.getScreen(); if (s == null) { return 0; } r = s.getRobot(); if (r == null) { return 0; } if (!r.isRemote()) { get().device.use(region); } r.smoothMove(loc); r.waitForIdle(); if (!r.isRemote()) { get().device.let(region); } return 1; } return 0; }