src/events/SDL_mouse_c.h
author Szymon Wilczek
Wed, 06 Aug 2008 08:48:43 +0000
branchgsoc2008_manymouse
changeset 3776 a9c2a7071874
parent 3774 8b5b67000dc0
permissions -rw-r--r--
upgraded functions
kazeuser@3769
     1
/*
kazeuser@3769
     2
    SDL - Simple DirectMedia Layer
kazeuser@3769
     3
    Copyright (C) 1997-2006 Sam Lantinga
kazeuser@3769
     4
kazeuser@3769
     5
    This library is free software; you can redistribute it and/or
kazeuser@3769
     6
    modify it under the terms of the GNU Lesser General Public
kazeuser@3769
     7
    License as published by the Free Software Foundation; either
kazeuser@3769
     8
    version 2.1 of the License, or (at your option) any later version.
kazeuser@3769
     9
kazeuser@3769
    10
    This library is distributed in the hope that it will be useful,
kazeuser@3769
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
kazeuser@3769
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
kazeuser@3769
    13
    Lesser General Public License for more details.
kazeuser@3769
    14
kazeuser@3769
    15
    You should have received a copy of the GNU Lesser General Public
kazeuser@3769
    16
    License along with this library; if not, write to the Free Software
kazeuser@3769
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
kazeuser@3769
    18
kazeuser@3769
    19
    Sam Lantinga
kazeuser@3769
    20
    slouken@libsdl.org
kazeuser@3769
    21
*/
kazeuser@3769
    22
#include "SDL_config.h"
kazeuser@3769
    23
kazeuser@3769
    24
#ifndef _SDL_mouse_c_h
kazeuser@3769
    25
#define _SDL_mouse_c_h
kazeuser@3769
    26
kazeuser@3769
    27
typedef struct SDL_Mouse SDL_Mouse;
kazeuser@3769
    28
kazeuser@3769
    29
struct SDL_Cursor
kazeuser@3769
    30
{
kazeuser@3769
    31
    SDL_Mouse *mouse;
kazeuser@3769
    32
kazeuser@3769
    33
    SDL_Cursor *next;
kazeuser@3769
    34
kazeuser@3769
    35
    void *driverdata;
kazeuser@3769
    36
};
kazeuser@3769
    37
kazeuser@3769
    38
struct SDL_Mouse
kazeuser@3769
    39
{
kazeuser@3769
    40
    /* Create a cursor from a surface */
kazeuser@3769
    41
    SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
kazeuser@3769
    42
kazeuser@3769
    43
    /* Show the specified cursor, or hide if cursor is NULL */
kazeuser@3769
    44
    int (*ShowCursor) (SDL_Cursor * cursor);
kazeuser@3769
    45
kazeuser@3769
    46
    /* This is called when a mouse motion event occurs */
kazeuser@3769
    47
    void (*MoveCursor) (SDL_Cursor * cursor);
kazeuser@3769
    48
kazeuser@3769
    49
    /* Free a window manager cursor */
kazeuser@3769
    50
    void (*FreeCursor) (SDL_Cursor * cursor);
kazeuser@3769
    51
kazeuser@3769
    52
    /* Warp the mouse to (x,y) */
kazeuser@3769
    53
    void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x,
kazeuser@3769
    54
                       int y);
kazeuser@3769
    55
kazeuser@3769
    56
    /* Free the mouse when it's time */
kazeuser@3769
    57
    void (*FreeMouse) (SDL_Mouse * mouse);
kazeuser@3769
    58
kazeuser@3773
    59
    /*data common for tablets*/
kazeuser@3773
    60
    int pressure;
kazeuser@3773
    61
    int pressure_max;
kazeuser@3773
    62
    int pressure_min;
kazeuser@3773
    63
    int tilt;/*for future use*/
kazeuser@3773
    64
    int rotation;/*for future use*/
kazeuser@3774
    65
    int total_ends;
kazeuser@3774
    66
    int current_end;
kazeuser@3773
    67
kazeuser@3769
    68
    /* Data common to all mice */
kazeuser@3769
    69
    SDL_WindowID focus;
kazeuser@3769
    70
    int which;
kazeuser@3769
    71
    int x;
kazeuser@3769
    72
    int y;
