src/events/SDL_mouse_c.h
author Sam Lantinga <slouken@libsdl.org>
Fri, 15 Feb 2013 08:47:44 -0800
changeset 6885 700f1b25f77f
parent 6675 20f3cdea0fd2
child 6950 1ddb72193079
permissions -rw-r--r--
Happy New Year!
     1 /*
     2   Simple DirectMedia Layer
     3   Copyright (C) 1997-2013 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     /* Create a system cursor */
    40 	SDL_Cursor *(*CreateSystemCursor) (SDL_SystemCursor id);
    41 
    42     /* Show the specified cursor, or hide if cursor is NULL */
    43     int (*ShowCursor) (SDL_Cursor * cursor);
    44 
    45     /* This is called when a mouse motion event occurs */
    46     void (*MoveCursor) (SDL_Cursor * cursor);
    47 
    48     /* Free a window manager cursor */
    49     void (*FreeCursor) (SDL_Cursor * cursor);
    50 
    51     /* Warp the mouse to (x,y) */
    52     void (*WarpMouse) (SDL_Window * window, int x, int y);
    53 
    54     /* Set relative mode */
    55     int (*SetRelativeMouseMode) (SDL_bool enabled);
    56 
    57     /* Data common to all mice */
    58     SDL_Window *focus;
    59     int x;
    60     int y;
    61     int xdelta;
    62     int ydelta;
    63     int last_x, last_y;         /* the last reported x and y coordinates */
    64     Uint32 buttonstate;
    65     SDL_bool relative_mode;
    66     /* the x and y coordinates when relative mode was activated */
    67     int original_x, original_y;
    68 
    69     SDL_Cursor *cursors;
    70     SDL_Cursor *def_cursor;
    71     SDL_Cursor *cur_cursor;
    72     SDL_bool cursor_shown;
    73 } SDL_Mouse;
    74 
    75 
    76 /* Initialize the mouse subsystem */
    77 extern int SDL_MouseInit(void);
    78 
    79 /* Get the mouse state structure */
    80 SDL_Mouse *SDL_GetMouse(void);
    81 
    82 /* Set the default mouse cursor */
    83 extern void SDL_SetDefaultCursor(SDL_Cursor * cursor);
    84 
    85 /* Set the mouse focus window */
    86 extern void SDL_SetMouseFocus(SDL_Window * window);
    87 
    88 /* Send a mouse motion event */
    89 extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y);
    90 
    91 /* Send a mouse button event */
    92 extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button);
    93 
    94 /* Send a mouse wheel event */
    95 extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y);
    96 
    97 /* Shutdown the mouse subsystem */
    98 extern void SDL_MouseQuit(void);
    99 
   100 #endif /* _SDL_mouse_c_h */
   101 
   102 /* vi: set ts=4 sw=4 expandtab: */