TachyonUI
0.1.0
High-performance UI for building tools.
Toggle main menu visibility
Loading...
Searching...
No Matches
gui_input_handler_func.h
Go to the documentation of this file.
1
#pragma once
2
3
#include <
gui_core/gui_id.h
>
4
#include <
gui_core/gui_base_types.h
>
// int2
5
#include <
gui_core/input/gui_input_enums.h
>
6
#include <functional>
7
8
namespace
tachyon
9
{
12
13
struct
ElementRect
;
// gui_core/elements/gui_element.h
14
struct
ElementRef
;
// gui_core/elements/gui_element.h
15
class
ElementStorage
;
// gui_core/elements/gui_element_storage.h
16
struct
InputState
;
// gui_core/input/gui_input_state.h
17
19
struct
ElementEvent
20
{
21
tachyon::ID
id
;
22
EventType
type
;
23
const
InputState
&
state
;
24
const
ElementRect
*
rect
;
25
const
ElementRef
&
elementRef
;
26
30
int2
LocalCursor
(
const
ElementStorage
& storage)
const
;
31
};
32
35
using
EventHandler
= std::function<bool(
ElementEvent
&& input)>;
36
38
inline
EventHandler
Chain
(
EventHandler
first,
EventHandler
second)
39
{
40
return
[f = std::move(first), s = std::move(second)](
ElementEvent
&& event) ->
bool
41
{
42
if
(f && f(
ElementEvent
{
event
}))
return
true
;
43
if
(s && s(std::move(event)))
return
true
;
44
return
false
;
45
};
46
}
47
48
}
tachyon::ElementStorage
The frame's element tree.
Definition
gui_element_storage.h:100
tachyon::EventType
EventType
The kind of input event the GUI dispatches to element handlers.
Definition
gui_input_enums.h:75
tachyon::EventHandler
std::function< bool(ElementEvent &&input)> EventHandler
Element-level input handler used by the immediate-mode dispatcher; returns true when it consumed the ...
Definition
gui_input_handler_func.h:35
tachyon::Chain
EventHandler Chain(EventHandler first, EventHandler second)
A handler that tries first, then second when first returns false.
Definition
gui_input_handler_func.h:38
gui_base_types.h
gui_id.h
gui_input_enums.h
tachyon
Definition
gui_logging.h:24
tachyon::ElementEvent
An input event delivered to an element's EventHandler.
Definition
gui_input_handler_func.h:20
tachyon::ElementEvent::type
EventType type
Definition
gui_input_handler_func.h:22
tachyon::ElementEvent::state
const InputState & state
the input snapshot of this event
Definition
gui_input_handler_func.h:23
tachyon::ElementEvent::elementRef
const ElementRef & elementRef
Definition
gui_input_handler_func.h:25
tachyon::ElementEvent::rect
const ElementRect * rect
the element's layout rects
Definition
gui_input_handler_func.h:24
tachyon::ElementEvent::LocalCursor
int2 LocalCursor(const ElementStorage &storage) const
Cursor in the space rect->rect is stored in (inverse of ancestor contentTransforms).
tachyon::ElementEvent::id
tachyon::ID id
the targeted element
Definition
gui_input_handler_func.h:21
tachyon::ElementRect
Definition
gui_element.h:57
tachyon::ElementRef
An element's slot in ElementStorage: its depth and index within that depth.
Definition
gui_element.h:127
tachyon::ID
A 64-bit element ID whose bit layout depends on its IDMode.
Definition
gui_id.h:23
tachyon::InputState
Snapshot of input state for a single recorded OS event.
Definition
gui_input_state.h:17
tachyon::int2
Integer 2D vector.
Definition
gui_base_types.h:19
gui_core
input
gui_input_handler_func.h
Generated by
1.18.0