src/events/SDL_mouse_c.h
author Szymon Wilczek
Sat, 05 Jul 2008 20:02:07 +0000
branchgsoc2008_manymouse
changeset 3765 ed9b7fe8f902
parent 3764 2970fcfbdd54
child 3766 24db5d326f57
permissions -rw-r--r--
Estethic changes noted on the SDL meeting 05.07.08
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;
kazeuser@3760
    61
    int which;
slouken@1895
    62
    int x;
slouken@1895
    63
    int y;
kazeuser@3765
    64
    int z;/*for future use*/
slouken@1895
    65
    int xdelta;
slouken@1895
    66
    int ydelta;
kazeuser@3765
    67
    int pressure;
kazeuser@3765
    68
    int tilt;/*for future use*/
kazeuser@3765
    69
    int rotation;/*for future use*/
kazeuser@3760
    70
    char* name;
slouken@1895
    71
    Uint8 buttonstate;
slouken@1895
    72
    SDL_bool relative_mode;
kazeuser@3764
    73
    SDL_bool proximity;
slouken@1895
    74
    SDL_bool flush_motion;
slouken@1895
    75
slouken@1895
    76
    SDL_Cursor *cursors;
slouken@1895
    77
    SDL_Cursor *def_cursor;
slouken@1895
    78
    SDL_Cursor *cur_cursor;
slouken@1895
    79
    SDL_bool cursor_shown;
slouken@1895
    80
slouken@1895
    81
    void *driverdata;
slouken@1895
    82
};
slouken@1895
    83
slouken@1895
    84
slouken@1895
    85
/* Initialize the mouse subsystem */
slouken@1895
    86
extern int SDL_MouseInit(void);
slouken@1895
    87
slouken@1895
    88
/* Get the mouse at an index */
slouken@1895
    89
extern SDL_Mouse *SDL_GetMouse(int index);
slouken@1895
    90
slouken@1895
    91
/* Add a mouse, possibly reattaching at a particular index (or -1),
slouken@1895
    92
   returning the index of the mouse, or -1 if there was an error.
slouken@1895
    93
 */
kazeuser@3760
    94
extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name);
slouken@1895
    95
slouken@1895
    96
/* Remove a mouse at an index, clearing the slot for later */
slouken@1895
    97
extern void SDL_DelMouse(int index);
slouken@1895
    98
slouken@1895
    99
/* Clear the button state of a mouse at an index */
slouken@1895
   100
extern void SDL_ResetMouse(int index);
slouken@1895
   101
slouken@1895
   102
/* Set the mouse focus window */
slouken@1895
   103
extern void SDL_SetMouseFocus(int index, SDL_WindowID windowID);
slouken@1895
   104
slouken@1895
   105
/* Send a mouse motion event for a mouse at an index */
kazeuser@3760
   106
extern int SDL_SendMouseMotion(int index, int relative, int x, int y, int z);
slouken@1895
   107
slouken@1895
   108
/* Send a mouse button event for a mouse at an index */
slouken@1895
   109
extern int SDL_SendMouseButton(int index, Uint8 state, Uint8 button);
slouken@1895
   110
slouken@1895
   111
/* Send a mouse wheel event for a mouse at an index */
slouken@2152
   112
extern int SDL_SendMouseWheel(int index, int x, int y);
slouken@1895
   113
slouken@1895
   114
/* Shutdown the mouse subsystem */
slouken@1895
   115
extern void SDL_MouseQuit(void);
slouken@1895
   116
kazeuser@3760
   117
extern int SDL_GetIndexById(int id);
kazeuser@3760
   118
kazeuser@3760
   119
extern void SDL_SetIndexId(int id, int index);
kazeuser@3760
   120
kazeuser@3760
   121
extern int SDL_GetNumOfMice(void);
kazeuser@3760
   122
kazeuser@3760
   123
extern char* SDL_GetMouseName(int index);
kazeuser@3760
   124
kazeuser@3764
   125
extern void SDL_UpdateCoordinates(int x, int y);
kazeuser@3760
   126
slouken@1895
   127
#endif /* _SDL_mouse_c_h */
slouken@1895
   128
slouken@1895
   129
/* vi: set ts=4 sw=4 expandtab: */