Skip to main content

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

MemberSummary
KeyText(TextInputMode)Creates a resolver for one mode.

Properties

MemberSummary
ByPositionShared resolver for TextInputMode.ByPosition.
ModeThe mode this resolver works in.
NativeShared resolver for TextInputMode.Native.

Methods

MemberSummary
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

NameTypeDescription
modeTextInputModeHow 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

NameTypeDescription
modeTextInputModeThe 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

NameTypeDescription
keyKeyPressThe key that was pressed.

Returns Nullable<T><char> — The character to insert, or null.