MouseState

class HPS::MouseState : public HPS::Object

The MouseState class represents the state of the mouse or similar pointer device for a particular event.

Public Functions

void Assign(MouseState const &in_that)

Copies the source MouseState into this MouseState.

Parameters

in_that – The source MouseState to copy.

bool Equals(MouseState const &in_that) const

Check if the source MouseState is equivalent to this MouseState.

Parameters

in_kit – The source MouseState to compare to this MouseState.

Returns

true if the objects are equivalent, false otherwise.

HPS::MouseEvent GetActiveEvent() const

Get the active event for this MouseState. This will throw an exception if there is no active action for this MouseState.

Returns

The action for this MouseState.

MouseButtons GetButtons() const

Get the current state of the mouse buttons immediately after the active event.

Returns

The state of the mouse buttons.

HPS::KeyArray GetEventPath() const

Get the relevant list of keys up to the window which had focus when the mouse represented by this MouseState underwent the active action. This will throw an exception if there is no event path for this MouseState.

Returns

The relevant list of keys up to the window which had focus when the mouse event represented by this MouseState underwent the active action.

HPS::WindowKey GetEventSource() const

Get the window which had focus when the mouse represented by this MouseState underwent the active action. This will throw an exception if there is no event source for this MouseState.

Returns

The window which had focus when the mouse represented by this MouseState underwent the active action.

WindowPoint GetLocation() const

Get the current mouse position.

Returns

The location, in window space of the mouse cursor.

ModifierKeys GetModifierKeys() const

Get an object representing the state of modifier keys for this MouseState.

Returns

An object representing the state of modifier keys.

bool HasAll(MouseButtons in_mouse_trigger, ModifierKeys in_modifier_trigger) const

Checks if this MouseState has all of the specified properties.

Parameters
  • in_mouse_trigger – The mouse button properties to test for.

  • in_modifier_trigger – The modifier keys properties to test for.

Returns

true if this MouseState has all of the specified properties, false otherwise.

MouseState()

The default constructor creates an empty MouseState object.

MouseState(MouseState &&in_that)

The move constructor creates a MouseState by transferring the underlying impl of the rvalue reference to this MouseState thereby avoiding a copy and allocation.

Parameters

in_that – An rvalue reference to a MouseState to take the impl from.

MouseState(MouseState const &in_that)

The copy constructor creates a new MouseState object that contains the same settings as the source MouseState.

Parameters

in_that – The source MouseState 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!=(MouseState const &in_that) const

Check if the source MouseState is not equivalent to this MouseState.

Parameters

in_kit – The source MouseState to compare to this MouseState.

Returns

true if the objects are not equivalent, false otherwise.

MouseState &operator=(MouseState &&in_that)

The move assignment operator transfers the underlying impl of the rvalue reference to this MouseState thereby avoiding a copy.

Parameters

in_that – An rvalue reference to a MouseState to take the impl from.

Returns

A reference to this MouseState.

MouseState &operator=(MouseState const &in_that)

Copies the source MouseState into this MouseState.

Parameters

in_that – The source MouseState to copy.

Returns

A reference to this MouseState.

bool operator==(MouseState const &in_that) const

Check if the source MouseState is equivalent to this MouseState.

Parameters

in_kit – The source MouseState to compare to this MouseState.

Returns

true if the objects are equivalent, false otherwise.

void Set(KeyArray const &in_path, MouseEvent const &in_event, WindowPoint const &in_point, MouseButtons in_buttons = MouseButtons(), ModifierKeys in_modifiers = ModifierKeys())

Sets the properties of this MouseState.

Parameters
  • in_path – The list of keys up to the window which had focus for this mouse event.

  • in_event – The mouse event.

  • in_point – The location, in window space of the mouse cursor for this mouse event.

  • in_buttons – The state of the mouse buttons immediately after this mouse event.

  • in_modifiers – The state of modifier keys for this mouse event.

void SetActiveEvent(MouseEvent const &in_event)

Sets the active event for this MouseState.

Parameters

in_event – The action for this MouseState.

void SetButtons(MouseButtons in_buttons)

Sets the current state of the mouse buttons immediately after the active event.

Parameters

in_buttons – The state of the mouse buttons.

void SetEventPath(KeyArray const &in_path)

Sets the relevant list of keys up to the window which had focus for this mouse event.

Parameters

in_path – The relevant list of keys up to the window which had focus when the mouse event represented by this MouseState underwent the active action.

void SetLocation(WindowPoint const &in_point)

Sets the current mouse position.

Parameters

in_point – The location, in window space of the mouse cursor.

void SetModifierKeys(ModifierKeys in_modifiers)

Sets an object representing the state of modifier keys for this MouseState.

Parameters

in_modifiers – An object representing the state of modifier keys.

~MouseState()

Public Static Attributes

static const HPS::Type staticType = HPS::Type::MouseState