src/events/SDL_mouse_c.h
author Sam Lantinga
Mon, 21 Feb 2011 17:15:50 -0800
changeset 5376 183ec2d4485c
parent 5371 fc3d3d580777
child 5405 64fa8526e1ce
permissions -rw-r--r--
Implemented cursor support and SDL_WarpMouseInWindow() on Mac OS X
slouken@1895
     1
/*
slouken@1895
     2
    SDL - Simple DirectMedia Layer
slouken@5262
     3
    Copyright (C) 1997-2011 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@5371
    27
#include "SDL_mouse.h"
slouken@5371
    28
slouken@1895
    29
struct SDL_Cursor
slouken@1895
    30
{
slouken@5001
    31
    struct SDL_Cursor *next;
slouken@1895
    32
    void *driverdata;
slouken@1895
    33
};
slouken@1895
    34
slouken@5371
    35
typedef struct
slouken@5371
    36
{
slouken@5371
    37
    /* Create a cursor from a surface */
slouken@5371
    38
    SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
slouken@5371
    39
slouken@5371
    40
    /* Show the specified cursor, or hide if cursor is NULL */
slouken@5371
    41
    int (*ShowCursor) (SDL_Cursor * cursor);
slouken@5371
    42
slouken@5371
    43
    /* This is called when a mouse motion event occurs */
slouken@5371
    44
    void (*MoveCursor) (SDL_Cursor * cursor);
slouken@5371
    45
slouken@5371
    46
    /* Free a window manager cursor */
slouken@5371
    47
    void (*FreeCursor) (SDL_Cursor * cursor);
slouken@5371
    48
slouken@5371
    49
    /* Warp the mouse to (x,y) */
slouken@5371
    50
    void (*WarpMouse) (SDL_Window * window, int x, int y);
slouken@5371
    51
slouken@5371
    52
    /* Data common to all mice */
slouken@5371
    53
    SDL_Window *focus;
slouken@5371
    54
    int x;
slouken@5371
    55
    int y;
slouken@5371
    56
    int xdelta;
slouken@5371
    57
    int ydelta;
slouken@5371
    58
    int last_x, last_y;         /* the last reported x and y coordinates */
slouken@5371
    59
    Uint8 buttonstate;
slouken@5371
    60
    SDL_bool relative_mode;
slouken@5371
    61
slouken@5371
    62
    SDL_Cursor *cursors;
slouken@5371
    63
    SDL_Cursor *def_cursor;
slouken@5371
    64
    SDL_Cursor *cur_cursor;
slouken@5371
    65
    SDL_bool cursor_shown;
slouken@5371
    66
} SDL_Mouse;
slouken@5371
    67
slouken@5371
    68
slouken@1895
    69
/* Initialize the mouse subsystem */
slouken@1895
    70
extern int SDL_MouseInit(void);
slouken@1895
    71
slouken@5371
    72
/* Get the mouse state structure */
slouken@5371
    73
SDL_Mouse *SDL_GetMouse(void);
slouken@5371
    74
slouken@1895
    75
/* Set the mouse focus window */
slouken@4465
    76
extern void SDL_SetMouseFocus(SDL_Window * window);
slouken@1895
    77
slouken@4465
    78
/* Send a mouse motion event */
slouken@4484
    79
extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y);
slouken@1895
    80
slouken@4465
    81
/* Send a mouse button event */
slouken@4484
    82
extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button);
slouken@1895
    83
slouken@4465
    84
/* Send a mouse wheel event */
slouken@4484
    85
extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y);
slouken@2727
    86
slouken@1895
    87
/* Shutdown the mouse subsystem */
slouken@1895
    88
extern void SDL_MouseQuit(void);
slouken@1895
    89
slouken@1895
    90
#endif /* _SDL_mouse_c_h */
slouken@1895
    91
slouken@1895
    92
/* vi: set ts=4 sw=4 expandtab: */