misc/winutils/include/SDL_mouse.h
author unc0rr
Fri, 22 Feb 2013 23:24:20 +0400
changeset 8550 17378d33e62e
parent 7809 7d4fb2f35f4f
child 10017 de822cd3df3a
permissions -rw-r--r--
This change from r0cd63b963330 caused more troubles than solved. Also fix some warnings.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     1
/*
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     2
    SDL - Simple DirectMedia Layer
7809
7d4fb2f35f4f update SDL headers for winutils
koda
parents: 6560
diff changeset
     3
    Copyright (C) 1997-2012 Sam Lantinga
6560
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     4
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     5
    This library is free software; you can redistribute it and/or
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     6
    modify it under the terms of the GNU Lesser General Public
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     7
    License as published by the Free Software Foundation; either
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     8
    version 2.1 of the License, or (at your option) any later version.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
     9
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    10
    This library is distributed in the hope that it will be useful,
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    11
    but WITHOUT ANY WARRANTY; without even the implied warranty of
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    12
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    13
    Lesser General Public License for more details.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    14
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    15
    You should have received a copy of the GNU Lesser General Public
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    16
    License along with this library; if not, write to the Free Software
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    17
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    18
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    19
    Sam Lantinga
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    20
    slouken@libsdl.org
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    21
*/
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    22
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    23
/** @file SDL_mouse.h
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    24
 *  Include file for SDL mouse event handling
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    25
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    26
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    27
#ifndef _SDL_mouse_h
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    28
#define _SDL_mouse_h
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    29
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    30
#include "SDL_stdinc.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    31
#include "SDL_error.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    32
#include "SDL_video.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    33
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    34
#include "begin_code.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    35
/* Set up for C function definitions, even when using C++ */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    36
#ifdef __cplusplus
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    37
extern "C" {
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    38
#endif
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    39
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    40
typedef struct WMcursor WMcursor;	/**< Implementation dependent */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    41
typedef struct SDL_Cursor {
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    42
	SDL_Rect area;			/**< The area of the mouse cursor */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    43
	Sint16 hot_x, hot_y;		/**< The "tip" of the cursor */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    44
	Uint8 *data;			/**< B/W cursor data */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    45
	Uint8 *mask;			/**< B/W cursor mask */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    46
	Uint8 *save[2];			/**< Place to save cursor area */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    47
	WMcursor *wm_cursor;		/**< Window-manager cursor */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    48
} SDL_Cursor;
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    49
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    50
/* Function prototypes */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    51
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    52
 * Retrieve the current state of the mouse.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    53
 * The current button state is returned as a button bitmask, which can
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    54
 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    55
 * current mouse cursor position.  You can pass NULL for either x or y.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    56
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    57
extern DECLSPEC Uint8 SDLCALL SDL_GetMouseState(int *x, int *y);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    58
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    59
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    60
 * Retrieve the current state of the mouse.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    61
 * The current button state is returned as a button bitmask, which can
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    62
 * be tested using the SDL_BUTTON(X) macros, and x and y are set to the
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    63
 * mouse deltas since the last call to SDL_GetRelativeMouseState().
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    64
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    65
extern DECLSPEC Uint8 SDLCALL SDL_GetRelativeMouseState(int *x, int *y);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    66
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    67
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    68
 * Set the position of the mouse cursor (generates a mouse motion event)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    69
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    70
extern DECLSPEC void SDLCALL SDL_WarpMouse(Uint16 x, Uint16 y);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    71
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    72
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    73
 * Create a cursor using the specified data and mask (in MSB format).
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    74
 * The cursor width must be a multiple of 8 bits.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    75
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    76
 * The cursor is created in black and white according to the following:
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    77
 * data  mask    resulting pixel on screen
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    78
 *  0     1       White
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    79
 *  1     1       Black
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    80
 *  0     0       Transparent
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    81
 *  1     0       Inverted color if possible, black if not.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    82
 *
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    83
 * Cursors created with this function must be freed with SDL_FreeCursor().
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    84
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    85
extern DECLSPEC SDL_Cursor * SDLCALL SDL_CreateCursor
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    86
		(Uint8 *data, Uint8 *mask, int w, int h, int hot_x, int hot_y);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    87
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    88
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    89
 * Set the currently active cursor to the specified one.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    90
 * If the cursor is currently visible, the change will be immediately 
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    91
 * represented on the display.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    92
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    93
extern DECLSPEC void SDLCALL SDL_SetCursor(SDL_Cursor *cursor);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    94
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    95
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    96
 * Returns the currently active cursor.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    97
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    98
extern DECLSPEC SDL_Cursor * SDLCALL SDL_GetCursor(void);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
    99
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   100
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   101
 * Deallocates a cursor created with SDL_CreateCursor().
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   102
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   103
extern DECLSPEC void SDLCALL SDL_FreeCursor(SDL_Cursor *cursor);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   104
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   105
/**
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   106
 * Toggle whether or not the cursor is shown on the screen.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   107
 * The cursor start off displayed, but can be turned off.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   108
 * SDL_ShowCursor() returns 1 if the cursor was being displayed
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   109
 * before the call, or 0 if it was not.  You can query the current
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   110
 * state by passing a 'toggle' value of -1.
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   111
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   112
extern DECLSPEC int SDLCALL SDL_ShowCursor(int toggle);
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   113
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   114
/*@{*/
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   115
/** Used as a mask when testing buttons in buttonstate
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   116
 *  Button 1:	Left mouse button
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   117
 *  Button 2:	Middle mouse button
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   118
 *  Button 3:	Right mouse button
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   119
 *  Button 4:	Mouse wheel up	 (may also be a real button)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   120
 *  Button 5:	Mouse wheel down (may also be a real button)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   121
 */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   122
#define SDL_BUTTON(X)		(1 << ((X)-1))
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   123
#define SDL_BUTTON_LEFT		1
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   124
#define SDL_BUTTON_MIDDLE	2
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   125
#define SDL_BUTTON_RIGHT	3
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   126
#define SDL_BUTTON_WHEELUP	4
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   127
#define SDL_BUTTON_WHEELDOWN	5
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   128
#define SDL_BUTTON_X1		6
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   129
#define SDL_BUTTON_X2		7
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   130
#define SDL_BUTTON_LMASK	SDL_BUTTON(SDL_BUTTON_LEFT)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   131
#define SDL_BUTTON_MMASK	SDL_BUTTON(SDL_BUTTON_MIDDLE)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   132
#define SDL_BUTTON_RMASK	SDL_BUTTON(SDL_BUTTON_RIGHT)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   133
#define SDL_BUTTON_X1MASK	SDL_BUTTON(SDL_BUTTON_X1)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   134
#define SDL_BUTTON_X2MASK	SDL_BUTTON(SDL_BUTTON_X2)
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   135
/*@}*/
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   136
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   137
/* Ends C function definitions when using C++ */
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   138
#ifdef __cplusplus
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   139
}
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   140
#endif
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   141
#include "close_code.h"
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   142
ca07e6be08d0 GCI task: cmd.exe
bovi
parents:
diff changeset
   143
#endif /* _SDL_mouse_h */