slouken@1895: /* slouken@1895: SDL - Simple DirectMedia Layer slouken@1895: Copyright (C) 1997-2006 Sam Lantinga slouken@1895: slouken@1895: This library is free software; you can redistribute it and/or slouken@1895: modify it under the terms of the GNU Lesser General Public slouken@1895: License as published by the Free Software Foundation; either slouken@1895: version 2.1 of the License, or (at your option) any later version. slouken@1895: slouken@1895: This library is distributed in the hope that it will be useful, slouken@1895: but WITHOUT ANY WARRANTY; without even the implied warranty of slouken@1895: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU slouken@1895: Lesser General Public License for more details. slouken@1895: slouken@1895: You should have received a copy of the GNU Lesser General Public slouken@1895: License along with this library; if not, write to the Free Software slouken@1895: Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA slouken@1895: slouken@1895: Sam Lantinga slouken@1895: slouken@libsdl.org slouken@1895: */ slouken@1895: #include "SDL_config.h" slouken@1895: slouken@1895: #ifndef _SDL_mouse_c_h slouken@1895: #define _SDL_mouse_c_h slouken@1895: slouken@1895: typedef struct SDL_Mouse SDL_Mouse; slouken@1895: slouken@1895: struct SDL_Cursor slouken@1895: { slouken@1895: SDL_Mouse *mouse; slouken@1895: SDL_Cursor *next; slouken@1895: void *driverdata; slouken@1895: }; slouken@1895: slouken@1895: struct SDL_Mouse slouken@1895: { slouken@1895: /* Create a cursor from a surface */ slouken@1895: SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y); slouken@1895: slouken@1895: /* Show the specified cursor, or hide if cursor is NULL */ slouken@1895: int (*ShowCursor) (SDL_Cursor * cursor); slouken@1895: slouken@1895: /* This is called when a mouse motion event occurs */ slouken@1895: void (*MoveCursor) (SDL_Cursor * cursor); slouken@1895: slouken@1895: /* Free a window manager cursor */ slouken@1895: void (*FreeCursor) (SDL_Cursor * cursor); slouken@1895: slouken@1895: /* Warp the mouse to (x,y) */ slouken@1895: void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x, slouken@1895: int y); slouken@1895: slouken@1895: /* Free the mouse when it's time */ slouken@1895: void (*FreeMouse) (SDL_Mouse * mouse); slouken@1895: slouken@2710: /* data common for tablets */ slouken@2710: int pressure; slouken@2710: int pressure_max; slouken@2710: int pressure_min; slouken@2710: int tilt; /* for future use */ slouken@2710: int rotation; /* for future use */ slouken@2710: int total_ends; slouken@2710: int current_end; slouken@2710: slouken@1895: /* Data common to all mice */ slouken@1895: SDL_WindowID focus; slouken@2710: int which; slouken@1895: int x; slouken@1895: int y; slouken@2710: int z; /* for future use */ slouken@1895: int xdelta; slouken@1895: int ydelta; slouken@2710: char *name; slouken@1895: Uint8 buttonstate; slouken@1895: SDL_bool relative_mode; slouken@2710: SDL_bool proximity; slouken@1895: SDL_bool flush_motion; slouken@1895: slouken@1895: SDL_Cursor *cursors; slouken@1895: SDL_Cursor *def_cursor; slouken@1895: SDL_Cursor *cur_cursor; slouken@1895: SDL_bool cursor_shown; slouken@1895: slouken@1895: void *driverdata; slouken@1895: }; slouken@1895: slouken@1895: /* Initialize the mouse subsystem */ slouken@1895: extern int SDL_MouseInit(void); slouken@1895: slouken@1895: /* Get the mouse at an index */ slouken@1895: extern SDL_Mouse *SDL_GetMouse(int index); slouken@1895: slouken@2710: /* Assign an id to a mouse at an index */ slouken@2710: extern int SDL_SetMouseIndexId(int id, int index); slouken@2710: slouken@2710: /* Get the mouse by id */ slouken@2710: extern SDL_Mouse *SDL_GetMouseByID(int id); slouken@2710: slouken@1895: /* Add a mouse, possibly reattaching at a particular index (or -1), slouken@1895: returning the index of the mouse, or -1 if there was an error. slouken@1895: */ slouken@2710: extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char *name, slouken@2710: int pressure_max, int pressure_min, int ends); slouken@1895: slouken@1895: /* Remove a mouse at an index, clearing the slot for later */ slouken@1895: extern void SDL_DelMouse(int index); slouken@1895: slouken@1895: /* Clear the button state of a mouse at an index */ slouken@1895: extern void SDL_ResetMouse(int index); slouken@1895: slouken@1895: /* Set the mouse focus window */ slouken@2710: extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID); slouken@1895: slouken@1895: /* Send a mouse motion event for a mouse at an index */ slouken@2710: extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z); slouken@1895: slouken@1895: /* Send a mouse button event for a mouse at an index */ slouken@2710: extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button); slouken@1895: slouken@1895: /* Send a mouse wheel event for a mouse at an index */ slouken@2710: extern int SDL_SendMouseWheel(int id, int x, int y); slouken@1895: slouken@1895: /* Shutdown the mouse subsystem */ slouken@1895: extern void SDL_MouseQuit(void); slouken@1895: slouken@2710: /* FIXME: Where do these functions go in this header? */ slouken@2710: extern void SDL_UpdateCoordinates(int x, int y); slouken@2710: extern void SDL_ChangeEnd(int id, int end); slouken@2710: slouken@1895: #endif /* _SDL_mouse_c_h */ slouken@1895: slouken@1895: /* vi: set ts=4 sw=4 expandtab: */