TachyonUI 0.1.0
High-performance UI for building tools.
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>
13
14#include <vector>
15
16namespace tachyon
17{
20
21 class ElementStorage;
22
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}
The frame's element tree.
Definition gui_element_storage.h:100
Links labels to the controls they describe during construction; owned by GUIStateManager.
Definition gui_label_binding.h:25
void RegisterPendingLabel(ID labelID)
Remembers labelID as the label the next control links to.
Definition gui_label_binding.h:31
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
static ID ResolveControlForLabel(const ElementStorage &storage, ID labelID)
The control bound to label labelID, or Invalid.
void ClearFocusedAssociatedLabelIDs()
Definition gui_label_binding.h:35
void AddFocusedAssociatedLabelID(ID id)
Definition gui_label_binding.h:36
void ClearPendingLabel()
Definition gui_label_binding.h:32
ID GetPendingLabelID() const
Definition gui_label_binding.h:33
static ID FindFirstControlInSubtree(const ElementStorage &storage, const ElementRef &rootRef)
First IsControl element in rootRef's subtree (pre-order), or Invalid.
Definition gui_logging.h:24
An element's slot in ElementStorage: its depth and index within that depth.
Definition gui_element.h:127
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