src/events/SDL_mouse_c.h
author Szymon Wilczek <kazeuser@gmail.com>
Wed, 06 Aug 2008 08:48:43 +0000
branchgsoc2008_manymouse
changeset 3776 a9c2a7071874
parent 3774 8b5b67000dc0
permissions -rw-r--r--
upgraded functions
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2006 Sam Lantinga
     4 
     5     This library is free software; you can redistribute it and/or
     6     modify it under the terms of the GNU Lesser General Public
     7     License as published by the Free Software Foundation; either
     8     version 2.1 of the License, or (at your option) any later version.
     9 
    10     This library is distributed in the hope that it will be useful,
    11     but WITHOUT ANY WARRANTY; without even the implied warranty of
    12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    13     Lesser General Public License for more details.
    14 
    15     You should have received a copy of the GNU Lesser General Public
    16     License along with this library; if not, write to the Free Software
    17     Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    18 
    19     Sam Lantinga
    20     slouken@libsdl.org
    21 */
    22 #include "SDL_config.h"
    23 
    24 #ifndef _SDL_mouse_c_h
    25 #define _SDL_mouse_c_h
    26 
    27 typedef struct SDL_Mouse SDL_Mouse;
    28 
    29 struct SDL_Cursor
    30 {
    31     SDL_Mouse *mouse;
    32 
    33     SDL_Cursor *next;
    34 
    35     void *driverdata;
    36 };
    37 
    38 struct SDL_Mouse
    39 {
    40     /* Create a cursor from a surface */
    41     SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
    42 
    43     /* Show the specified cursor, or hide if cursor is NULL */
    44     int (*ShowCursor) (SDL_Cursor * cursor);
    45 
    46     /* This is called when a mouse motion event occurs */
    47     void (*MoveCursor) (SDL_Cursor * cursor);
    48 
    49     /* Free a window manager cursor */
    50     void (*FreeCursor) (SDL_Cursor * cursor);
    51 
    52     /* Warp the mouse to (x,y) */
    53     void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x,
    54                        int y);
    55 
    56     /* Free the mouse when it's time */
    57     void (*FreeMouse) (SDL_Mouse * mouse);
    58 
    59     /*data common for tablets*/
    60     int pressure;
    61     int pressure_max;
    62     int pressure_min;
    63     int tilt;/*for future use*/
    64     int rotation;/*for future use*/
    65     int total_ends;
    66     int current_end;
    67 
    68     /* Data common to all mice */
    69     SDL_WindowID focus;
    70     int which;
    71     int x;
    72     int y;
    73     int z;/*for future use*/
    74     int xdelta;
    75     int ydelta;
    76 
    77     char* name;
    78     Uint8 buttonstate;
    79     SDL_bool relative_mode;
    80     SDL_bool proximity;
    81     SDL_bool flush_motion;
    82 
    83     SDL_Cursor *cursors;
    84     SDL_Cursor *def_cursor;
    85     SDL_Cursor *cur_cursor;
    86     SDL_bool cursor_shown;
    87 
    88     void *driverdata;
    89 };
    90 
    91 
    92 /* Initialize the mouse subsystem */
    93 extern int SDL_MouseInit(void);
    94 
    95 /* Get the mouse at an index */
    96 extern SDL_Mouse *SDL_GetMouse(int index);
    97 
    98 /* Add a mouse, possibly reattaching at a particular index (or -1),
    99    returning the index of the mouse, or -1 if there was an error.
   100  */
   101 extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name,\
   102  int pressure_max, int pressure_min, int ends);
   103 
   104 /* Remove a mouse at an index, clearing the slot for later */
   105 extern void SDL_DelMouse(int index);
   106 
   107 /* Clear the button state of a mouse at an index */
   108 extern void SDL_ResetMouse(int index);
   109 
   110 /* Set the mouse focus window */
   111 extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);
   112 
   113 /* Send a mouse motion event for a mouse at an index */
   114 extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
   115 
   116 /* Send a mouse button event for a mouse at an index */
   117 extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);
   118 
   119 /* Send a mouse wheel event for a mouse at an index */
   120 extern int SDL_SendMouseWheel(int id, int x, int y);
   121 
   122 /* Shutdown the mouse subsystem */
   123 extern void SDL_MouseQuit(void);
   124 
   125 extern int SDL_GetIndexById(int id);
   126 
   127 extern int SDL_SetIndexId(int id, int index);
   128 
   129 extern int SDL_GetNumOfMice(void);
   130 
   131 extern char* SDL_GetMouseName(int index);
   132 
   133 extern void SDL_UpdateCoordinates(int x, int y);
   134 
   135 extern void SDL_ChangeEnd(int id, int end);
   136 
   137 extern int SDL_GetCursorsNumber(int index);
   138 
   139 #endif /* _SDL_mouse_c_h */
   140 
   141 /* vi: set ts=4 sw=4 expandtab: */
   142