TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::InputState Struct Reference

Snapshot of input state for a single recorded OS event. More...

#include <gui_core/input/gui_input_state.h>

Public Member Functions

bool IsPen () const
template<class T>
const T * DraggedAs () const
 A drag event's payload as a T; null when it carries none, or another type.
bool LeftDown () const
bool LeftPressed () const
bool LeftReleased () const
bool RightDown () const
bool RightPressed () const
bool RightReleased () const
bool MiddleDown () const
bool MiddlePressed () const
bool MiddleReleased () const

Public Attributes

tachyon::int2 screenPos {0,0}
tachyon::int2 prevScreenPos {0,0}
tachyon::int2 screenDelta {0,0}
tachyon::MouseButtons buttons = tachyon::MouseButtons::None
tachyon::MouseButtons prevButtons = tachyon::MouseButtons::None
tachyon::KeyModifier modifiers = tachyon::KeyModifier::None
tachyon::float2 scroll {}
 wheel notches (fractional on hi-res devices); label drags: pixels
float pinch = 1.0f
 A trackpad pinch (a MouseScroll event): how far the fingers spread since the last one, above 1 apart (zoom in), below 1 together.
tachyon::KeyCode lastKey = tachyon::KeyCode::None
tachyon::KeyAction lastKeyAction = tachyon::KeyAction::KeyDown
std::string textInput
 Text typed with this event, or dropped (EventType::FileDrop); UTF-8.
std::vector< std::string > droppedFiles
 EventType::FileDrop: the paths of the files dropped (UTF-8).
PenState pen
 Pointer events: the pen, or the mouse's pressure when a mouse moved the pointer.
bool consumed = false
 True when the event was already handled (e.g. Tab by tab navigation).
tachyon::ID dragSourceID = tachyon::ID::Invalid()
 Drag-and-drop source and payload; set for drag events.
uint32_t dragPayloadType = 0
 Drag-and-drop source and payload; set for drag events.
uintptr_t dragPayloadValue = 0
 Drag-and-drop source and payload; set for drag events.
const std::any * dragPayload = nullptr
 The payload itself; null outside drag events. DraggedAs reads it.

Detailed Description

Snapshot of input state for a single recorded OS event.

Member Function Documentation

◆ IsPen()

bool tachyon::InputState::IsPen ( ) const
inline

◆ DraggedAs()

template<class T>
const T * tachyon::InputState::DraggedAs ( ) const
inline

A drag event's payload as a T; null when it carries none, or another type.

◆ LeftDown()

bool tachyon::InputState::LeftDown ( ) const
inline

◆ LeftPressed()

bool tachyon::InputState::LeftPressed ( ) const
inline

◆ LeftReleased()

bool tachyon::InputState::LeftReleased ( ) const
inline

◆ RightDown()

bool tachyon::InputState::RightDown ( ) const
inline

◆ RightPressed()

bool tachyon::InputState::RightPressed ( ) const
inline

◆ RightReleased()

bool tachyon::InputState::RightReleased ( ) const
inline

◆ MiddleDown()

bool tachyon::InputState::MiddleDown ( ) const
inline

◆ MiddlePressed()

bool tachyon::InputState::MiddlePressed ( ) const
inline

◆ MiddleReleased()

bool tachyon::InputState::MiddleReleased ( ) const
inline

Member Data Documentation

◆ screenPos

tachyon::int2 tachyon::InputState::screenPos {0,0}

◆ prevScreenPos

tachyon::int2 tachyon::InputState::prevScreenPos {0,0}

◆ screenDelta

tachyon::int2 tachyon::InputState::screenDelta {0,0}

◆ buttons

tachyon::MouseButtons tachyon::InputState::buttons = tachyon::MouseButtons::None

◆ prevButtons

tachyon::MouseButtons tachyon::InputState::prevButtons = tachyon::MouseButtons::None

◆ modifiers

tachyon::KeyModifier tachyon::InputState::modifiers = tachyon::KeyModifier::None

◆ scroll

tachyon::float2 tachyon::InputState::scroll {}

wheel notches (fractional on hi-res devices); label drags: pixels

◆ pinch

float tachyon::InputState::pinch = 1.0f

A trackpad pinch (a MouseScroll event): how far the fingers spread since the last one, above 1 apart (zoom in), below 1 together.

1 for every other event.

◆ lastKey

tachyon::KeyCode tachyon::InputState::lastKey = tachyon::KeyCode::None

◆ lastKeyAction

tachyon::KeyAction tachyon::InputState::lastKeyAction = tachyon::KeyAction::KeyDown

◆ dragSourceID

tachyon::ID tachyon::InputState::dragSourceID = tachyon::ID::Invalid()

Drag-and-drop source and payload; set for drag events.

◆ dragPayloadType

uint32_t tachyon::InputState::dragPayloadType = 0

Drag-and-drop source and payload; set for drag events.

◆ dragPayloadValue

uintptr_t tachyon::InputState::dragPayloadValue = 0

Drag-and-drop source and payload; set for drag events.

◆ dragPayload

const std::any* tachyon::InputState::dragPayload = nullptr

The payload itself; null outside drag events. DraggedAs reads it.

◆ textInput

std::string tachyon::InputState::textInput

Text typed with this event, or dropped (EventType::FileDrop); UTF-8.

◆ droppedFiles

std::vector<std::string> tachyon::InputState::droppedFiles

EventType::FileDrop: the paths of the files dropped (UTF-8).

◆ pen

PenState tachyon::InputState::pen

Pointer events: the pen, or the mouse's pressure when a mouse moved the pointer.

◆ consumed

bool tachyon::InputState::consumed = false

True when the event was already handled (e.g. Tab by tab navigation).


The documentation for this struct was generated from the following file: