src/events/SDL_mouse_c.h
author Sam Lantinga
Sun, 20 Nov 2011 19:38:18 -0500
changeset 6091 61fa4f3238c5
parent 5535 96594ac5fd1a
child 6138 4c64952a58fb
permissions -rw-r--r--
First pass at a simple drag and drop API, allowing you to accept files dropped into your application.
slouken@1895
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@5535
     3
  Copyright (C) 1997-2011 Sam Lantinga <slouken@libsdl.org>
slouken@1895
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@1895
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@1895
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@1895
    20
*/
slouken@1895
    21
#include "SDL_config.h"
slouken@1895
    22
slouken@1895
    23
#ifndef _SDL_mouse_c_h
slouken@1895
    24
#define _SDL_mouse_c_h
slouken@1895
    25
slouken@5371
    26
#include "SDL_mouse.h"
slouken@5371
    27
slouken@1895
    28
struct SDL_Cursor
slouken@1895
    29
{
slouken@5001
    30
    struct SDL_Cursor *next;
slouken@1895
    31
    void *driverdata;
slouken@1895
    32
};
slouken@1895
    33
slouken@5371
    34
typedef struct
slouken@5371
    35
{
slouken@5371
    36
    /* Create a cursor from a surface */
slouken@5371
    37
    SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
slouken@5371
    38
slouken@5371
    39
    /* Show the specified cursor, or hide if cursor is NULL */
slouken@5371
    40
    int (*ShowCursor) (SDL_Cursor * cursor);
slouken@5371
    41
slouken@5371
    42
    /* This is called when a mouse motion event occurs */
slouken@5371
    43
    void (*MoveCursor) (SDL_Cursor * cursor);
slouken@5371
    44
slouken@5371
    45
    /* Free a window manager cursor */
slouken@5371
    46
    void (*FreeCursor) (SDL_Cursor * cursor);
slouken@5371
    47
slouken@5371
    48
    /* Warp the mouse to (x,y) */
slouken@5371
    49
    void (*WarpMouse) (SDL_Window * window, int x, int y);
slouken@5371
    50
slouken@5406
    51
    /* Set relative mode */
slouken@5406
    52
    int (*SetRelativeMouseMode) (SDL_bool enabled);
slouken@5406
    53
slouken@5371
    54
    /* Data common to all mice */
slouken@5371
    55
    SDL_Window *focus;
slouken@5371
    56
    int x;
slouken@5371
    57
    int y;
slouken@5371
    58
    int xdelta;
slouken@5371
    59
    int ydelta;
slouken@5371
    60
    int last_x, last_y;         /* the last reported x and y coordinates */
slouken@5371
    61
    Uint8 buttonstate;
slouken@5371
    62
    SDL_bool relative_mode;
slouken@5371
    63
slouken@5371
    64
    SDL_Cursor *cursors;
slouken@5371
    65
    SDL_Cursor *def_cursor;
slouken@5371
    66
    SDL_Cursor *cur_cursor;
slouken@5371
    67
    SDL_bool cursor_shown;
slouken@5371
    68
} SDL_Mouse;
slouken@5371
    69
slouken@5371
    70
slouken@1895
    71
/* Initialize the mouse subsystem */
slouken@1895
    72
extern int SDL_MouseInit(void);
slouken@1895
    73
slouken@5371
    74
/* Get the mouse state structure */
slouken@5371
    75
SDL_Mouse *SDL_GetMouse(void);
slouken@5371
    76
slouken@5405
    77
/* Set the default mouse cursor */
slouken@5405
    78
extern void SDL_SetDefaultCursor(SDL_Cursor * cursor);
slouken@5405
    79
slouken@1895
    80
/* Set the mouse focus window */
slouken@4465
    81
extern void SDL_SetMouseFocus(SDL_Window * window);
slouken@1895
    82
slouken@4465
    83
/* Send a mouse motion event */
slouken@4484
    84
extern int SDL_SendMouseMotion(SDL_Window * window, int relative, int x, int y);
slouken@1895
    85
slouken@4465
    86
/* Send a mouse button event */
slouken@4484
    87
extern int SDL_SendMouseButton(SDL_Window * window, Uint8 state, Uint8 button);
slouken@1895
    88
slouken@4465
    89
/* Send a mouse wheel event */
slouken@4484
    90
extern int SDL_SendMouseWheel(SDL_Window * window, int x, int y);
slouken@2727
    91
slouken@1895
    92
/* Shutdown the mouse subsystem */
slouken@1895
    93
extern void SDL_MouseQuit(void);
slouken@1895
    94
slouken@1895
    95
#endif /* _SDL_mouse_c_h */
slouken@1895
    96
slouken@1895
    97
/* vi: set ts=4 sw=4 expandtab: */