TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_button_group_subsystem.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <vector>
5
8
9namespace tachyon
10{
13
14 class ElementStorage;
15 class StyleManager;
16 class FramePipeline;
17 struct FrameContext;
18
24 {
25 public:
34
35 ButtonGroupSubsystem(FramePipeline& frame, ElementStorage& elementStorage, StyleManager& styleManager);
36
45
52
56
58 bool IsBalanced() const { return m_buttonStack.empty() && m_toggleStack.empty(); }
59
60 private:
61 void OnEndFrame();
62
63 struct StackEntry { ItemState state; uint32_t nestingDepth; };
64
65 std::vector<StackEntry> m_buttonStack;
66 std::vector<StackEntry> m_toggleStack;
67 ElementStorage& m_elementStorage;
68 StyleManager& m_styleManager;
69 };
70
71}
void BeginToggleGroup(ItemState state)
Opens a toggle group at the current nesting depth.
ButtonGroupSubsystem(FramePipeline &frame, ElementStorage &elementStorage, StyleManager &styleManager)
void BeginButtonGroup(ItemState state)
Opens a button group at the current nesting depth.
void EndToggleGroup()
Closes the innermost toggle group, restyling a single item as solo.
tachyon::StyleRef NextItemStyleRef(ItemState &state)
Style for the next item.
ItemState * GetActiveToggle()
The innermost toggle group when it was opened at the current nesting depth, else nullptr.
ItemState * GetActiveButton()
The innermost button group when it was opened at the current nesting depth, else nullptr.
bool IsBalanced() const
True iff every Begin*Group was matched by End*Group.
Definition gui_button_group_subsystem.h:58
void EndButtonGroup()
Closes the innermost button group, restyling a single item as solo.
The frame's element tree.
Definition gui_element_storage.h:100
Stage callbacks run in registration order (no priorities): if A must run before B,...
Definition gui_frame_pipeline.h:74
Bakes serializable Styles into deduplicated runtime layout/visual styles; a StyleRef holds indices in...
Definition gui_style_manager.h:39
Definition gui_logging.h:24
One open group: its styles and the items registered so far.
Definition gui_button_group_subsystem.h:28
tachyon::ElementRef firstRef
Definition gui_button_group_subsystem.h:32
tachyon::StyleRef itemStyleRef
Definition gui_button_group_subsystem.h:29
int32_t itemCount
Definition gui_button_group_subsystem.h:31
tachyon::StyleRef soloStyleRef
Definition gui_button_group_subsystem.h:30
An element's slot in ElementStorage: its depth and index within that depth.
Definition gui_element.h:127
static constexpr ElementRef Invalid()
Definition gui_element.h:135
Per-frame values plus references to long-lived managers, passed to every stage callback.
Definition gui_frame_pipeline.h:32
A registered style, as StyleManager::Register returns it: indices into the shared style pools,...
Definition gui_style_ref.h:25