src/events/SDL_mouse_c.h
author Sam Lantinga
Sun, 27 Feb 2011 21:36:23 -0800
changeset 5405 64fa8526e1ce
parent 5376 183ec2d4485c
child 5406 1517da4ab6b1
permissions -rw-r--r--
Added a cleaner way to set the default cursor.
Added a way to cycle through the default cursor in testcursor.c
     1 /*
     2     SDL - Simple DirectMedia Layer
     3     Copyright (C) 1997-2011 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 #include "SDL_mouse.h"
    28 
    29 struct SDL_Cursor
    30 {
    31     struct SDL_Cursor *next;
    32     void *driverdata;
    33 };
    34 
    35 typedef struct
    36 {
    37     /* Create a cursor from a surface */
    38     SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
    39 
    40     /* Show the specified cursor, or hide if cursor is NULL */
    41     int (*ShowCursor) (SDL_Cursor * cursor);
    42 
    43     /* This is called when a mouse motion event occurs */
    44     void (*MoveCursor) (SDL_Cursor * cursor);
    45 
    46     /* Free a window manager cursor */
    47     void (*FreeCursor) (SDL_Cursor * cursor);
    48 
    49     /* Warp the mouse to (x,y) */
    50     void (*WarpMouse) (SDL_Window * window, int x, int y);
    51 
    52     /* Data common to all mice */
    53     SDL_Window *focus;
    54     int x;
    55     int y;
    56     int xdelta;
    57     int ydelta;
    58     int last_x, last_y;         /* the last reported x and y coordinates */
    59     Uint8 buttonstate;
    60     SDL_bool relative_mode;
    61 
    62     SDL_Cursor *cursors;
    63     SDL_Cursor *def_cursor;
    64     SDL_Cursor *cur_cursor;
    65     SDL_bool cursor_shown;
    66 } SDL_Mouse;
    67 
    68 
    69 /* Initialize the mouse subsystem */
    70 extern int SDL_MouseInit(void);
    71 
    72 /* Get the mouse state structure */
    73 SDL_Mouse *SDL_GetMouse(void);
    74 
    75 /* Set the default mouse cursor */
    76 extern void SDL_SetDefaultCursor(SDL_Cursor * cursor);
    77 
    78 /* Set the mouse focus window */
    79 extern void SDL_SetMouseFocus(SDL_Window * window);
    80 
    81 /* Send a mouse motion event */
    82 extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y);
    83 
    84 /* Send a mouse button event */
    85 extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button);
    86 
    87 /* Send a mouse wheel event */
    88 extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y);
    89 
    90 /* Shutdown the mouse subsystem */
    91 extern void SDL_MouseQuit(void);
    92 
    93 #endif /* _SDL_mouse_c_h */
    94 
    95 /* vi: set ts=4 sw=4 expandtab: */