annotate src/events/SDL_mouse_c.h @ 1682:7ae8018b2e5d SDL-1.3

Default palette entries to white, instead of black. More palettized video mode support...
author Sam Lantinga <slouken@libsdl.org>
date Fri, 16 Jun 2006 06:00:31 +0000
parents 89f7510fe17a
children 5daa04d862f1
rev   line source
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
1 /*
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
3 Copyright (C) 1997-2006 Sam Lantinga
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
4
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
6 modify it under the terms of the GNU Lesser General Public
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
8 version 2.1 of the License, or (at your option) any later version.
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
9
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
13 Lesser General Public License for more details.
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
14
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
15 You should have received a copy of the GNU Lesser General Public
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
16 License along with this library; if not, write to the Free Software
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
18
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
19 Sam Lantinga
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
20 slouken@libsdl.org
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
21 */
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
22 #include "SDL_config.h"
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
23
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
24 #ifndef _SDL_mouse_c_h
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
25 #define _SDL_mouse_c_h
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
26
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
27 typedef struct SDL_Mouse SDL_Mouse;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
28
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
29 struct SDL_Cursor
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
30 {
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
31 SDL_Mouse *mouse;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
32
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
33 SDL_Cursor *next;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
34
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
35 void *driverdata;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
36 };
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
37
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
38 struct SDL_Mouse
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
39 {
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
40 /* Create a cursor from a surface */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
41 SDL_Cursor *(*CreateCursor) (SDL_Surface * surface, int hot_x, int hot_y);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
42
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
43 /* Show the specified cursor, or hide if cursor is NULL */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
44 int (*ShowCursor) (SDL_Cursor * cursor);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
45
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
46 /* This is called when a mouse motion event occurs */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
47 void (*MoveCursor) (SDL_Cursor * cursor);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
48
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
49 /* Free a window manager cursor */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
50 void (*FreeCursor) (SDL_Cursor * cursor);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
51
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
52 /* Warp the mouse to (x,y) */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
53 void (*WarpMouse) (SDL_Mouse * mouse, SDL_WindowID windowID, int x,
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
54 int y);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
55
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
56 /* Free the mouse when it's time */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
57 void (*FreeMouse) (SDL_Mouse * mouse);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
58
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
59 /* Data common to all mice */
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
60 SDL_WindowID focus;
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
61 int x;
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
62 int y;
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
63 int xdelta;
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
64 int ydelta;
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
65 Uint8 buttonstate;
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
66
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
67 SDL_Cursor *cursors;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
68 SDL_Cursor *def_cursor;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
69 SDL_Cursor *cur_cursor;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
70 SDL_bool cursor_shown;
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
71
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
72 void *driverdata;
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
73 };
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
74
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
75
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
76 /* Initialize the mouse subsystem */
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
77 extern int SDL_MouseInit(void);
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
78
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
79 /* Get the mouse at an index */
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
80 extern SDL_Mouse *SDL_GetMouse(int index);
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
81
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
82 /* Add a mouse, possibly reattaching at a particular index (or -1),
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
83 returning the index of the mouse, or -1 if there was an error.
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
84 */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
85 extern int SDL_AddMouse(const SDL_Mouse * mouse, int index);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
86
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
87 /* Remove a mouse at an index, clearing the slot for later */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
88 extern void SDL_DelMouse(int index);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
89
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
90 /* Clear the button state of a mouse at an index */
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
91 extern void SDL_ResetMouse(int index);
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
92
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
93 /* Send a mouse motion event for a mouse at an index */
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
94 extern int SDL_SendMouseMotion(int index, SDL_WindowID windowID, int relative,
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
95 int x, int y);
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
96
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
97 /* Send a mouse button event for a mouse at an index */
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
98 extern int SDL_SendMouseButton(int index, SDL_WindowID windowID, Uint8 state,
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
99 Uint8 button);
1671
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
100
89f7510fe17a Moved the cursor handling into the mouse code.
Sam Lantinga <slouken@libsdl.org>
parents: 1670
diff changeset
101 /* Shutdown the mouse subsystem */
1670
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
102 extern void SDL_MouseQuit(void);
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
103
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
104 #endif /* _SDL_mouse_c_h */
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
105
eef792d31de8 Work in progress. :)
Sam Lantinga <slouken@libsdl.org>
parents:
diff changeset
106 /* vi: set ts=4 sw=4 expandtab: */