Magnum::Ui::PointerMoveEvent class new in Git master

Pointer move event.

Constructors, destructors, conversion operators

PointerMoveEvent(Nanoseconds time, Containers::Optional<Pointer> type, Pointers types) explicit
Constructor.
PointerMoveEvent(Nanoseconds time, Containers::Optional<Pointer> type, Pointers types, const Vector2& relativePosition) explicit
Constructor.

Public functions

auto time() const -> Nanoseconds
Time at which the event happened.
auto type() const -> Containers::Optional<Pointer>
Pointer type that changed in this event.
auto types() const -> Pointers
Pointer types pressed in this event.
auto position() const -> Vector2
Event position.
auto relativePosition() const -> Vector2
Position relative to previous pointer event.
auto isCaptured() const -> bool
Whether the event is captured on a node.
void setCaptured(bool captured)
Set whether to capture the event on a node.
auto isHovering() const -> bool
Whether the event is called on a node that's currently hovered.
auto isFocused() const -> bool
Whether the event is called on a node that's currently focused.
auto isAccepted() const -> bool
Whether the event is accepted.
void setAccepted(bool accepted = true)
Set the event as accepted.

Function documentation

Magnum::Ui::PointerMoveEvent::PointerMoveEvent(Nanoseconds time, Containers::Optional<Pointer> type, Pointers types) explicit

Constructor.

Parameters
time Time at which the event happened
type Pointer type that changed in this event or Containers::NullOpt
types Pointer types pressed in this event

The time may get used for UI animations. A default-constructed value causes an animation play time to be in the past, thus immediately transitioning to a stopped state. The position, capture and hover properties are set from AbstractUserInterface event handler internals.

Magnum::Ui::PointerMoveEvent::PointerMoveEvent(Nanoseconds time, Containers::Optional<Pointer> type, Pointers types, const Vector2& relativePosition) explicit

Constructor.

Meant to be used for testing purposes. The relativePosition gets overwritten in AbstractUserInterface event handler internals.

Containers::Optional<Pointer> Magnum::Ui::PointerMoveEvent::type() const

Pointer type that changed in this event.

If no pointer changed in this event (i.e., all pointers that were pressed before are still pressed), returns Containers::NullOpt. Use types() to check what all pointers are pressed in this event. If type() is not empty and types() contain type(), it means given pointer type was pressed, if they don't, it means it was released.

Pointers Magnum::Ui::PointerMoveEvent::types() const

Pointer types pressed in this event.

Returns an empty set if no pointers are pressed, which happens for example when a mouse is just moved around.

Vector2 Magnum::Ui::PointerMoveEvent::position() const

Event position.

Relative to the containing node.

Vector2 Magnum::Ui::PointerMoveEvent::relativePosition() const

Position relative to previous pointer event.

Relative to the previous pointer event. If no pointer event happened before, is a zero vector. For pointer enter and leave events it's a zero vector always, as they happen immediately after another event.

bool Magnum::Ui::PointerMoveEvent::isCaptured() const

Whether the event is captured on a node.

Is implicitly true if the event happens on a captured node, false otherwise.

void Magnum::Ui::PointerMoveEvent::setCaptured(bool captured)

Set whether to capture the event on a node.

By default, after a pointer press event, a node captures all following pointer and key events until and including a pointer release, even if they happen outside of the node area. If capture is disabled, the events are always sent to the actual node under the pointer.

The capture can be both disabled and enabled again for all pointer move, enter and leave events, each time it's enabled again it'll capture the actual node under the pointer. Calling this function has no effect on a pointer leave event that isn't captured.

bool Magnum::Ui::PointerMoveEvent::isHovering() const

Whether the event is called on a node that's currently hovered.

Returns true if AbstractUserInterface::currentHoveredNode() is the same as the node the event is called on, false otherwise. In particular, is false for the first move event happening on a node, true for the enter event and all subsequent accepted move events on the same node, false for the leave event. On a captured move event returns false for if the pointer was moved outside of the node area.

Note that even if this function returns true, the event handler still controls whether the node actually appears in AbstractUserInterface::currentHoveredNode() afterwards. Accepting the event makes the node appear there. Not accepting it makes the event potentially fall through to other nodes which may then become hovered, if there are none then the hovered node becomes null and subsequent move events called on this node will be called with this function returning false.

bool Magnum::Ui::PointerMoveEvent::isFocused() const

Whether the event is called on a node that's currently focused.

Returns true if AbstractUserInterface::currentFocusedNode() is the same as the node the event is called on, false otherwise. Unlike isHovering(), returns true also if the actual pointer position is outside of the area of the node the event is called on, for example in case of an event capture.

bool Magnum::Ui::PointerMoveEvent::isAccepted() const

Whether the event is accepted.

Implicitly false.

void Magnum::Ui::PointerMoveEvent::setAccepted(bool accepted = true)

Set the event as accepted.

Once an event is accepted, it doesn't propagate further.