DEADSOFTWARE

migrating from PanelIDs to panel GUIDs; part two
[d2df-sdl.git] / src / lib / sdl2 / sdlkeyboard.inc
1 //from "sdl_keyboard.h"
3 type
4 PKeyStateArr = ^TKeyStateArr;
5 TKeyStateArr = array[0..65000] of UInt8;
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;
18 {**
19 * Get the window which currently has keyboard focus.
20 *}
22 function SDL_GetKeyboardFocus: PSDL_Window cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardFocus' {$ENDIF}{$ENDIF};
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 *}
33 function SDL_GetKeyboardState(numkeys: PInt): PUInt8 cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyboardState' {$ENDIF}{$ENDIF};
35 {**
36 * Get the current key modifier state for the keyboard.
37 *}
39 function SDL_GetModState: TSDL_KeyMod cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetModState' {$ENDIF}{$ENDIF};
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 *}
47 procedure SDL_SetModState(modstate: TSDL_KeyMod) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetModState' {$ENDIF}{$ENDIF};
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 *}
58 function SDL_GetKeyFromScancode(scancode: TSDL_ScanCode): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromScancode' {$ENDIF}{$ENDIF};
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 *}
69 function SDL_GetScancodeFromKey(key: TSDL_KeyCode): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromKey' {$ENDIF}{$ENDIF};
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 *}
81 function SDL_GetScancodeName(scancode: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeName' {$ENDIF}{$ENDIF};
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 *}
91 function SDL_GetScancodeFromName(const name: PAnsiChar): TSDL_ScanCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetScancodeFromName' {$ENDIF}{$ENDIF};
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 ("").
101 * SDL_Key
102 *}
104 function SDL_GetKeyName(key: TSDL_ScanCode): PAnsiChar cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyName' {$ENDIF}{$ENDIF};
106 {**
107 * Get a key code from a human-readable name
109 * key code, or SDLK_UNKNOWN if the name wasn't recognized
111 * SDL_Keycode
112 *}
114 function SDL_GetKeyFromName(const name: PAnsiChar): TSDL_KeyCode cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_GetKeyFromName' {$ENDIF}{$ENDIF};
116 {**
117 * Start accepting Unicode text input events.
118 * This function will show the on-screen keyboard if supported.
120 * SDL_StopTextInput()
121 * SDL_SetTextInputRect()
122 * SDL_HasScreenKeyboardSupport()
123 *}
125 procedure SDL_StartTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StartTextInput' {$ENDIF}{$ENDIF};
127 {**
128 * Return whether or not Unicode text input events are enabled.
130 * SDL_StartTextInput()
131 * SDL_StopTextInput()
132 *}
134 function SDL_IsTextInputActive: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsTextInputActive' {$ENDIF}{$ENDIF};
136 {**
137 * Stop receiving any text input events.
138 * This function will hide the on-screen keyboard if supported.
140 * SDL_StartTextInput()
141 * SDL_HasScreenKeyboardSupport()
142 *}
144 procedure SDL_StopTextInput cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_StopTextInput' {$ENDIF}{$ENDIF};
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.
150 * SDL_StartTextInput()
151 *}
153 procedure SDL_SetTextInputRect(rect: PSDL_Rect) cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_SetTextInputRect' {$ENDIF}{$ENDIF};
155 {**
156 * Returns whether the platform has some screen keyboard support.
158 * SDL_TRUE if some keyboard support is available else SDL_FALSE.
160 * Not all screen keyboard functions are supported on all platforms.
162 * SDL_IsScreenKeyboardShown()
163 *}
165 function SDL_HasScreenKeyboardSupport: TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_HasScreenKeyboardSupport' {$ENDIF}{$ENDIF};
167 {**
168 * Returns whether the screen keyboard is shown for given window.
170 * window The window for which screen keyboard should be queried.
172 * Result - SDL_TRUE if screen keyboard is shown else SDL_FALSE.
174 * SDL_HasScreenKeyboardSupport()
175 *}
177 function SDL_IsScreenKeyboardShown(window: PSDL_Window): TSDL_Bool cdecl; external SDL_LibName {$IFDEF DELPHI} {$IFDEF MACOS} name '_SDL_IsScreenKeyboardShown' {$ENDIF}{$ENDIF};