58 template <
class Snapshot = NoSnapshot>
75 Snapshot snapshot = {},
const PressOptions& options = {})
79 before = std::move(snapshot);
80 detail::TakePress(gsm, e.
id, options);
97 detail::ReleaseCaptureOf(gsm, e.
id);
113 template <
class Part>
120 template <
class HitTest>
121 void Track(
bool held, HitTest&& hitTest) {
if (!held)
part = hitTest(); }
123 Part
Shown(
bool elementHovered)
const {
return elementHovered ?
part : Part{}; }
129 inline bool HeldOf(
const PointerDrag& d)
noexcept {
return d.IsHeld(); }
130 template <
class S>
bool HeldOf(
const Gesture<S>& g)
noexcept {
return g.IsHeld(); }
134 template <
class... Presses>
135 bool AnyHeld(
const Presses&... presses)
noexcept {
return (detail::HeldOf(presses) || ...); }
The frame's element tree.
Definition gui_element_storage.h:96
Owns the per-frame state objects and runs their BeginFrame / EndFrame in order.
Definition gui_state_manager.h:65
Definition gui_logging.h:24
An input event delivered to an element's EventHandler.
Definition gui_input_handler_func.h:20
const InputState & state
the input snapshot of this event
Definition gui_input_handler_func.h:23
tachyon::ID id
the targeted element
Definition gui_input_handler_func.h:21
One press that may become a drag, with what every control does around it: the focus and the capture o...
Definition gui_gesture.h:60
bool Cancel(const ElementEvent &e, GUIStateManager &gsm)
Escape on the pressed element: drops the press and its capture.
Definition gui_gesture.h:93
bool IsHeld() const noexcept
Definition gui_gesture.h:64
tachyon::KeyModifier before
Definition gui_gesture.h:62
PointerDrag::Ended Release(const ElementEvent &e)
See PointerDrag::Release. before stays for the commit.
Definition gui_gesture.h:87
PointerDrag drag
Definition gui_gesture.h:61
bool IsDragging(ID element) const noexcept
Definition gui_gesture.h:66
GesturePhase Phase() const noexcept
Definition gui_gesture.h:67
void Reset()
Drops any press and what it kept (the control was disabled under it, say).
Definition gui_gesture.h:89
bool IsPressed(ID element) const noexcept
Definition gui_gesture.h:65
bool Cancel(const ElementEvent &e, GUIStateManager &gsm, Snapshot &value)
Escape on the pressed element: as Cancel, and value is put back as it was.
Definition gui_gesture.h:101
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 captur...
Definition gui_gesture.h:74
bool Move(const ElementEvent &e, int32_t distance)
See PointerDrag::Move.
Definition gui_gesture.h:85
The part of a drawn control under the pointer (a key, a handle, a clip's end), for its hover look.
Definition gui_gesture.h:115
Part Shown(bool elementHovered) const
The part to draw hovered: none while the element isn't.
Definition gui_gesture.h:123
void Clear()
Definition gui_gesture.h:124
Part part
under the pointer at the last move with nothing held
Definition gui_gesture.h:116
void Track(bool held, HitTest &&hitTest)
On a move: unless a press is held, the part hitTest() finds under the pointer becomes the hovered one...
Definition gui_gesture.h:121
A 64-bit element ID whose bit layout depends on its IDMode.
Definition gui_id.h:23
static constexpr ID Invalid()
The "no element" ID (all bits zero); also the default for optional ID parameters.
Definition gui_id.h:66
No value to keep: a press that changes nothing to put back.
Definition gui_gesture.h:37
One press on an element that may become a drag.
Definition gui_pointer_drag.h:41
Ended
How a press ended.
Definition gui_pointer_drag.h:67
bool Press(const ElementEvent &e, const ElementStorage &storage, MouseButtons button=MouseButtons::Left, bool atOnce=false)
Starts tracking e when it is button going down: true then.
bool IsDragging(ID element) const noexcept
A press of element is held and has become a drag.
Definition gui_pointer_drag.h:53
bool IsHeld() const noexcept
A press is held, on any element.
Definition gui_pointer_drag.h:49
bool Cancel(ID element) noexcept
Drops the press of element (Escape, a lost capture): true when there was one.
bool IsPressed(ID element) const noexcept
A press of element is held.
Definition gui_pointer_drag.h:51
Ended Release(const ElementEvent &e)
For the held button coming up on e.id: how the press ended. There is no press after.
bool Move(const ElementEvent &e, int32_t distance)
For a move of the held press: true when it is a drag move, the one that goes past distance pixels (se...
bool dragging
moved the drag distance (or a drag from the press on)
Definition gui_pointer_drag.h:46
What a press does besides being tracked.
Definition gui_gesture.h:28
bool focus
take the keyboard focus (and leave any text editor)
Definition gui_gesture.h:31
bool atOnce
a drag from the press on, never a click
Definition gui_gesture.h:30
bool capture
take the mouse capture, so the moves and release come here
Definition gui_gesture.h:33
ID focusID
the element to focus; Invalid: the one pressed
Definition gui_gesture.h:32
MouseButtons button
the button that starts it
Definition gui_gesture.h:29