TachyonUI
0.1.0
High-performance UI for building tools.
Toggle main menu visibility
Loading...
Searching...
No Matches
gui_label_binding.h
Go to the documentation of this file.
1
// Label-to-control binding for the current construction phase.
2
//
3
// - Pending label ID: the label just registered, for the next control to link to.
4
// - Focused associated label IDs: labels whose bound control is focused, so
5
// they get :focus too (one frame late).
6
//
7
// Owned by GUIStateManager.
8
9
#pragma once
10
11
#include <
gui_core/gui_id.h
>
12
#include <
gui_core/elements/gui_element.h
>
13
14
#include <vector>
15
16
namespace
tachyon
17
{
20
21
class
ElementStorage
;
22
24
class
LabelBinding
25
{
26
ID
m_currentLabelID =
ID::Invalid
();
27
std::vector<ID> m_focusedAssociatedLabelIDs;
28
29
public
:
31
void
RegisterPendingLabel
(
ID
labelID) { m_currentLabelID = labelID; }
32
void
ClearPendingLabel
() { m_currentLabelID =
ID::Invalid
(); }
33
ID
GetPendingLabelID
()
const
{
return
m_currentLabelID; }
34
35
void
ClearFocusedAssociatedLabelIDs
() { m_focusedAssociatedLabelIDs.clear(); }
36
void
AddFocusedAssociatedLabelID
(
ID
id
) { m_focusedAssociatedLabelIDs.push_back(
id
); }
38
const
std::vector<ID>&
GetFocusedAssociatedLabelIDs
()
const
{
return
m_focusedAssociatedLabelIDs; }
39
41
static
ID
ResolveControlForLabel
(
const
ElementStorage
& storage,
ID
labelID);
42
44
static
ID
FindFirstControlInSubtree
(
const
ElementStorage
& storage,
const
ElementRef
& rootRef);
45
};
46
47
}
tachyon::ElementStorage
The frame's element tree.
Definition
gui_element_storage.h:100
tachyon::LabelBinding
Links labels to the controls they describe during construction; owned by GUIStateManager.
Definition
gui_label_binding.h:25
tachyon::LabelBinding::RegisterPendingLabel
void RegisterPendingLabel(ID labelID)
Remembers labelID as the label the next control links to.
Definition
gui_label_binding.h:31
tachyon::LabelBinding::GetFocusedAssociatedLabelIDs
const std::vector< ID > & GetFocusedAssociatedLabelIDs() const
Labels whose bound control is focused; they get :focus too, one frame late.
Definition
gui_label_binding.h:38
tachyon::LabelBinding::ResolveControlForLabel
static ID ResolveControlForLabel(const ElementStorage &storage, ID labelID)
The control bound to label labelID, or Invalid.
tachyon::LabelBinding::ClearFocusedAssociatedLabelIDs
void ClearFocusedAssociatedLabelIDs()
Definition
gui_label_binding.h:35
tachyon::LabelBinding::AddFocusedAssociatedLabelID
void AddFocusedAssociatedLabelID(ID id)
Definition
gui_label_binding.h:36
tachyon::LabelBinding::ClearPendingLabel
void ClearPendingLabel()
Definition
gui_label_binding.h:32
tachyon::LabelBinding::GetPendingLabelID
ID GetPendingLabelID() const
Definition
gui_label_binding.h:33
tachyon::LabelBinding::FindFirstControlInSubtree
static ID FindFirstControlInSubtree(const ElementStorage &storage, const ElementRef &rootRef)
First IsControl element in rootRef's subtree (pre-order), or Invalid.
gui_element.h
gui_id.h
tachyon
Definition
gui_logging.h:24
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::ID::Invalid
static constexpr ID Invalid()
The "no element" ID (all bits zero); also the default for optional ID parameters.
Definition
gui_id.h:66
gui_controls
gui_label_binding.h
Generated by
1.18.0