src/events/SDL_mouse_c.h
author Sam Lantinga
Fri, 08 Apr 2011 13:03:26 -0700
changeset 5535 96594ac5fd1a
parent 5406 1517da4ab6b1
child 6138 4c64952a58fb
permissions -rw-r--r--
SDL 1.3 is now under the zlib license.
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
     4 
     5   This software is provided 'as-is', without any express or implied
     6   warranty.  In no event will the authors be held liable for any damages
     7   arising from the use of this software.
     8 
     9   Permission is granted to anyone to use this software for any purpose,
    10   including commercial applications, and to alter it and redistribute it
    11   freely, subject to the following restrictions:
    12 
    13   1. The origin of this software must not be misrepresented; you must not
    14      claim that you wrote the original software. If you use this software
    15      in a product, an acknowledgment in the product documentation would be
    16      appreciated but is not required.
    17   2. Altered source versions must be plainly marked as such, and must not be
    18      misrepresented as being the original software.
    19   3. This notice may not be removed or altered from any source distribution.
    20 */
    21 #include "SDL_config.h"
    22 
    23 #ifndef _SDL_mouse_c_h
    24 #define _SDL_mouse_c_h
    25 
    26 #include "SDL_mouse.h"
    27 
    28 struct SDL_Cursor
    29 {
    30     struct SDL_Cursor *next;
    31     void *driverdata;
    32 };
    33 
    34 typedef struct
    35 {
    36     /* Create a cursor from a surface */
    37     SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
    38 
    39     /* Show the specified cursor, or hide if cursor is NULL */
    40     int (*ShowCursor) (SDL_Cursor * cursor);
    41 
    42     /* This is called when a mouse motion event occurs */
    43     void (*MoveCursor) (SDL_Cursor * cursor);
    44 
    45     /* Free a window manager cursor */
    46     void (*FreeCursor) (SDL_Cursor * cursor);
    47 
    48     /* Warp the mouse to (x,y) */
    49     void (*WarpMouse) (SDL_Window * window, int x, int y);
    50 
    51     /* Set relative mode */
    52     int (*SetRelativeMouseMode) (SDL_bool enabled);
    53 
    54     /* Data common to all mice */
    55     SDL_Window *focus;
    56     int x;
    57     int y;
    58     int xdelta;
    59     int ydelta;
    60     int last_x, last_y;         /* the last reported x and y coordinates */
    61     Uint8 buttonstate;
    62     SDL_bool relative_mode;
    63 
    64     SDL_Cursor *cursors;
    65     SDL_Cursor *def_cursor;
    66     SDL_Cursor *cur_cursor;
    67     SDL_bool cursor_shown;
    68 } SDL_Mouse;
    69 
    70 
    71 /* Initialize the mouse subsystem */
    72 extern int SDL_MouseInit(void);
    73 
    74 /* Get the mouse state structure */
    75 SDL_Mouse *SDL_GetMouse(void);
    76 
    77 /* Set the default mouse cursor */
    78 extern void SDL_SetDefaultCursor(SDL_Cursor * cursor);
    79 
    80 /* Set the mouse focus window */
    81 extern void SDL_SetMouseFocus(SDL_Window * window);
    82 
    83 /* Send a mouse motion event */
    84 extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y);
    85 
    86 /* Send a mouse button event */
    87 extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button);
    88 
    89 /* Send a mouse wheel event */
    90 extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y);
    91 
    92 /* Shutdown the mouse subsystem */
    93 extern void SDL_MouseQuit(void);
    94 
    95 #endif /* _SDL_mouse_c_h */
    96 
    97 /* vi: set ts=4 sw=4 expandtab: */