kazeuser@3769
    73
    int z;/*for future use*/
kazeuser@3769
    74
    int xdelta;
kazeuser@3769
    75
    int ydelta;
kazeuser@3773
    76
kazeuser@3769
    77
    char* name;
kazeuser@3769
    78
    Uint8 buttonstate;
kazeuser@3769
    79
    SDL_bool relative_mode;
kazeuser@3769
    80
    SDL_bool proximity;
kazeuser@3769
    81
    SDL_bool flush_motion;
kazeuser@3769
    82
kazeuser@3769
    83
    SDL_Cursor *cursors;
kazeuser@3769
    84
    SDL_Cursor *def_cursor;
kazeuser@3769
    85
    SDL_Cursor *cur_cursor;
kazeuser@3769
    86
    SDL_bool cursor_shown;
kazeuser@3769
    87
kazeuser@3769
    88
    void *driverdata;
kazeuser@3769
    89
};
kazeuser@3769
    90
kazeuser@3769
    91
kazeuser@3769
    92
/* Initialize the mouse subsystem */
kazeuser@3769
    93
extern int SDL_MouseInit(void);
kazeuser@3769
    94
kazeuser@3769
    95
/* Get the mouse at an index */
kazeuser@3769
    96
extern SDL_Mouse *SDL_GetMouse(int index);
kazeuser@3769
    97
kazeuser@3769
    98
/* Add a mouse, possibly reattaching at a particular index (or -1),
kazeuser@3769
    99
   returning the index of the mouse, or -1 if there was an error.
kazeuser@3769
   100
 */
kazeuser@3774
   101
extern int SDL_AddMouse(const SDL_Mouse * mouse, int index, char* name,\
kazeuser@3774
   102
 int pressure_max, int pressure_min, int ends);
kazeuser@3769
   103
kazeuser@3769
   104
/* Remove a mouse at an index, clearing the slot for later */
kazeuser@3769
   105
extern void SDL_DelMouse(int index);
kazeuser@3769
   106
kazeuser@3769
   107
/* Clear the button state of a mouse at an index */
kazeuser@3769
   108
extern void SDL_ResetMouse(int index);
kazeuser@3769
   109
kazeuser@3769
   110
/* Set the mouse focus window */
kazeuser@3776
   111
extern void SDL_SetMouseFocus(int id, SDL_WindowID windowID);
kazeuser@3769
   112
kazeuser@3769
   113
/* Send a mouse motion event for a mouse at an index */
kazeuser@3776
   114
extern int SDL_SendMouseMotion(int id, int relative, int x, int y, int z);
kazeuser@3769
   115
kazeuser@3769
   116
/* Send a mouse button event for a mouse at an index */
kazeuser@3776
   117
extern int SDL_SendMouseButton(int id, Uint8 state, Uint8 button);
kazeuser@3769
   118
kazeuser@3769
   119
/* Send a mouse wheel event for a mouse at an index */
kazeuser@3776
   120
extern int SDL_SendMouseWheel(int id, int x, int y);
kazeuser@3769
   121
kazeuser@3769
   122
/* Shutdown the mouse subsystem */
kazeuser@3769
   123
extern void SDL_MouseQuit(void);
kazeuser@3769
   124
kazeuser@3769
   125
extern int SDL_GetIndexById(int id);
kazeuser@3769
   126
kazeuser@3769
   127
extern int SDL_SetIndexId(int id, int index);
kazeuser@3769
   128
kazeuser@3769
   129
extern int SDL_GetNumOfMice(void);
kazeuser@3769
   130
kazeuser@3769
   131
extern char* SDL_GetMouseName(int index);
kazeuser@3769
   132
kazeuser@3769
   133
extern void SDL_UpdateCoordinates(int x, int y);
kazeuser@3769
   134
kazeuser@3774
   135
extern void SDL_ChangeEnd(int id, int end);
kazeuser@3774
   136
kazeuser@3774
   137
extern int SDL_GetCursorsNumber(int index);
kazeuser@3774
   138
kazeuser@3769
   139
#endif /* _SDL_mouse_c_h */
kazeuser@3769
   140
kazeuser@3769
   141
/* vi: set ts=4 sw=4 expandtab: */
kazeuser@3769
   142