Interface IKeyboardComponent
Interaface for keyboard interaction, keyboard layouts and IME.
Inherited Members
Namespace: OpenTK.Platform
Assembly: OpenTK.Platform.dll
Syntax
public interface IKeyboardComponent : IPalComponent
Properties
SupportsIme
True if the driver supports input method editor functions.
Declaration
bool SupportsIme { get; }
Property Value
| Type | Description |
|---|---|
| bool |
SupportsLayouts
True if the driver supports keyboard layout functions.
Declaration
bool SupportsLayouts { get; }
Property Value
| Type | Description |
|---|---|
| bool |
Methods
BeginIme(WindowHandle)
Invoke input method editor.
Declaration
void BeginIme(WindowHandle window)
Parameters
| Type | Name | Description |
|---|---|---|
| WindowHandle | window | The window corresponding to this IME window. |
EndIme(WindowHandle)
Finish input method editor.
Declaration
void EndIme(WindowHandle window)
Parameters
| Type | Name | Description |
|---|---|---|
| WindowHandle | window | The window corresponding to this IME window. |
GetActiveKeyboardLayout(WindowHandle?)
Get the active keyboard layout.
Declaration
string GetActiveKeyboardLayout(WindowHandle? handle)
Parameters
| Type | Name | Description |
|---|---|---|
| WindowHandle | handle | (optional) Handle to a window to query the layout for. Ignored on systems where keyboard layout is global. |
Returns
| Type | Description |
|---|---|
| string | A string which describes the active keyboard layout. |
Exceptions
| Type | Condition |
|---|---|
| PalNotImplementedException | Driver cannot query active keyboard layout. |
GetAvailableKeyboardLayouts()
See list of possible keyboard layouts for this system.
Declaration
string[] GetAvailableKeyboardLayouts()
Returns
| Type | Description |
|---|---|
| string[] | Array containing possible keyboard layouts. |
GetKeyFromScancode(Scancode)
Gets the Key associated with the specidied Scancode. This function uses the current keyboard layout to determine the mapping.
Declaration
Key GetKeyFromScancode(Scancode scancode)
Parameters
| Type | Name | Description |
|---|---|---|
| Scancode | scancode | The scancode. |
Returns
| Type | Description |
|---|---|
| Key | The Key associated with the Scancode or Unknown if the scancode can't be mapped to a key. |
See Also
GetKeyboardModifiers()
Gets the current keyboard modifiers.
Declaration
KeyModifier GetKeyboardModifiers()
Returns
| Type | Description |
|---|---|
| KeyModifier | The current keyboard modifiers. |
See Also
GetKeyboardState(bool[])
Copies the current state of the keyboard into the specified array. This array should be indexed using Scancode values. The length of this array should be an array able to hold all possible Scancode values.
Declaration
void GetKeyboardState(bool[] keyboardState)
Parameters
| Type | Name | Description |
|---|---|---|
| bool[] | keyboardState | An array to be filled with the keyboard state. |
See Also
GetScancodeFromKey(Key)
Gets the Scancode associated with the specified Key. The Key to Scancode mapping is not 1 to 1, multiple scancodes can produce the same key. This function will return one of the scancodes that produce the key. This function uses the current keyboard layout to determine the mapping.
Declaration
Scancode GetScancodeFromKey(Key key)
Parameters
| Type | Name | Description |
|---|---|---|
| Key | key | The key. |
Returns
| Type | Description |
|---|---|
| Scancode | The Scancode that produces the Key or Unknown if no scancode produces the key. |
See Also
SetImeRectangle(WindowHandle, float, float, float, float)
Set the rectangle to which the IME interface will appear relative to.
Declaration
void SetImeRectangle(WindowHandle window, float x, float y, float width, float height)
Parameters
| Type | Name | Description |
|---|---|---|
| WindowHandle | window | The window corresponding to this IME window. |
| float | x | X coordinate of the rectangle in client coordinates. |
| float | y | Y coordinate of the rectangle in client coordinates. |
| float | width | Width of the rectangle in client units. |
| float | height | Height of the rectangle in client units. |