TachyonUI 1.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
tachyon::Gesture< Snapshot > Struct Template Reference

One press that may become a drag, with what every control does around it: the focus and the capture on the press, the value the drag changes kept as it was, put back on Escape and left for the commit after the release. More...

#include <gui_core/input/gui_gesture.h>

Public Member Functions

bool IsHeld () const noexcept
bool IsPressed (ID element) const noexcept
bool IsDragging (ID element) const noexcept
GesturePhase Phase () const noexcept
bool Press (const ElementEvent &e, const ElementStorage &storage, GUIStateManager &gsm, Snapshot snapshot={}, const PressOptions &options={})
 Starts on e when it is the options' button going down: keeps snapshot, takes the focus and the capture as the options say.
bool Move (const ElementEvent &e, int32_t distance)
 See PointerDrag::Move.
PointerDrag::Ended Release (const ElementEvent &e)
 See PointerDrag::Release. before stays for the commit.
void Reset ()
 Drops any press and what it kept (the control was disabled under it, say).
bool Cancel (const ElementEvent &e, GUIStateManager &gsm)
 Escape on the pressed element: drops the press and its capture.
bool Cancel (const ElementEvent &e, GUIStateManager &gsm, Snapshot &value)
 Escape on the pressed element: as Cancel, and value is put back as it was.

Public Attributes

PointerDrag drag
 the press itself
Snapshot before {}
 what the press changes, as it was at the press

Detailed Description

template<class Snapshot = NoSnapshot>
struct tachyon::Gesture< Snapshot >

One press that may become a drag, with what every control does around it: the focus and the capture on the press, the value the drag changes kept as it was, put back on Escape and left for the commit after the release.

The phases nest in the element's hover (InteractionState): hovered, then pressed, then dragging, ending as a click, a drag or a cancel.

Gesture<float> drag;                       // in the control's state
case MouseDown: return drag.Press(e, storage, gsm, value);
case MouseMove: if (drag.Move(e, distance)) value = ...; return true;
case MouseUp:   if (drag.Release(e) == PointerDrag::Ended::Drag) Commit(drag.before, value);
case KeyDown:   return drag.Cancel(e, gsm, value); 

Member Function Documentation

◆ IsHeld()

template<class Snapshot = NoSnapshot>
bool tachyon::Gesture< Snapshot >::IsHeld ( ) const
inlinenoexcept

◆ IsPressed()

template<class Snapshot = NoSnapshot>
bool tachyon::Gesture< Snapshot >::IsPressed ( ID element) const
inlinenoexcept

◆ IsDragging()

template<class Snapshot = NoSnapshot>
bool tachyon::Gesture< Snapshot >::IsDragging ( ID element) const
inlinenoexcept

◆ Phase()

template<class Snapshot = NoSnapshot>
GesturePhase tachyon::Gesture< Snapshot >::Phase ( ) const
inlinenoexcept

◆ Press()

template<class Snapshot = NoSnapshot>
bool tachyon::Gesture< Snapshot >::Press ( const ElementEvent & e,
const ElementStorage & storage,
GUIStateManager & gsm,
Snapshot snapshot = {},
const PressOptions & options = {} )
inline

Starts on e when it is the options' button going down: keeps snapshot, takes the focus and the capture as the options say.

True then.

◆ Move()

template<class Snapshot = NoSnapshot>
bool tachyon::Gesture< Snapshot >::Move ( const ElementEvent & e,
int32_t distance )
inline

◆ Release()

template<class Snapshot = NoSnapshot>
PointerDrag::Ended tachyon::Gesture< Snapshot >::Release ( const ElementEvent & e)
inline

See PointerDrag::Release. before stays for the commit.

◆ Reset()

template<class Snapshot = NoSnapshot>
void tachyon::Gesture< Snapshot >::Reset ( )
inline

Drops any press and what it kept (the control was disabled under it, say).

◆ Cancel() [1/2]

template<class Snapshot = NoSnapshot>
bool tachyon::Gesture< Snapshot >::Cancel ( const ElementEvent & e,
GUIStateManager & gsm )
inline

Escape on the pressed element: drops the press and its capture.

True then; the caller puts before back itself (several fields, say).

◆ Cancel() [2/2]

template<class Snapshot = NoSnapshot>
bool tachyon::Gesture< Snapshot >::Cancel ( const ElementEvent & e,
GUIStateManager & gsm,
Snapshot & value )
inline

Escape on the pressed element: as Cancel, and value is put back as it was.

Member Data Documentation

◆ drag

template<class Snapshot = NoSnapshot>
PointerDrag tachyon::Gesture< Snapshot >::drag

the press itself

◆ before

template<class Snapshot = NoSnapshot>
Snapshot tachyon::Gesture< Snapshot >::before {}

what the press changes, as it was at the press


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