class new in Git master
#include <Magnum/Ui/Event.h>
KeyEvent Key press or release event.
Constructors, destructors, conversion operators
- KeyEvent(Nanoseconds time, Key key, Modifiers modifiers) explicit
- Constructor.
Public functions
- auto time() const -> Nanoseconds
- Time at which the event happened.
- auto key() const -> Key
- Key that got pressed or released.
- auto modifiers() const -> Modifiers
- Active keyboard modifiers.
-
auto position() const -> Containers::
Optional<Vector2> - Event position.
-
auto nodeSize() const -> Containers::
Optional<Vector2> - Size of the node the event is called on.
- auto isNodePressed() const -> bool
- Whether the event is called on a node that's currently pressed.
- auto isNodeHovered() const -> bool
- Whether the event is called on a node that's currently hovered.
- auto isNodeFocused() const -> bool
- Whether the event is called on a node that's currently focused.
- auto isCaptured() const -> bool
- Whether the event is captured on a node.
- auto isAccepted() const -> bool
- Whether the event is accepted.
- void setAccepted(bool accepted = true)
- Set the event as accepted.
Function documentation
Magnum:: Ui:: KeyEvent:: KeyEvent(Nanoseconds time,
Key key,
Modifiers modifiers) explicit
Constructor.
Parameters | |
---|---|
time | Time at which the event happened |
key | Key that got pressed or released |
modifiers | Active keyboard modifiers |
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 node-related properties are set from AbstractUserInterface event handler internals.
Containers:: Optional<Vector2> Magnum:: Ui:: KeyEvent:: position() const
Event position.
If the event was called on a AbstractUserInterface::
Containers:: Optional<Vector2> Magnum:: Ui:: KeyEvent:: nodeSize() const
Size of the node the event is called on.
If the event was called on a AbstractUserInterface::
bool Magnum:: Ui:: KeyEvent:: isNodePressed() const
Whether the event is called on a node that's currently pressed.
Returns true
if AbstractUserInterface::false
otherwise.
bool Magnum:: Ui:: KeyEvent:: isNodeHovered() const
Whether the event is called on a node that's currently hovered.
Returns true
if AbstractUserInterface::false
otherwise.
bool Magnum:: Ui:: KeyEvent:: isNodeFocused() const
Whether the event is called on a node that's currently focused.
Returns true
if AbstractUserInterface::false
otherwise. Unlike isNodeHovered(), 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:: KeyEvent:: isCaptured() const
Whether the event is captured on a node.
If the event is called on a AbstractUserInterface::false
. Otherwise returns true
if AbstractUserInterface::false
otherwise. Unlike PointerEvent or PointerMoveEvent, key events don't have a possibility to modify the captured status.
void Magnum:: Ui:: KeyEvent:: setAccepted(bool accepted = true)
Set the event as accepted.
Once an event is accepted, it doesn't propagate further.