KeyboardState
-
class
KeyboardState
: public HPS::Object The KeyboardState class represents the state of a keyboard for a particular event.
Public Functions
-
void
Assign
(KeyboardState const &in_that) Copies the source KeyboardState into this KeyboardState.
Parameters: in_that – The source KeyboardState to copy.
-
bool
Equals
(KeyboardState const &in_that) const Check if the source KeyboardState is equivalent to this KeyboardState.
Parameters: in_that – The source KeyboardState to compare to this KeyboardState. Returns: true if the objects are equivalent, false otherwise.
-
HPS::KeyboardEvent
GetActiveEvent
() const Get the active event for this KeyboardState. This will throw an exception if there is no active action for this KeyboardState.
Returns: The action for the active keyboard codes for this KeyboardState.
-
HPS::KeyArray
GetEventPath
() const Get the relevant list of keys up to the window which had focus when the keys represented by this KeyboardState were pressed or released. This will throw an exception if there is no event path for this KeyboardState.
Returns: The relevant list of keys up to the window which had focus when the keys represented by this KeyboardState were pressed or released.
-
HPS::WindowKey
GetEventSource
() const Get the window which had focus when the keys represented by this KeyboardState were pressed or released. This will throw an exception if there is no event source for this KeyboardState.
Returns: The window which had focus when the keys represented by this KeyboardState were pressed or released.
-
size_t
GetKeyboardCodeCount
() const Get the number of keys currently down in this KeyboardState.
Returns: Number of active and inactive keyboard codes.
-
HPS::KeyboardCodeArray
GetKeyboardCodes
() const Get the list of keyboard codes for keys currently down in this KeyboardState.
Returns: The list of active and inactive keyboard codes.
-
bool
GetKeyState
(HPS::KeyboardCode in_key_code) const Get the state of a specific keyboard code for this KeyboardState.
Parameters: in_key_code – The keyboard code for which to query the action. Returns: true if the key is down, false otherwise.
-
ModifierKeys
GetModifierKeys
() const Get an object representing the state of modifier keys for this KeyboardState.
Returns: An object representing the state of modifier keys.
-
KeyboardState
() The default constructor creates an empty KeyboardState object.
-
KeyboardState
(KeyboardState &&in_that) The move constructor creates a KeyboardState by transferring the underlying impl of the rvalue reference to this KeyboardState thereby avoiding a copy and allocation.
Parameters: in_that – An rvalue reference to a KeyboardState to take the impl from.
-
KeyboardState
(KeyboardState const &in_that) The copy constructor creates a new KeyboardState object that contains the same settings as the source KeyboardState.
Parameters: in_that – The source KeyboardState to copy.
-
inline virtual HPS::Type
ObjectType
() const This function returns the type the object, as declared (if the object is derived, this does not give the true type of the derived object).
Returns: The declared type of the object in question, which may differ from the true, underlying type.
-
bool
operator!=
(KeyboardState const &in_that) const Check if the source KeyboardState is not equivalent to this KeyboardState.
Parameters: in_that – The source KeyboardState to compare to this KeyboardState. Returns: true if the objects are not equivalent, false otherwise.
-
KeyboardState &
operator=
(KeyboardState &&in_that) The move assignment operator transfers the underlying impl of the rvalue reference to this KeyboardState thereby avoiding a copy.
Parameters: in_that – An rvalue reference to a KeyboardState to take the impl from. Returns: A reference to this KeyboardState.
-
KeyboardState &
operator=
(KeyboardState const &in_that) Copies the source KeyboardState into this KeyboardState.
Parameters: in_that – The source KeyboardState to copy. Returns: A reference to this KeyboardState.
-
bool
operator==
(KeyboardState const &in_that) const Check if the source KeyboardState is equivalent to this KeyboardState.
Parameters: in_that – The source KeyboardState to compare to this KeyboardState. Returns: true if the objects are equivalent, false otherwise.
-
void
Set
(KeyArray const &in_path, KeyboardEvent const &in_event, KeyboardCodeArray const &in_keyboard_codes, ModifierKeys in_modifiers = ModifierKeys()) Sets the properties of this KeyboardState.
Parameters: - in_path – The list of keys up to the window which had focus for this keyboard event.
- in_event – The keyboard event.
- in_keyboard_codes – The list of keyboard codes for keys currently down during this keyboard event.
- in_modifiers – The state of modifier keys for this keyboard event.
-
void
SetActiveEvent
(KeyboardEvent const &in_event) Sets the active event for this KeyboardState.
Parameters: in_event – The action for this KeyboardState.
-
void
SetEventPath
(KeyArray const &in_path) Sets the relevant list of keys up to the window which had focus for this keyboard event.
Parameters: in_path – The relevant list of keys up to the window which had focus when the keyboard event represented by this KeyboardState underwent the active action.
-
void
SetKeyboardCodes
(KeyboardCodeArray const &in_keyboard_codes) Sets the list of keyboard codes for keys currently down in this KeyboardState.
Parameters: in_keyboard_codes – The list of keyboard codes for keys currently down during this keyboard event.
-
void
SetModifierKeys
(ModifierKeys in_modifiers) Sets an object representing the state of modifier keys for this KeyboardState.
Parameters: in_modifiers – An object representing the state of modifier keys.
-
~KeyboardState
()
-
void