actual version
[sdl-headers.git] / sdlkeyboard.inc
1 //from "sdl_keyboard.h"
2
3 type
4   PKeyStateArr = ^TKeyStateArr;
5   TKeyStateArr = array[0..65000] of UInt8;
6
7   {**
8    *  The SDL keysym structure, used in key events.
9    *}
10   PSDL_Keysym = ^TSDL_Keysym;
11   TSDL_Keysym = record
12     scancode: TSDL_ScanCode;      // SDL physical key code - see SDL_Scancode for details
13     sym: TSDL_KeyCode;            // SDL virtual key code - see SDL_Keycode for details
14     _mod: UInt16;                 // current key modifiers
15     unicode: UInt32;              // (deprecated) use SDL_TextInputEvent instead
16   end;
17
18   {**
19    *  Get the window which currently has keyboard focus.
20    *}
21
22   function SDL_GetKeyboardFocus: PSDL_Window cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF}{$ENDIF};
23
24   {**
25    *  Get a snapshot of the current state of the keyboard.
26    *
27    *  numkeys if non-nil, receives the length of the returned array.
28    *  
29    *  An array of key states. Indexes into this array are obtained by using SDL_Scancode values.
30    *
31    *}
32
33   function SDL_GetKeyboardState(numkeys: PInt): PUInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF}{$ENDIF};
34
35   {**
36    *  Get the current key modifier state for the keyboard.
37    *}
38
39   function SDL_GetModState: TSDL_KeyMod cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF}{$ENDIF};
40
41   {**
42    *  Set the current key modifier state for the keyboard.
43    *  
44    *  This does not change the keyboard state, only the key modifier flags.
45    *}
46
47   procedure SDL_SetModState(modstate: TSDL_KeyMod) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF}{$ENDIF};
48
49   {**
50    *  Get the key code corresponding to the given scancode according
51    *         to the current keyboard layout.
52    *
53    *  See SDL_Keycode for details.
54    *  
55    *  SDL_GetKeyName()
56    *}
57
58   function SDL_GetKeyFromScancode(scancode: TSDL_ScanCode): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF}{$ENDIF};
59
60   {**
61    *  Get the scancode corresponding to the given key code according to the
62    *         current keyboard layout.
63    *
64    *  See SDL_Scancode for details.
65    *
66    *  SDL_GetScancodeName()
67    *}
68
69   function SDL_GetScancodeFromKey(key: TSDL_KeyCode): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF}{$ENDIF};
70
71   {**
72    *  Get a human-readable name for a scancode.
73    *
74    *  A pointer to the name for the scancode.
75    *
76    *  If the scancode doesn't have a name, this function returns
77    *  an empty string ("").
78    *
79    *}
80
81   function SDL_GetScancodeName(scancode: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF}{$ENDIF};
82
83   {**
84    *  Get a scancode from a human-readable name
85    *
86    *  scancode, or SDL_SCANCODE_UNKNOWN if the name wasn't recognized
87    *
88    *  SDL_Scancode
89    *}
90
91   function SDL_GetScancodeFromName(const name: PAnsiChar): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF}{$ENDIF};
92
93   {**
94    *  Get a human-readable name for a key.
95    *
96    *  A pointer to a UTF-8 string that stays valid at least until the next
97    *  call to this function. If you need it around any longer, you must
98    *  copy it.  If the key doesn't have a name, this function returns an
99    *  empty string ("").
100    *  
101    *  SDL_Key
102    *}
103
104   function SDL_GetKeyName(key: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF}{$ENDIF};
105
106   {**
107    *  Get a key code from a human-readable name
108    *
109    *  key code, or SDLK_UNKNOWN if the name wasn't recognized
110    *
111    *  SDL_Keycode
112    *}
113
114   function SDL_GetKeyFromName(const name: PAnsiChar): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF}{$ENDIF};
115
116   {**
117    *  Start accepting Unicode text input events.
118    *  This function will show the on-screen keyboard if supported.
119    *  
120    *  SDL_StopTextInput()
121    *  SDL_SetTextInputRect()
122    *  SDL_HasScreenKeyboardSupport()
123    *}
124
125   procedure SDL_StartTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF}{$ENDIF};
126
127   {**
128    *  Return whether or not Unicode text input events are enabled.
129    *
130    *  SDL_StartTextInput()
131    *  SDL_StopTextInput()
132    *}
133
134   function SDL_IsTextInputActive: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF}{$ENDIF};
135
136   {**
137    *  Stop receiving any text input events.
138    *  This function will hide the on-screen keyboard if supported.
139    *  
140    *  SDL_StartTextInput()
141    *  SDL_HasScreenKeyboardSupport()
142    *}
143
144   procedure SDL_StopTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF}{$ENDIF};
145
146   {**
147    *  Set the rectangle used to type Unicode text inputs.
148    *  This is used as a hint for IME and on-screen keyboard placement.
149    *  
150    *  SDL_StartTextInput()
151    *}
152
153   procedure SDL_SetTextInputRect(rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF}{$ENDIF};
154
155   {**
156    *  Returns whether the platform has some screen keyboard support.
157    *  
158    *  SDL_TRUE if some keyboard support is available else SDL_FALSE.
159    *
160    *  Not all screen keyboard functions are supported on all platforms.
161    *
162    *  SDL_IsScreenKeyboardShown()
163    *}
164
165   function SDL_HasScreenKeyboardSupport: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF}{$ENDIF};
166
167   {**
168    *  Returns whether the screen keyboard is shown for given window.
169    *
170    *  window The window for which screen keyboard should be queried.
171    *
172    *  Result - SDL_TRUE if screen keyboard is shown else SDL_FALSE.
173    *
174    *  SDL_HasScreenKeyboardSupport()
175    *}
176
177   function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF}{$ENDIF};