Table of Contents

Class KeyboardShortcut

A class to represent a single keyboard shortcut.

public class KeyboardShortcut
Inheritance
KeyboardShortcut
Inherited Members

Constructors

KeyboardShortcut(params CustomKeyCode[])

Creates a shortcut from the given keycodes. Sorts the keycodes into the order they would be read.

public KeyboardShortcut(params CustomKeyCode[] keyCodes)

Parameters

keyCodes CustomKeyCode[]

Properties

None

The empty keyboard shortcut - i.e. no keycodes.

public static KeyboardShortcut None { get; }

Property Value

KeyboardShortcut

keyCodes

The keycodes in this shortcut, kept in the order they would be read.

public List<CustomKeyCode> keyCodes { get; }

Property Value

List<CustomKeyCode>

Methods

Add(CustomKeyCode)

Adds the keycode to the shortcut. Returns false if it was already in the shortcut; otherwise returns true.

public bool Add(CustomKeyCode keyCode)

Parameters

keyCode CustomKeyCode

Returns

bool

Contains(CustomKeyCode)

Returns true if the keycode is in the shortcut.

public bool Contains(CustomKeyCode keyCode)

Parameters

keyCode CustomKeyCode

Returns

bool

Equals(object)

Determines whether the specified object is equal to the current object.

public override bool Equals(object obj)

Parameters

obj object

The object to compare with the current object.

Returns

bool

true if the specified object is equal to the current object; otherwise, false.

GetHashCode()

Serves as the default hash function.

public override int GetHashCode()

Returns

int

A hash code for the current object.

GetKeys()

Returns true while all keys are being held down.

public bool GetKeys()

Returns

bool

GetKeysDown()

Returns true the frame the final key is pressed.

public bool GetKeysDown()

Returns

bool

GetKeysUp()

Returns true the frame (any key of) this shortcut is released.

public bool GetKeysUp()

Returns

bool

Remove(CustomKeyCode)

Removes the keycode from the shortcut. Returns false if the keycode already wasn't in the shortcut; otherwise returns true.

public bool Remove(CustomKeyCode keyCode)

Parameters

keyCode CustomKeyCode

Returns

bool

ToArray()

Returns an array of the keycodes in this shortcut, in the order they would be read.

public CustomKeyCode[] ToArray()

Returns

CustomKeyCode[]

ToString()

Returns a string that represents the current object.

public override string ToString()

Returns

string

A string that represents the current object.

Operators

operator ==(KeyboardShortcut, KeyboardShortcut)

Checks if the shortcuts have the same set of keycodes.

public static bool operator ==(KeyboardShortcut shortcut1, KeyboardShortcut shortcut2)

Parameters

shortcut1 KeyboardShortcut
shortcut2 KeyboardShortcut

Returns

bool

operator !=(KeyboardShortcut, KeyboardShortcut)

Checks if the shortcuts do not have the same set of keycodes.

public static bool operator !=(KeyboardShortcut shortcut1, KeyboardShortcut shortcut2)

Parameters

shortcut1 KeyboardShortcut
shortcut2 KeyboardShortcut

Returns

bool