KeyText class
Namespace: Arlecchino.Input · Assembly: Arlecchino.Core
Turns a key press into the character it should type. Take it as a constructor parameter instead of reading KeyPress.Character yourself — that is what keeps filters and shortcuts working on a non-latin layout.
public sealed class KeyText
Constructors
| Member | Summary |
|---|---|
KeyText(TextInputMode) | Creates a resolver for one mode. |
Properties
| Member | Summary |
|---|---|
ByPosition | Shared resolver for TextInputMode.ByPosition. |
Mode | The mode this resolver works in. |
Native | Shared resolver for TextInputMode.Native. |
Methods
| Member | Summary |
|---|---|
For(TextInputMode) | Returns the shared resolver for a mode. |
Resolve(KeyPress) | The character a key press should type, or null for keys that type nothing — function keys, arrows, and unmapped combinations. |
Constructors in detail
KeyText(TextInputMode)
public KeyText(TextInputMode mode);
Creates a resolver for one mode.
Parameters
| Name | Type | Description |
|---|---|---|
mode | TextInputMode | How characters should be resolved. |
Properties in detail
ByPosition
public static KeyText ByPosition { get; }
Shared resolver for TextInputMode.ByPosition.
Type KeyText
Mode
public TextInputMode Mode { get; }
The mode this resolver works in.
Type TextInputMode
Native
public static KeyText Native { get; }
Shared resolver for TextInputMode.Native.
Type KeyText
Methods in detail
For(TextInputMode)
public static KeyText For(TextInputMode mode);
Returns the shared resolver for a mode.
Parameters
| Name | Type | Description |
|---|---|---|
mode | TextInputMode | The mode wanted. |
Returns KeyText — The matching resolver.
Resolve(KeyPress)
public Nullable<char> Resolve(KeyPress key);
The character a key press should type, or null for keys that type nothing — function keys, arrows, and unmapped combinations.
Parameters
| Name | Type | Description |
|---|---|---|
key | KeyPress | The key that was pressed. |
Returns Nullable<T><char> — The character to insert, or null.