TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_frame_pipeline.h
Go to the documentation of this file.
1#pragma once
2
3#include <cstdint>
4#include <functional>
5#include <vector>
6
7namespace tachyon
8{
11
12 class GUIApplication;
13 class IDManager;
14 class GUIStateManager;
15 class StyleManager;
16 class ElementStorage;
17 class WindowRegistry;
18 class OSWindowManager;
20 class TabChainManager;
21 class MenuManager;
22 class TooltipManager;
23 class GUITheme;
24 class ITextSystem;
25 class InputManager;
26 class IWindowBackend;
27
50
65
66 using StageCallback = std::function<void(FrameContext&)>;
67
74 {
75 public:
78 void OnPreFrame (StageCallback cb) { m_preFrame.push_back(std::move(cb)); }
79 void OnPreConstruct (StageCallback cb) { m_preConstruct.push_back(std::move(cb)); }
80 void OnPostConstruct (StageCallback cb) { m_postConstruct.push_back(std::move(cb)); }
81 void OnPreLayout (StageCallback cb) { m_preLayout.push_back(std::move(cb)); }
82 void OnPostLayout (StageCallback cb) { m_postLayout.push_back(std::move(cb)); }
83 void OnPreInput (StageCallback cb) { m_preInput.push_back(std::move(cb)); }
84 void OnPostInput (StageCallback cb) { m_postInput.push_back(std::move(cb)); }
85 void OnPreRender (StageCallback cb) { m_preRender.push_back(std::move(cb)); }
86 void OnPostRender (StageCallback cb) { m_postRender.push_back(std::move(cb)); }
87 void OnEndFrame (StageCallback cb) { m_endFrame.push_back(std::move(cb)); }
89
91 void RunStage(FrameStage stage, FrameContext& ctx);
92
93 private:
94 std::vector<StageCallback> m_preFrame;
95 std::vector<StageCallback> m_preConstruct;
96 std::vector<StageCallback> m_postConstruct;
97 std::vector<StageCallback> m_preLayout;
98 std::vector<StageCallback> m_postLayout;
99 std::vector<StageCallback> m_preInput;
100 std::vector<StageCallback> m_postInput;
101 std::vector<StageCallback> m_preRender;
102 std::vector<StageCallback> m_postRender;
103 std::vector<StageCallback> m_endFrame;
104 };
105
106}
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
void RunStage(FrameStage stage, FrameContext &ctx)
Runs the callbacks of stage in registration order.
The application: owns the windows, the systems and the frame loop.
Definition gui_application.h:185
Owns the per-frame state objects and runs their BeginFrame / EndFrame in order.
Definition gui_state_manager.h:65
The library's styles, icons and theme metrics, the defaults the controls draw with.
Definition gui_theme.h:46
Makes element IDs: per-frame dynamic / ranged IDs (hashed from the call site or a hint and the parent...
Definition gui_id_manager.h:27
Text and icon registration, measurement, rendering and editing.
Definition gui_text_system.h:178
Makes and manages the OS windows and delivers their input; GUIApplication::SetWindowBackend sets one,...
Definition gui_window_backend.h:105
Receives raw OS events, records them, and runs the frame's input pipeline (tab navigation,...
Definition gui_input_manager.h:33
State of the open menus (menu bar dropdowns, context menus, submenus) and their mouse and keyboard be...
Definition gui_menu_manager.h:29
Keeps the OS windows (through an IWindowBackend) and their window contexts for the GUI's window eleme...
Definition gui_os_window_manager.h:61
Bakes serializable Styles into deduplicated runtime layout/visual styles; a StyleRef holds indices in...
Definition gui_style_manager.h:39
Tracks the next/prev tab targets around the focused element, rebuilt each frame during construction a...
Definition gui_tab_chain_manager.h:18
Decides which element's tooltip shows: the hovered one after a delay, or at once for focus moved by t...
Definition gui_tooltip_manager.h:17
Tracks in-progress visual state transitions per element ID.
Definition gui_transition_manager.h:43
Per-window lists of ElementRefs in addition (render) order, driven during ElementStorage construction...
Definition gui_window_registry.h:33
void OnPostRender(StageCallback cb)
Definition gui_frame_pipeline.h:86
void OnPreRender(StageCallback cb)
Definition gui_frame_pipeline.h:85
void OnPreConstruct(StageCallback cb)
Definition gui_frame_pipeline.h:79
void OnPreInput(StageCallback cb)
Definition gui_frame_pipeline.h:83
void OnPreLayout(StageCallback cb)
Definition gui_frame_pipeline.h:81
void OnEndFrame(StageCallback cb)
Definition gui_frame_pipeline.h:87
FrameStage
The stages of a frame, in run order.
Definition gui_frame_pipeline.h:53
void OnPreFrame(StageCallback cb)
Adds cb to the end of that stage's callbacks.
Definition gui_frame_pipeline.h:78
void OnPostInput(StageCallback cb)
Definition gui_frame_pipeline.h:84
void OnPostConstruct(StageCallback cb)
Definition gui_frame_pipeline.h:80
std::function< void(FrameContext &)> StageCallback
Definition gui_frame_pipeline.h:66
void OnPostLayout(StageCallback cb)
Definition gui_frame_pipeline.h:82
@ PostConstruct
after OnGUI() returns, before elementStorage.EndConstruction()
Definition gui_frame_pipeline.h:56
@ PreInput
hit-test, hover/active/cursor resolution, transitions
Definition gui_frame_pipeline.h:59
@ PreConstruct
after elementStorage.BeginConstruction(), before OnGUI()
Definition gui_frame_pipeline.h:55
@ PreRender
before OnRender()
Definition gui_frame_pipeline.h:61
@ PostRender
after OnRender(); transition purge
Definition gui_frame_pipeline.h:62
@ PreLayout
after textSystem->Update() and SyncWindowsBeforeLayout, before Layout()
Definition gui_frame_pipeline.h:57
@ PostInput
after inputManager->Process; scroll-offset/rect snapshots
Definition gui_frame_pipeline.h:60
@ PreFrame
theme reload, synthetic mouse events, per-frame cache clears
Definition gui_frame_pipeline.h:54
@ PostLayout
after Layout() and per-element AddPostLayout callbacks
Definition gui_frame_pipeline.h:58
Definition gui_logging.h:24
Per-frame values plus references to long-lived managers, passed to every stage callback.
Definition gui_frame_pipeline.h:32
GUIApplication & app
Definition gui_frame_pipeline.h:33
MenuManager & menuManager
Definition gui_frame_pipeline.h:42
TransitionManager & transitionManager
Definition gui_frame_pipeline.h:40
ElementStorage & elementStorage
Definition gui_frame_pipeline.h:37
TabChainManager & tabChainManager
Definition gui_frame_pipeline.h:41
StyleManager & styleManager
Definition gui_frame_pipeline.h:36
IDManager & idManager
Definition gui_frame_pipeline.h:34
GUITheme & theme
Definition gui_frame_pipeline.h:44
InputManager * inputManager
Definition gui_frame_pipeline.h:46
GUIStateManager & guiStateManager
Definition gui_frame_pipeline.h:35
ITextSystem * textSystem
Definition gui_frame_pipeline.h:45
OSWindowManager & windowManager
Definition gui_frame_pipeline.h:39
WindowRegistry & windowRegistry
Definition gui_frame_pipeline.h:38
TooltipManager & tooltipManager
Definition gui_frame_pipeline.h:43
IWindowBackend * windowBackend
Definition gui_frame_pipeline.h:47
float elapsedTimeSecs
Definition gui_frame_pipeline.h:48