TachyonUI 0.1.0
High-performance UI for building tools.
Loading...
Searching...
No Matches
gui_tree_grid_types.h
Go to the documentation of this file.
1#pragma once
2
3#include <gui_core/gui_id.h>
4#include <gui_core/style/gui_style_text.h> // IconID
5
6#include <gui_controls/gui_widget_state_types.h> // MultiSelectState, ItemDragDropConfig, DoubleClickTracker
7
8#include <string>
9#include <vector>
10
11// TreeView / ListView / GridView data + construction state.
12
13namespace tachyon
14{
17
18 // ---- Transient tree/list construction state (valid between Begin/End) ----
19 //
20 // Valid only between Begin*/End* (reset in End*). Event handlers run at end of frame,
21 // so they must capture the user-owned pointers instead of reading m_treeState.
22 //
34
35 // ---- GridView: icon grid ----
36 //
37 // Like TreeViewState: valid only between BeginGridView/EndGridView; handlers must
38 // capture user-owned pointers.
39 //
52
53 // ---- GridView rename lookup ----
54 // Filled by GridViewItem for items with a renameBuffer; read by end-of-frame rename handlers.
56 struct GridItemRenameInfo { std::string* renameBuf = nullptr; std::string renameSeed; };
57
58 // ---- TreeView (flat-data, virtualized) -----------------------------
59 // Caller-owned flat rows shown through a VirtualTable. Call RebuildTreeViewIndex after
60 // structural changes. Selection, scroll and drag-drop live on the TableState; a row ID
61 // maps to its flat index via visibleIdx[rowID.value.subRangeParts.index].
64 {
67 std::string name;
68 int depth = 0;
69 bool isOpen = false;
71 std::string* renameBuffer = nullptr;
72
73 // Derived by RebuildTreeViewIndex
74
76 int skipCount = 0;
78 uint32_t ancestorLineMask = 0;
79 bool isLastSibling = true;
80
81 bool HasChildren() const { return skipCount > 0; }
82 };
83
84 // ---- Virtualized GridView ----
85 //
86 // Like BeginGridView, but only visible rows are emitted. Column count and visible rows
87 // come from last frame's viewport (one-frame settle on first show / resize).
90 {
91 int32_t lastViewportW = 0;
92 int32_t lastViewportH = 0;
95 int32_t cellStretchedW = 0;
96
98 struct Internal
99 {
100 // Slow-re-click rename state
105 // Layout for keyboard navigation, which runs after layout
106 int32_t cols = 1;
107 int32_t rowStride = 1;
108 int32_t cellH = 1;
110 };
111
113}
IconID
Handle for an icon registered with ITextSystem::RegisterIconFromSVG / RegisterIconFromSVGFile.
Definition gui_style_text.h:15
@ Invalid
Definition gui_style_text.h:15
Definition gui_logging.h:24
Click-gesture tracker, owned per widget instance so instances (and tests) don't share it.
Definition gui_widget_state_types.h:75
Rename buffer and original name of a grid item; internal.
Definition gui_tree_grid_types.h:56
std::string * renameBuf
Definition gui_tree_grid_types.h:56
std::string renameSeed
Definition gui_tree_grid_types.h:56
Construction state of the current GridView; internal.
Definition gui_tree_grid_types.h:41
DoubleClickTracker * clickTracker
Slow-re-click rename state in the user's GridViewVirtualState.
Definition gui_tree_grid_types.h:49
tachyon::ID containerID
Definition gui_tree_grid_types.h:42
int nextItemIndex
Definition gui_tree_grid_types.h:43
int * selectedIndex
Definition gui_tree_grid_types.h:44
MultiSelectState * multiSelect
Definition gui_tree_grid_types.h:45
tachyon::ID * pendingRenameClick
see clickTracker
Definition gui_tree_grid_types.h:50
ItemDragDropConfig * dragDrop
Definition gui_tree_grid_types.h:46
Written by the grid view each frame; not part of the API.
Definition gui_tree_grid_types.h:99
int32_t cellH
Definition gui_tree_grid_types.h:108
tachyon::ID pendingRenameClick
Definition gui_tree_grid_types.h:102
int32_t rowStride
Definition gui_tree_grid_types.h:107
int32_t cols
Definition gui_tree_grid_types.h:106
tachyon::ID itemsRangeID
Items range ID, so F2 can map selectedIndex to an ID.
Definition gui_tree_grid_types.h:104
DoubleClickTracker itemClickTracker
Definition gui_tree_grid_types.h:101
User-owned, persistent state of a virtualized GridView; keep it alive across frames.
Definition gui_tree_grid_types.h:90
struct tachyon::GridViewVirtualState::Internal internal
not part of the API
int32_t cellStretchedW
Cell width (pixels) that makes the columns exactly fill the viewport; use it for fill-width items.
Definition gui_tree_grid_types.h:95
int32_t lastViewportW
last frame's viewport width, pixels
Definition gui_tree_grid_types.h:91
int32_t lastViewportH
last frame's viewport height, pixels
Definition gui_tree_grid_types.h:92
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
Drag & drop setup for item-based views (tree, list, grid): items drag a payload and accept drops of t...
Definition gui_widget_state_types.h:55
Selected item IDs of a multi-select view; user-owned, keep it alive across frames.
Definition gui_widget_state_types.h:22
One row of a flat-data tree view (VirtualTreeView); rows are in depth-first order.
Definition gui_tree_grid_types.h:64
uint32_t ancestorLineMask
Bit d is set when the ancestor at depth d+1 has a next sibling; drives guide lines.
Definition gui_tree_grid_types.h:78
int depth
nesting level, 0 = root; defines the hierarchy
Definition gui_tree_grid_types.h:68
bool isLastSibling
no later sibling at the same depth
Definition gui_tree_grid_types.h:79
int skipCount
Number of descendant rows (skipped when the row is closed); > 0 means it has children.
Definition gui_tree_grid_types.h:76
std::string name
label
Definition gui_tree_grid_types.h:67
std::string * renameBuffer
null = not renameable
Definition gui_tree_grid_types.h:71
IconID icon
Definition gui_tree_grid_types.h:70
bool HasChildren() const
Definition gui_tree_grid_types.h:81
bool isOpen
expanded
Definition gui_tree_grid_types.h:69
Construction state of the current TreeView / ListView; internal.
Definition gui_tree_grid_types.h:24
int * selectedIndex
for ListView index-based selection
Definition gui_tree_grid_types.h:29
int depth
nesting depth (0 = top-level, no guide lines)
Definition gui_tree_grid_types.h:28
tachyon::ID * selectedID
for single-ID selection
Definition gui_tree_grid_types.h:30
int nextItemIndex
Definition gui_tree_grid_types.h:26
MultiSelectState * multiSelect
for multi-selection
Definition gui_tree_grid_types.h:31
tachyon::ID containerID
Definition gui_tree_grid_types.h:25
ItemDragDropConfig * dragDrop
drag & drop config
Definition gui_tree_grid_types.h:32
int totalItemCount
Definition gui_tree_grid_types.h:27