src/events/SDL_mouse_c.h
author Sam Lantinga <slouken@libsdl.org>
Mon, 10 Jul 2006 21:04:37 +0000
changeset 1895 c121d94672cb
child 2152 003c1b5b07da
permissions -rw-r--r--
SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
slouken@1895
     1
/*
slouken@1895
     2
    SDL - Simple DirectMedia Layer
slouken@1895
     3
    Copyright (C) 1997-2006 Sam Lantinga
slouken@1895
     4
slouken@1895
     5
    This library is free software; you can redistribute it and/or
slouken@1895
     6
    modify it under the terms of the GNU Lesser General Public
slouken@1895
     7
    License as published by the Free Software Foundation; either
slouken@1895
     8
    version 2.1 of the License, or (at your option) any later version.
slouken@1895
     9
slouken@1895
    10
    This library is distributed in the hope that it will be useful,
slouken@1895
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
slouken@1895
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
slouken@1895
    13
    Lesser General Public License for more details.
slouken@1895
    14
slouken@1895
    15
    You should have received a copy of the GNU Lesser General Public
slouken@1895
    16
    License along with this library; if not, write to the Free Software
slouken@1895
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
slouken@1895
    18
slouken@1895
    19
    Sam Lantinga
slouken@1895
    20
    slouken@libsdl.org
slouken@1895
    21
*/
slouken@1895
    22
#include "SDL_config.h"
slouken@1895
    23
slouken@1895
    24
#ifndef _SDL_mouse_c_h
slouken@1895
    25
#define _SDL_mouse_c_h
slouken@1895
    26
slouken@1895
    27
typedef struct SDL_Mouse SDL_Mouse;
slouken@1895
    28
slouken@1895
    29
struct SDL_Cursor
slouken@1895
    30
{
slouken@1895
    31
    SDL_Mouse *mouse;
slouken@1895
    32
slouken@1895
    33
    SDL_Cursor *next;
slouken@1895
    34
slouken@1895
    35
    void *driverdata;
slouken@1895
    36
};
slouken@1895
    37
slouken@1895
    38
struct SDL_Mouse
slouken@1895
    39
{
slouken@1895
    40
    /* Create a cursor from a surface */
slouken@1895
    41
    SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
slouken@1895
    42
slouken@1895
    43
    /* Show the specified cursor, or hide if cursor is NULL */
slouken@1895
    44
    int (*ShowCursor) (SDL_Cursor * cursor);
slouken@1895
    45
slouken@1895
    46
    /* This is called when a mouse motion event occurs */
slouken@1895
    47
    void (*MoveCursor) (SDL_Cursor * cursor);
slouken@1895
    48
slouken@1895
    49
    /* Free a window manager cursor */
slouken@1895
    50
    void (*FreeCursor) (SDL_Cursor * cursor);
slouken@1895
    51
slouken@1895
    52
    /* Warp the mouse to (x,y) */
slouken@1895
    53
    void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x,
slouken@1895
    54
                       int y);
slouken@1895
    55
slouken@1895
    56
    /* Free the mouse when it's time */
slouken@1895
    57
    void (*FreeMouse) (SDL_Mouse * mouse);
slouken@1895
    58
slouken@1895
    59
    /* Data common to all mice */
slouken@1895
    60
    SDL_WindowID focus;
slouken@1895
    61
    int x;
slouken@1895
    62
    int y;
slouken@1895
    63
    int xdelta;
slouken@1895
    64
    int ydelta;
slouken@1895
    65
    Uint8 buttonstate;
slouken@1895
    66
    SDL_bool relative_mode;
slouken@1895
    67
    SDL_bool flush_motion;
slouken@1895
    68
slouken@1895
    69
    SDL_Cursor *cursors;
slouken@1895
    70
    SDL_Cursor *def_cursor;
slouken@1895
    71
    SDL_Cursor *cur_cursor;
slouken@1895
    72
    SDL_bool cursor_shown;
slouken@1895
    73
slouken@1895
    74
    void *driverdata;
slouken@1895
    75
};
slouken@1895
    76
slouken@1895
    77
slouken@1895
    78
/* Initialize the mouse subsystem */
slouken@1895
    79
extern int SDL_MouseInit(void);
slouken@1895
    80
slouken@1895
    81
/* Get the mouse at an index */
slouken@1895
    82
extern SDL_Mouse *SDL_GetMouse(int index);
slouken@1895
    83
slouken@1895
    84
/* Add a mouse, possibly reattaching at a particular index (or -1),
slouken@1895
    85
   returning the index of the mouse, or -1 if there was an error.
slouken@1895
    86
 */
slouken@1895
    87
extern int SDL_AddMouse(const SDL_Mouse * mouse, int index);
slouken@1895
    88
slouken@1895
    89
/* Remove a mouse at an index, clearing the slot for later */
slouken@1895
    90
extern void SDL_DelMouse(int index);
slouken@1895
    91
slouken@1895
    92
/* Clear the button state of a mouse at an index */
slouken@1895
    93
extern void SDL_ResetMouse(int index);
slouken@1895
    94
slouken@1895
    95
/* Set the mouse focus window */
slouken@1895
    96
extern void SDL_SetMouseFocus(int index, SDL_WindowID windowID);
slouken@1895
    97
slouken@1895
    98
/* Send a mouse motion event for a mouse at an index */
slouken@1895
    99
extern int SDL_SendMouseMotion(int index, int relative, int x, int y);
slouken@1895
   100
slouken@1895
   101
/* Send a mouse button event for a mouse at an index */
slouken@1895
   102
extern int SDL_SendMouseButton(int index, Uint8 state, Uint8 button);
slouken@1895
   103
slouken@1895
   104
/* Send a mouse wheel event for a mouse at an index */
slouken@1895
   105
extern int SDL_SendMouseWheel(int index, int motion);
slouken@1895
   106
slouken@1895
   107
/* Shutdown the mouse subsystem */
slouken@1895
   108
extern void SDL_MouseQuit(void);
slouken@1895
   109
slouken@1895
   110
#endif /* _SDL_mouse_c_h */
slouken@1895
   111
slouken@1895
   112
/* vi: set ts=4 sw=4 expandtab: */