libcvautomation
2.0
|
00001 /* 00002 * ===================================================================================== 00003 * 00004 * Filename: libcvautomation-xinput.h 00005 * 00006 * Description: 00007 * 00008 * Created: 06/26/2012 09:08:41 AM 00009 * Revision: none 00010 * Compiler: gcc 00011 * 00012 * Author: Bradlee Speice (), bspeice.nc@gmail.com 00013 * Organization: 00014 * 00015 * ===================================================================================== 00016 */ 00017 00018 #ifndef LIBCVAUTOMATION_XTEST_H 00019 #define LIBCVAUTOMATION_XTEST_H 00020 00021 #include <libcvautomation/libcvautomation.h> 00022 00023 #define IS_CMD( x, y ) strncmp( x, y, strlen( y ) ) == 0 00024 #define COMMAND_STR_LEN 512 00025 00026 /* Make sure that the XTest extension is supported. 00027 * If it's not, return 0 (false) */ 00028 Bool xte_XTestSupported ( Display *displayLocation ); 00029 00030 /* Get the current location of the mouse */ 00031 cvaPoint xte_mouseLocation ( Display *displayLocation ); 00032 00033 /* Click the mouse where it is currently at */ 00034 void xte_clickMouse ( Display *displayLocation, int mouseButton ); 00035 00036 /* Click the mouse on an absolute screen location */ 00037 void xte_clickMouseXY ( Display *displayLocation, int xLocation, int yLocation, int mouseButton ); 00038 00039 /* Click the mouse on a screen location relative to where it currently is */ 00040 void xte_clickMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement, int mouseButton ); 00041 00042 /* Click the mouse at the top-left corner of an image on the specified display */ 00043 cvaPoint xte_clickMouseImage ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance ); 00044 00045 /* Click the mouse at the top-left corner of an image on the specified display 00046 * where the subImage is a file location */ 00047 cvaPoint xte_clickMouseImage_location ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance ); 00048 00049 /* Click the mouse at the center of an image on the specified display */ 00050 cvaPoint xte_clickMouseImage_center ( Display *displayLocation, IplImage *subImage, int mouseButton, int searchMethod, int tolerance ); 00051 00052 /* Click the mouse at the center of an image on the specified display 00053 * where the subImage is a file location */ 00054 cvaPoint xte_clickMouseImage_location_center ( Display *displayLocation, const char *fileName, int mouseButton, int searchMethod, int tolerance ); 00055 00056 /* Move the mouse to a location and leave it there */ 00057 void xte_hoverMouseXY ( Display *displayLocation, int xLocation, int yLocation ); 00058 00059 /* Move the mouse to a location relative to where it currently is and leave it there */ 00060 void xte_hoverMouseRXY ( Display *displayLocation, int xIncrement, int yIncrement ); 00061 00062 /* Move the mouse to a location at the top-left corner of an image on the specified display 00063 * but don't click the mouse */ 00064 cvaPoint xte_hoverMouseImage ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance ); 00065 00066 /* Move the mouse to a location at the top-left corner of an image from file on the specified display 00067 * but don't click the mouse */ 00068 cvaPoint xte_hoverMouseImage_location ( Display *displayLocation, const char *filename, int searchMethod, int tolerance ); 00069 00070 /* Move the mouse to a location at the center of an image on the specified display 00071 * but don't click the mouse */ 00072 cvaPoint xte_hoverMouseImage_center ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance ); 00073 00074 /* Move the mouse to a location at the center of an image from file on the specified display 00075 * but don't click the mouse */ 00076 cvaPoint xte_hoverMouseImage_location_center ( Display *displayLocation, const char *fileName, int searchMethod, int tolerance ); 00077 00078 /* Push a mouse button down, but don't release it */ 00079 void xte_mouseDown ( Display *displayLocation, int mouseButton ); 00080 00081 /* Let a mouse button up */ 00082 void xte_mouseUp ( Display *displayLocation, int mouseButton ); 00083 00084 /* Move the mouse a little bit */ 00085 void xte_mouseJiggle ( Display *displayLocation ); 00086 00087 /* Scroll the mouse up */ 00088 void xte_mouseScrollUp ( Display *displayLocation ); 00089 00090 /* Scroll the mouse down */ 00091 void xte_mouseScrollDown ( Display *displayLocation ); 00092 00093 /* Press and release a key 00094 * Note that we use a string for *key, since keys like "space" are still valid. */ 00095 void xte_clickKey ( Display *displayLocation, char *key ); 00096 00097 /* Press and release keys in a string */ 00098 void xte_clickKeyStr ( Display *displayLocation, char *string ); 00099 00100 /* Press a key down */ 00101 void xte_keyDown ( Display *displayLocation, char *key ); 00102 00103 /* Release a key */ 00104 void xte_keyUp ( Display *displayLocation, char *key ); 00105 00106 /* Wait for an image to show up on screen */ 00107 cvaPoint xte_waitForImage ( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance, int timeout ); 00108 00109 /* Wait for an image from file to show up on screen */ 00110 cvaPoint xte_waitForImage_location ( Display *displayLocation, const char *fileName, int searchMethod, int tolerance, int timeout ); 00111 00112 /* Wait for an image to show up on screen, return the center point */ 00113 cvaPoint xte_waitForImage_center( Display *displayLocation, IplImage *subImage, int searchMethod, int tolerance, int timeout ); 00114 00115 /* Wait for an image from file to show up on screen, return the center point */ 00116 cvaPoint xte_waitForImage_location_center( Display *displayLocation, const char *fileName, int searchMethod, int tolerance, int timeout ); 00117 00118 /* Use one of the functions by command name */ 00119 cvaPoint xte_commandString ( Display *displayLocation, char *commandString, int mouseButton, int searchMethod, int tolerance, int timeout ); 00120 00121 #endif /* LIBCVAUTOMATION_XTEST_H */ 00122 00123 /* Doxygen information */