actual version
[sdl-headers.git] / sdlmouse.inc
1 //from "sdl_mouse.h"
2
3 type
4   PSDL_Cursor = Pointer;
5
6 const
7
8   {**
9    *  Cursor types for SDL_CreateSystemCursor.
10    *}
11
12   SDL_SYSTEM_CURSOR_ARROW = 0;     // Arrow
13   SDL_SYSTEM_CURSOR_IBEAM = 1;     // I-beam
14   SDL_SYSTEM_CURSOR_WAIT = 2;      // Wait
15   SDL_SYSTEM_CURSOR_CROSSHAIR = 3; // Crosshair
16   SDL_SYSTEM_CURSOR_WAITARROW = 4; // Small wait cursor (or Wait if not available)
17   SDL_SYSTEM_CURSOR_SIZENWSE = 5;  // Double arrow pointing northwest and southeast
18   SDL_SYSTEM_CURSOR_SIZENESW = 6;  // Double arrow pointing northeast and southwest
19   SDL_SYSTEM_CURSOR_SIZEWE = 7;    // Double arrow pointing west and east
20   SDL_SYSTEM_CURSOR_SIZENS = 8;    // Double arrow pointing north and south
21   SDL_SYSTEM_CURSOR_SIZEALL = 9;   // Four pointed arrow pointing north, south, east, and west
22   SDL_SYSTEM_CURSOR_NO = 10;        // Slashed circle or crossbones
23   SDL_SYSTEM_CURSOR_HAND = 11;      // Hand
24   SDL_NUM_SYSTEM_CURSORS = 12;
25
26 type
27   PSDL_SystemCursor = ^TSDL_SystemCursor;
28   TSDL_SystemCursor = Word;
29
30   {* Function prototypes *}
31
32   {**
33    *  Get the window which currently has mouse focus.
34    *}
35
36   function SDL_GetMouseFocus: PSDL_Window cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseFocus' {$ENDIF}{$ENDIF};
37
38   {**
39    *  Retrieve the current state of the mouse.
40    *  
41    *  The current button state is returned as a button bitmask, which can
42    *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
43    *  mouse cursor position relative to the focus window for the currently
44    *  selected mouse.  You can pass nil for either x or y.
45    *
46    * SDL_Button = 1 shl ((X)-1)
47    *}
48
49   function SDL_GetMouseState(x: PInt; y: PInt): UInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetMouseState' {$ENDIF}{$ENDIF};
50
51   {**
52    *  Retrieve the relative state of the mouse.
53    *
54    *  The current button state is returned as a button bitmask, which can
55    *  be tested using the SDL_BUTTON(X) macros, and x and y are set to the
56    *  mouse deltas since the last call to SDL_GetRelativeMouseState().
57    *}
58
59   function SDL_GetRelativeMouseState(x: PInt; y: PInt): UInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseState' {$ENDIF}{$ENDIF};
60
61   {**
62    *  Moves the mouse to the given position within the window.
63    *
64    *   window The window to move the mouse into, or nil for the current mouse focus
65    *   x The x coordinate within the window
66    *   y The y coordinate within the window
67    *
68    *  This function generates a mouse motion event
69    *}
70
71   procedure SDL_WarpMouseInWindow(window: PSDL_Window; x: SInt32; y: SInt32) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_WarpMouseInWindow' {$ENDIF}{$ENDIF};
72
73   {**
74    *  Set relative mouse mode.
75    *
76    *  enabled Whether or not to enable relative mode
77    *
78    *  0 on success, or -1 if relative mode is not supported.
79    *
80    *  While the mouse is in relative mode, the cursor is hidden, and the
81    *  driver will try to report continuous motion in the current window.
82    *  Only relative motion events will be delivered, the mouse position
83    *  will not change.
84    *
85    *  This function will flush any pending mouse motion.
86    *  
87    *  SDL_GetRelativeMouseMode()
88    *}
89
90   function SDL_SetRelativeMouseMode(enabled: TSDL_Bool): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetRelativeMouseMode' {$ENDIF}{$ENDIF};
91
92   {**
93    *  Query whether relative mouse mode is enabled.
94    *  
95    *  SDL_SetRelativeMouseMode()
96    *}
97
98   function SDL_GetRelativeMouseMode: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetRelativeMouseMode' {$ENDIF}{$ENDIF};
99
100   {**
101    *  Create a cursor, using the specified bitmap data and
102    *  mask (in MSB format).
103    *
104    *  The cursor width must be a multiple of 8 bits.
105    *
106    *  The cursor is created in black and white according to the following:
107    *  <table>
108    *  <tr><td> data </td><td> mask </td><td> resulting pixel on screen </td></tr>
109    *  <tr><td>  0   </td><td>  1   </td><td> White </td></tr>
110    *  <tr><td>  1   </td><td>  1   </td><td> Black </td></tr>
111    *  <tr><td>  0   </td><td>  0   </td><td> Transparent </td></tr>
112    *  <tr><td>  1   </td><td>  0   </td><td> Inverted color if possible, black 
113    *                                         if not. </td></tr>
114    *  </table>
115    *  
116    *  SDL_FreeCursor()
117    *}
118
119   function SDL_CreateCursor(const data: PUInt8; const mask: PUInt8; w: SInt32; h: SInt32; hot_x: SInt32; hot_y: SInt32): PSDL_Cursor cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateCursor' {$ENDIF}{$ENDIF};
120
121   {**
122    *  Create a color cursor.
123    *
124    *  SDL_FreeCursor()
125    *}
126
127   function SDL_CreateColorCursor(surface: PSDL_Surface; hot_x: SInt32; hot_y: SInt32): PSDL_Cursor cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateColorCursor' {$ENDIF}{$ENDIF};
128
129   {**
130    *  Create a system cursor.
131    *
132    *  SDL_FreeCursor()
133    *}
134
135   function SDL_CreateSystemCursor(id: TSDL_SystemCursor): PSDL_Cursor cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_CreateSystemCursor' {$ENDIF}{$ENDIF};
136
137   {**
138    *  Set the active cursor.
139    *}
140
141   procedure SDL_SetCursor(cursor: PSDL_Cursor) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetCursor' {$ENDIF}{$ENDIF};
142
143   {**
144    *  Return the active cursor.
145    *}
146
147   function SDL_GetCursor: PSDL_Cursor cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetCursor' {$ENDIF}{$ENDIF};
148
149   {**
150    *  Frees a cursor created with SDL_CreateCursor().
151    *
152    *  SDL_CreateCursor()
153    *}
154
155   procedure SDL_FreeCursor(cursor: PSDL_Cursor) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_FreeCursor' {$ENDIF}{$ENDIF};
156
157   {**
158    *  Toggle whether or not the cursor is shown.
159    *
160    *  toggle 1 to show the cursor, 0 to hide it, -1 to query the current
161    *                state.
162    *  
163    *  1 if the cursor is shown, or 0 if the cursor is hidden.
164    *}
165
166   function SDL_ShowCursor(toggle: SInt32): SInt32 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_ShowCursor' {$ENDIF}{$ENDIF};
167
168 const
169   {**
170    *  Used as a mask when testing buttons in buttonstate.
171    *   - Button 1:  Left mouse button
172    *   - Button 2:  Middle mouse button
173    *   - Button 3:  Right mouse button
174    *}
175
176   SDL_BUTTON_LEFT       = 1;
177   SDL_BUTTON_MIDDLE     = 2;
178   SDL_BUTTON_RIGHT      = 3;
179   SDL_BUTTON_X1     = 4;
180   SDL_BUTTON_X2     = 5;
181   SDL_BUTTON_LMASK  = 1 shl ((SDL_BUTTON_LEFT) - 1);
182   SDL_BUTTON_MMASK  = 1 shl ((SDL_BUTTON_MIDDLE) - 1);
183   SDL_BUTTON_RMASK  = 1 shl ((SDL_BUTTON_RIGHT) - 1);
184   SDL_BUTTON_X1MASK = 1 shl ((SDL_BUTTON_X1) - 1);
185   SDL_BUTTON_X2MASK = 1 shl ((SDL_BUTTON_X2) - 1);