7#include <unordered_map>
8#include <unordered_set>
12#include <source_location>
15#include <initializer_list>
137 std::span<const MessageDialogItem>
items;
225 std::unique_ptr<SliderFieldTrackSubsystem> m_sliderFieldTrack;
226 std::unique_ptr<MenuRectsSubsystem> m_menuRects;
227 std::unique_ptr<LabelGroupSubsystem> m_labelGroup;
228 std::unique_ptr<ButtonGroupSubsystem> m_buttonGroup;
229 std::unique_ptr<ColorPickerSubsystem> m_colorPickerSub;
230 std::unique_ptr<GradientEditorSubsystem> m_gradientEditorSub;
231 std::unique_ptr<RenameSubsystem> m_renameSub;
232 std::unique_ptr<ReorderableSubsystem> m_reorderable;
233 std::unique_ptr<DockTabDragSubsystem> m_dockTabDragSub;
234 ToolbarWindowDragSubsystem m_toolbarWindowDrag{};
235 std::unique_ptr<UICacheManager> m_uiCache;
292 std::function<
void()> onPanelGUI,
293 std::string panelType = {},
294 std::function<void()> onEnable = {},
295 std::function<void()> onDisable = {});
299 std::function<
void()> onPanelGUI,
300 std::string panelType = {},
301 std::function<void()> onEnable = {},
302 std::function<void()> onDisable = {})
305 CreatePanel(panels,
id, std::move(title), icon, std::move(onPanelGUI),
306 std::move(panelType), std::move(onEnable), std::move(onDisable));
433 void SetGraphicsBackend(std::unique_ptr<GraphicsContext> backend) { m_graphicsBackend = std::move(backend); }
438 void SetWindowBackend(std::unique_ptr<IWindowBackend> backend) { m_osWindowBackend = std::move(backend); }
534 bool reserveIcon,
IconID icon, std::string_view text,
535 std::string_view trailing,
StyleRef trailingStyle,
563 inline bool Button(
const GUIContent& content, std::function<
void()> onClick,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Button(
idManager.AllocateDynamicID(site), content, std::move(onClick), style, std::move(constraints)); }
577 inline bool Checkbox(
bool value, std::string_view text, std::function<
void(
bool)> onToggle,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Checkbox(
idManager.AllocateDynamicID(site), value, text, std::move(onToggle), style, std::move(constraints)); }
579 inline bool Checkbox(
bool value, std::string_view text, std::function<
void(
bool)> onToggle,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Checkbox(
idManager.AllocateDynamicID(site), value, text, std::move(onToggle),
theme.
checkboxStyleRef, std::move(constraints)); }
581 inline bool Checkbox(
ID id,
bool& value, std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}) {
return Checkbox(
id, value, text, [&value](
bool newValue){ value = newValue; }, style, std::move(constraints)); }
585 inline bool Checkbox(
bool& value, std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Checkbox(
idManager.AllocateDynamicID(site), value, text, [&value](
bool newValue){ value = newValue; }, style, std::move(constraints)); }
587 inline bool Checkbox(
bool& value, std::string_view text = {},
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Checkbox(
idManager.AllocateDynamicID(site), value, text, [&value](
bool newValue){ value = newValue; },
theme.
checkboxStyleRef, std::move(constraints)); }
594 inline bool Switch(
bool value, std::string_view text, std::function<
void(
bool)> onToggle,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Switch(
idManager.AllocateDynamicID(site), value, text, std::move(onToggle), style, std::move(constraints)); }
596 inline bool Switch(
bool value, std::string_view text, std::function<
void(
bool)> onToggle,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Switch(
idManager.AllocateDynamicID(site), value, text, std::move(onToggle),
theme.
switchStyleRef, std::move(constraints)); }
598 inline bool Switch(
ID id,
bool& value, std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}) {
return Switch(
id, value, text, [&value](
bool newValue){ value = newValue; }, style, std::move(constraints)); }
602 inline bool Switch(
bool& value, std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Switch(
idManager.AllocateDynamicID(site), value, text, [&value](
bool newValue){ value = newValue; }, style, std::move(constraints)); }
604 inline bool Switch(
bool& value, std::string_view text = {},
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Switch(
idManager.AllocateDynamicID(site), value, text, [&value](
bool newValue){ value = newValue; },
theme.
switchStyleRef, std::move(constraints)); }
611 inline bool Toggle(
bool value,
const GUIContent& content, std::function<
void(
bool)> onToggle,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Toggle(
idManager.AllocateDynamicID(site), value, content, std::move(onToggle), style, std::move(constraints)); }
619 inline bool Toggle(
bool& value,
const GUIContent& content,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Toggle(
idManager.AllocateDynamicID(site), value, content, [&value](
bool newValue){ value = newValue; }, style, std::move(constraints)); }
634 inline bool BeginMenu( std::string_view text,
StyleRef buttonStyle,
StyleRef menuStyle,
StyleRef itemStyle,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return BeginMenu(
idManager.AllocateDynamicID(site), text, buttonStyle, menuStyle, itemStyle, std::move(constraints)); }
645 inline bool Dropdown(
int& selected, std::span<const std::string_view> options,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Dropdown(
idManager.AllocateDynamicID(site), selected, options, style, std::move(constraints)); }
651 inline bool Dropdown(
int& selected, std::initializer_list<std::string_view> options,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Dropdown(
idManager.AllocateDynamicID(site), selected, std::span<const std::string_view>(options.begin(), options.size()),
theme.
controls->
menuTrigger, std::move(constraints)); }
653 inline bool Dropdown(
ID id,
int& selected, std::initializer_list<std::string_view> options,
StyleRef style,
LayoutOverride&& constraints = {}) {
return Dropdown(
id, selected, std::span<const std::string_view>(options.begin(), options.size()), style, std::move(constraints)); }
655 inline bool Dropdown(
int& selected, std::initializer_list<std::string_view> options,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Dropdown(
idManager.AllocateDynamicID(site), selected, std::span<const std::string_view>(options.begin(), options.size()), style, std::move(constraints)); }
687 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
688 {
Banner(
idManager.AllocateDynamicID(site), severity, message, actions, std::move(constraints)); }
710 inline bool MenuItem(
const GUIContent& content, std::string_view shortcut, std::function<
void()> onClick,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return MenuItem(
idManager.AllocateDynamicID(site), content, shortcut, std::move(onClick), style, std::move(constraints)); }
714 inline bool MenuItem(
const GUIContent& content, std::function<
void()> onClick,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return MenuItem(
idManager.AllocateDynamicID(site), content, std::string_view{}, std::move(onClick), style, std::move(constraints)); }
723 inline bool DestructiveMenuItem(
const GUIContent& content, std::string_view shortcut, std::function<
void()> onClick,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return DestructiveMenuItem(
idManager.AllocateDynamicID(site), content, shortcut, std::move(onClick), style, std::move(constraints)); }
786 void SetTooltip(
ID targetID, std::string_view text, std::string_view shortcut);
837 inline bool BeginLabelGroup(
CssPx defaultWidth = 120,
CssPx minWidth = 40,
CssPx maxWidth = 500,
bool resizable =
true, std::source_location site = std::source_location::current()) {
return BeginLabelGroup(
idManager.AllocateDynamicID(site), defaultWidth, minWidth, maxWidth, resizable); }
962 bool emitVert =
true,
963 bool emitHorz =
true);
977 bool BeginReorderableGroup(
ID id,
ReorderDirection direction,
bool isWrapped, std::function<
void(
int fromIndex,
int toIndex)> onReorder,
StyleRef style,
LayoutOverride&& constraints = {}, std::function<void(
int,
tachyon::int2)> onDragOut =
nullptr, std::function<void(
int,
tachyon::int2)> dragVisualizer =
nullptr);
980 {
return BeginReorderableGroup(
id, direction,
false, std::move(onReorder), style, std::move(constraints)); }
1043 inline bool BeginListView(
int* selectedIndex,
int itemCount,
ItemDragDropConfig* dragDrop,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return BeginListView(
idManager.AllocateDynamicID(site), selectedIndex, itemCount, dragDrop, style, std::move(constraints)); }
1045 inline bool BeginListView(
int* selectedIndex,
int itemCount,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return BeginListView(
idManager.AllocateDynamicID(site), selectedIndex, itemCount,
nullptr, style, std::move(constraints)); }
1069 std::vector<int>& visibleIdx);
1074 std::vector<TreeViewRow>& rows,
1075 std::vector<int>& visibleIdx,
1079 std::string_view header = {});
1083 std::source_location site = std::source_location::current())
1084 {
VirtualTreeView(
idManager.AllocateDynamicID(site), rows, visibleIdx, state, style, std::move(constraints), header); }
1128 inline bool BeginGridView(
int* selectedIndex,
StyleRef style,
MultiSelectState* multiSelect =
nullptr,
ItemDragDropConfig* dragDrop =
nullptr,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return BeginGridView(
idManager.AllocateDynamicID(site), selectedIndex, style, multiSelect, dragDrop, std::move(constraints)); }
1138 std::string* renameBuffer =
nullptr,
1156 bool IsRenaming()
const {
return m_renameSub && m_renameSub->isActive; }
1163 int itemCount,
int2 cellSize,
1164 const std::function<
void(
int index,
ID itemID)>& generateItem,
1165 int* selectedIndex =
nullptr,
1170 LayoutOverride&& constraints = {});
1173 const std::function<
void(
int index,
ID itemID)>& generateItem,
1176 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1177 {
VirtualGridView(
idManager.AllocateDynamicID(site), vstate, itemCount, cellSize, generateItem, selectedIndex, multiSelect, dragDrop, scrollStyle, rowStyle, std::move(constraints)); }
1200 {
return BeginTable(
id, columns, N, state, style, std::move(constraints)); }
1208 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1209 {
return BeginTable(
idManager.AllocateDynamicID(site), columns, columnCount, state, style, std::move(constraints)); }
1212 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1217 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1218 {
return BeginTable(
idManager.AllocateDynamicID(site), columns, N, state, style, std::move(constraints)); }
1222 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1237 void Cell(std::function<
void()> emit);
1251 void TreeCell(std::string_view text,
int depth,
bool* isOpen,
1253 uint32_t ancestorLineMask = 0,
1254 bool isLastSibling =
true,
1255 std::string* renameBuffer =
nullptr,
1256 bool reserveExpander =
true);
1267 std::span<VirtualTableColumn> columns,
1269 CssPx rowHeight = 0,
1275 std::source_location site = std::source_location::current())
1276 {
VirtualTable(
idManager.AllocateDynamicID(site), state, columns, totalRowCount, rowHeight, style, std::move(constraints)); }
1292 inline bool Breadcrumb( std::span<const std::string> segments, std::function<
void(
int)> onSelect,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Breadcrumb(
idManager.AllocateDynamicID(site), segments, std::move(onSelect), style, std::move(constraints)); }
1366 std::function<
void(
int,
int)> onReorder,
1367 std::function<
void(
int)> onClose =
nullptr,
1368 std::function<
void(
int,
tachyon::int2)> onDragOut =
nullptr,
1369 std::function<
void(
int,
tachyon::int2)> dragVisualizer =
nullptr,
1373 const TabBarOptions& options = {});
1376 std::function<
void(
int,
int)> onReorder,
1377 std::function<
void(
int)> onClose =
nullptr,
1378 std::function<
void(
int,
tachyon::int2)> onDragOut =
nullptr,
1379 std::function<
void(
int,
tachyon::int2)> dragVisualizer =
nullptr,
1382 std::source_location site = std::source_location::current())
1383 {
return BeginTabBar(
idManager.AllocateDynamicID(site), selectedIndex, std::move(onReorder), std::move(onClose), std::move(onDragOut), std::move(dragVisualizer), style, std::move(constraints), layout); }
1438 inline bool Field(
bool& value, std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Field(
idManager.AllocateDynamicID(site), value, text, style, std::move(constraints)); }
1463 inline bool SearchField(
ID id, std::string& value,
IconID icon,
TextEditBehavior textEditBehavior,
StyleRef style,
LayoutOverride&& constraints = {}) {
return SearchField(
id, value, icon, textEditBehavior, style, std::move(constraints),
nullptr); }
1467 inline bool SearchField( std::string& value,
IconID icon,
TextEditBehavior textEditBehavior,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return SearchField(
idManager.AllocateDynamicID(site), value, icon, textEditBehavior, style, std::move(constraints)); }
1490 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1496 [
this](tachyon::Element& element) {
return textSystem->
RegisterText(element.id,
"\xe2\x80\x94", element.styleRef, element.state); },
1497 std::move(constraints));
1505 if (nodeRowFieldMinWidth > 0 && !constraints.
HasFixedWidth())
1507 bool modified =
false;
1510 [
this, &modified, &value, textEditBehavior, config](tachyon::Element& element) {
1512 if constexpr (std::is_floating_point_v<T>)
1513 if (std::isnan(value))
1517 std::move(constraints));
1524 bool modified =
false;
1526 constraints.
Width(0);
1536 for (
int i = 0; i < TypeDimensions<T>::dimensions; i++)
1541 .MinWidth(40)) || modified;
1551 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1554 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1557 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1560 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1563 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1566 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1569 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1572 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1573 inline bool Field( T& value,
TextEditBehavior textEditBehavior,
StyleRef style,
NumericFieldConfig<ComponentT> config,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Field<T>(
idManager.AllocateDynamicID(site), value, textEditBehavior, style, config, std::move(constraints)); }
1575 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1578 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1581 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1584 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1587 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1591 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1596 template<
typename T>
1599 if constexpr (std::is_same_v<T, float>)
return "f32";
1600 else if constexpr (std::is_same_v<T, double>)
return "f64";
1601 else if constexpr (std::is_same_v<T, int8_t>)
return "i8";
1602 else if constexpr (std::is_same_v<T, int16_t>)
return "i16";
1603 else if constexpr (std::is_same_v<T, int32_t>)
return "i32";
1604 else if constexpr (std::is_same_v<T, int64_t>)
return "i64";
1605 else if constexpr (std::is_same_v<T, uint8_t>)
return "u8";
1606 else if constexpr (std::is_same_v<T, uint16_t>)
return "u16";
1607 else if constexpr (std::is_same_v<T, uint32_t>)
return "u32";
1608 else if constexpr (std::is_same_v<T, uint64_t>)
return "u64";
1609 else if constexpr (std::is_same_v<T, std::string>)
return "string";
1614 template<
typename T>
1617 template<
typename T>
1622 const ID boxID =
idManager.AllocateDynamicID(
"typed_field");
1623 const ID typeID =
idManager.AllocateDynamicID(
"typed_field_type");
1625 BeginFieldBox(boxID, style, std::move(constraints));
1633 template<
typename T>
1636 template<
typename T>
1642 template<
typename T>
1645 if (
BeginArea(
id, style, std::move(constraints)))
1649 auto onReorder = [&items](
int from,
int to)
1651 if (from < 0 || from >= (
int)items.size())
return;
1652 if (to < 0 || to >= (
int)items.size())
return;
1653 T moved = std::move(items[from]);
1654 items.erase(items.begin() + from);
1655 items.insert(items.begin() + to, std::move(moved));
1661 for (
int i = 0; i < (int)items.size(); i++)
1668 if constexpr (std::is_arithmetic_v<T>)
1671 Field(items[i], tachyon::LayoutOverride{}.FlexGrow(1));
1679 Button(
idManager.AllocateDynamicID(
"list_add"),
"+ Add item", [&items]() { items.push_back({}); },
1686 template<
typename T>
1689 template<
typename T>
1690 void Field(std::vector<T>& items,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Field(idManager.AllocateDynamicID(site), items, style, std::move(constraints)); }
1692 template<
typename T>
1693 void Field(std::vector<T>& items,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Field(idManager.AllocateDynamicID(site), items, theme.
collectionAreaStyleRef, std::move(constraints)); }
1697 template<
typename V>
1700 if (BeginArea(
id, style, std::move(constraints)))
1703 [[maybe_unused]]
const bool pushed = idManager.
PushParent(
id);
1704 CollectionHeader(TypeTag<V>());
1705 for (
int i = 0; i < (int)items.size(); i++)
1710 Button(theme.
tabCloseIcon, [&items, i]() { items.erase(items.begin() + i); },
1714 Button(idManager.AllocateDynamicID(
"dictionary_add"),
"+ Add entry",
1716 if (pushed) (void)idManager.
PopParent();
1721 template<
typename V>
1724 template<
typename V>
1725 void Field(std::vector<std::pair<std::string, V>>& items,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Field(idManager.AllocateDynamicID(site), items, style, std::move(constraints)); }
1727 template<
typename V>
1728 void Field(std::vector<std::pair<std::string, V>>& items,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Field(idManager.AllocateDynamicID(site), items, theme.
collectionAreaStyleRef, std::move(constraints)); }
1732 template<
typename V>
1735 if (BeginArea(
id, style, std::move(constraints)))
1738 [[maybe_unused]]
const bool pushed = idManager.
PushParent(
id);
1739 CollectionHeader(TypeTag<V>());
1742 std::string renameFrom, renameTo;
1743 bool rename =
false;
1744 for (
auto& pair : items)
1747 std::string key = pair.first;
1750 renameFrom = pair.first;
1755 Button(theme.
tabCloseIcon, [&items, k = pair.first]() { items.erase(k); },
1759 if (rename && !items.contains(renameTo))
1761 auto node = items.extract(renameFrom);
1762 node.key() = renameTo;
1763 items.insert(std::move(node));
1765 Button(idManager.AllocateDynamicID(
"dictionary_add"),
"+ Add entry",
1767 if (pushed) (void)idManager.
PopParent();
1772 template<
typename V>
1775 template<
typename V>
1776 void Field(std::unordered_map<std::string, V>& items,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Field(idManager.AllocateDynamicID(site), items, style, std::move(constraints)); }
1778 template<
typename V>
1779 void Field(std::unordered_map<std::string, V>& items,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Field(idManager.AllocateDynamicID(site), items, theme.
collectionAreaStyleRef, std::move(constraints)); }
1797 inline bool ColorField(
tachyon::color4f& value,
bool allowHDR,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return ColorField(idManager.AllocateDynamicID(site), value, allowHDR, style, std::move(constraints)); }
1805 inline bool ColorField(
tachyon::color4b& value,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return ColorField(idManager.AllocateDynamicID(site), value, style, std::move(constraints)); }
1834 std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return SliderField(idManager.AllocateDynamicID(site), value, minVal, maxVal, text, style, std::move(constraints)); }
1837 std::string_view text,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return SliderField(idManager.AllocateDynamicID(site), value, minVal, maxVal, text, theme.
sliderFieldTrackStyleRef, std::move(constraints)); }
1847 std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return SliderField(idManager.AllocateDynamicID(site), value, minVal, maxVal, text, style, std::move(constraints)); }
1850 std::string_view text,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return SliderField(idManager.AllocateDynamicID(site), value, minVal, maxVal, text, theme.
sliderFieldTrackStyleRef, std::move(constraints)); }
1857 inline bool Slider(
int& value,
int minVal,
int maxVal,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Slider(idManager.AllocateDynamicID(site), value, minVal, maxVal, style, std::move(constraints)); }
1859 inline bool Slider(
int& value,
int minVal,
int maxVal,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Slider(idManager.AllocateDynamicID(site), value, minVal, maxVal, theme.
sliderStyleRef, std::move(constraints)); }
1874 inline void DragLabel( std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { DragLabel(idManager.AllocateDynamicID(site), text, style, std::move(constraints)); }
1876 inline void DragLabel( std::string_view text,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { DragLabel(idManager.AllocateDynamicID(site), text, theme.
dragLabelStyleRef, std::move(constraints)); }
1887 inline void Label( std::string_view text, std::string_view caption,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Label(idManager.AllocateDynamicID(site), text, caption, style, std::move(constraints)); }
1889 inline void Label( std::string_view text, std::string_view caption,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Label(idManager.AllocateDynamicID(site), text, caption, theme.
groupLabelTopStyleRef, std::move(constraints)); }
1893 inline void Label( std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Label(idManager.AllocateDynamicID(site), text, style, std::move(constraints)); }
1895 inline void Label( std::string_view text,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) { Label(idManager.AllocateDynamicID(site), text, theme.
labelStyleRef, std::move(constraints)); }
1902 inline void Text( std::string_view text,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
Text(idManager.AllocateDynamicID(site), text, style, std::move(constraints)); }
1904 inline void Text( std::string_view text,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
Text(idManager.AllocateDynamicID(site), text, theme.
staticTextStyleRef, std::move(constraints)); }
1909 std::function<
void(intptr_t contentId)> onLinkActivate,
1913 { SelectableText(
id, runs, {}, style, std::move(constraints)); }
1919 { SelectableText(idManager.AllocateDynamicID(site), runs, {}, style, std::move(constraints)); }
1921 inline void SelectableText(
const std::span<ContentRun>& runs,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1922 { SelectableText(idManager.AllocateDynamicID(site), runs, {}, theme.
staticTextStyleRef, std::move(constraints)); }
1929 inline void Image(
ImageIndex image,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
Image(idManager.AllocateDynamicID(site), image, style, std::move(constraints)); }
1939 inline void Image(
ImageIndex image,
uint2 sourceSize,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
Image(idManager.AllocateDynamicID(site), image, sourceSize, style, std::move(constraints)); }
1960 m_windowOpen.push_back(
false);
1967 return BeginWindow(windowLayoutID, styleRef, std::move(constraints), elementFlags);
1981 m_windowOpen.push_back(
false);
1986 return BeginWindow(windowLayoutID, styleRef, std::move(constraints), elementFlags);
1993 const int32_t o = m_cursorSize > 0 ? (m_cursorSize * 14 + 16) / 32 :
styleManager.
Px(14);
1994 return int2{ o, o };
2020 auto dragGhostIconID =
idManager.AllocateDynamicID(site);
2023 .id = dragGhostIconID,
2031 VERIFY(ghostIconRes.status);
2086 return BeginWindow(windowLayoutID,
"", styleRef, std::move(constraints), flags, monitorIndex);
2096 const bool open =
OpenWindow(windowLayoutID, title, styleRef, std::move(constraints), flags, monitorIndex);
2097 m_windowOpen.push_back(open);
2106 ReportMisuse(
"GUIApplication: BeginWindow with an invalid ID (not shown)");
2116 if (!m_restoredWindows.empty())
2117 ApplyRestoredWindow(windowLayoutID, constraints, flags);
2119 if (monitorIndex == -1)
2131 .id = windowLayoutID,
2133 .styleRef = styleRef,
2134 .monitorIndex = (int16_t)monitorIndex,
2139 std::move(constraints));
2140 VERIFY(addResult.status);
2148 m_windowIdScopeStack.push_back(pushed);
2149 activeWindowID = windowLayoutID;
2156 if (m_windowOpen.empty())
2158 ReportMisuse(
"GUIApplication: EndWindow without BeginWindow (ignored)");
2161 const bool open = m_windowOpen.back();
2162 m_windowOpen.pop_back();
2173 template<
void (GUIApplication::*EndFn)()>
2179 Scope(
Scope&& other) noexcept : m_app(std::exchange(other.m_app,
nullptr)), m_open(other.m_open) {}
2191 explicit operator bool()
const {
return m_open; }
2242 if (!m_windowIdScopeStack.empty() && m_windowIdScopeStack.back())
2244 if (!m_windowIdScopeStack.empty())
2245 m_windowIdScopeStack.pop_back();
2259 boxElement.
textID = textID;
2281 .styleRef = styleRef,
2298 .styleRef = styleRef,
2315 .styleRef = styleRef,
2324 void AddBox(
StyleRef styleRef, std::string_view text, std::source_location site = std::source_location::current())
2330 void AddBox(
int2 size,
StyleRef styleRef, std::string_view text, std::source_location site = std::source_location::current())
2376 std::function<
void()> render)
2378 pages.push_back({ id, std::string(name), std::move(render) });
2425 void PersistDocuments(std::string key, std::function<std::vector<DocumentWindowRef>()> windows);
2454 std::vector<ID> m_cacheRecordStack;
2457 bool m_keyboardPending =
false;
2458 bool m_tabPending =
false;
2459 uint64_t m_inputFlagsFrame = 0;
2460 void RefreshCachedInputFlags();
2463 void NoteSwatchClaim(
ID swatchID);
2465 std::string PendingLabelText()
const;
2467 struct ColorSwatchLook SwatchLook() const;
2470 std::unordered_map<tachyon::ID, tachyon::ID> m_panelContentIDs;
2473 std::vector<const ControlStyles*> controlStylesStack;
2477 ID contextMenuTargetID { ID::Invalid() };
2478 std::optional<int2> contextMenuScreenPos;
2479 bool m_contextMenuClaimed =
false;
2480 ID tabDragGhostWindowID{ ID::Invalid() };
2482 FrameTimingSample frameTimingHistory[kFrameHistoryCount] = {};
2483 int frameTimingHead = 0;
2486 ColumnDragState m_columnDrag{};
2487 TreeDropState m_treeDropState{};
2491 std::unordered_map<tachyon::ID, int> m_listItemIndexByID;
2496 TreeViewState m_treeState{};
2497 GridViewState m_gridViewState;
2500 std::unordered_map<tachyon::ID, GridItemRenameInfo> m_gridItemRenameByID;
2504 std::optional<TableEmit> m_tableEmit;
2506 std::vector<std::optional<TableEmit>> m_outerTableEmits;
2508 int CurrentCellCol()
const
2510 const int c = m_tableEmit->currentCol;
2511 assert(c <
int(m_tableEmit->columnCount));
2515 TabBarState m_tabBarState;
2516 TabState m_tabState;
2519 void EnableVisiblePanels(DockingLayout& layout);
2523 DockingConstructionState m_dockingState;
2527 std::vector<DockingLayout*> m_dockingLayoutsThisFrame{};
2530 std::vector<struct ToolbarDockState*> m_toolbarDocksThisFrame{};
2533 void SyncDockingScrollOffsets();
2536 void SyncToolbarDockRects();
2541 std::vector<std::unique_ptr<FloatingDockWindow>> m_floatingDockWindows;
2544 void EmitFloatingDockWindowsOf(
const DocumentSet* documents);
2548 std::vector<DocumentSet*> m_documentSetsThisFrame{};
2550 bool ActivateDocumentOf(
const DockingLayout* layout);
2556 ID
id = ID::Invalid();
2557 float shownAt = 0.0f;
2558 float leftAt = -1.0f;
2559 float shownFor = 0.0f;
2561 std::vector<ShownToast> m_toasts;
2563 float m_toastsTime = -1.0f;
2564 bool m_toastsExpanded =
false;
2565 ID m_toastStackID = ID::Invalid();
2566 bool m_toastsBuilt =
false;
2568 DocumentDrag m_documentDrag;
2569 std::vector<IntRect> m_documentBarRects;
2570 std::optional<DocumentMove> m_documentMove;
2572 void ApplyDocumentMove();
2574 void SyncDocumentRects();
2579 void RegisterFrameHooks();
2580 void RegisterFrameBalanceChecks();
2584 bool OpenMenu(ID menuID, std::string_view text, StyleRef buttonStyle, StyleRef menuStyle, StyleRef itemStyle, LayoutOverride&& constraints);
2588 enum class TooltipBox : uint8_t { Plain, Lines,
Help,
Error };
2589 bool OpenTooltip(ID targetID, TooltipBox box = TooltipBox::Plain);
2591 void ShowPinTooltip(
const NodeView& view, ID socketID, PropertyEndpoint pin,
bool isOutput);
2593 void CloseTooltip();
2597 ID
id = ID::Invalid();
2598 ID windowID = ID::Invalid();
2603 bool textOnly =
false;
2604 int16_t monitorIndex = -1;
2609 CutShortText FindCutShortText(int2 mousePos)
const;
2612 void ShowCutShortText();
2613 CutShortText m_cutShort{};
2614 bool OpenContextMenuWindow(ID targetID);
2615 bool OpenCached(ID
id, StyleRef style, uint64_t signature, LayoutOverride&& constraints);
2616 static void ReportInvalidControlID(ID
id);
2618 void RegisterTabStop(ID
id);
2620 bool SearchField(ID
id, std::string& value, IconID icon, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride&& constraints, ID* outFieldID);
2623 void BeginFieldBox(ID
id, StyleRef style, LayoutOverride&& constraints);
2628 void ApplyPendingStyleReload();
2632 void UpdateMouseCursor(ID hoverID, ID hoverWindowID, int2 mousePosition);
2634 void OnRender(
float elapsedTimeSecs);
2637 void FireStateTransitions(
float elapsedTimeSecs);
2640 struct TransitionsSeen
2642 std::vector<ID> hover;
2643 std::vector<ID> focused;
2644 ID active = ID::Invalid();
2646 TransitionsSeen m_transitionsSeen;
2648 void RenderBoxShadows(IntRect rectLayout, IntRect clipRectScreen,
const TransitionState& ts,
bool ring);
2650 void RenderShadowLayer(IntRect rectLayout, IntRect clipRectScreen,
const VisualShadow& s,
float radius);
2652 void RenderInvalidHalo(IntRect rectLayout, IntRect clipRectScreen,
const TransitionState& ts,
float grown);
2655 void RenderInvalidBorder(IntRect rectLayout, IntRect clipRectScreen,
const TransitionState& ts, IntRect snappedPx);
2659 IntRect OpaqueInterior(IntRect rectLayout,
const TransitionState& ts)
const;
2661 Result<void> RecoverDevice();
2664 std::string m_resourceRoot;
2665 std::unique_ptr<IWindowBackend> m_osWindowBackend;
2666 ImageWindowBackend* m_imageWindows {
nullptr };
2668 int2 InjectedScreenPos(ID windowID, int2 pos);
2669 AllocationHooks m_allocationHooks;
2670 std::unique_ptr<GraphicsContext> m_graphicsBackend;
2671 MouseButtons m_lastPhysicalButtons { MouseButtons::None };
2672 std::string ResourcePath(std::string_view path)
const;
2673 std::string m_themePath {
"themes/dark.css" };
2674 bool m_initialized =
false;
2675 bool m_inFrame =
false;
2676 Result<void> m_themeReload {};
2679 struct PersistedWindow { std::string key; ID target; };
2680 struct PersistedDock { std::string key; DockingLayout* target; };
2682 struct PersistedToolbars { std::string key; std::span<std::vector<ToolbarItem>,
kToolbarSideCount> target; };
2683 struct PersistedValue {
using Target = std::variant<bool*, int*, float*, std::string*>; std::string key; Target target; };
2684 struct PersistedDocuments { std::string key; std::function<std::vector<DocumentWindowRef>()> target; };
2685 struct PersistedShortcuts { std::string key; CommandManager* target; };
2686 struct RestoredWindow
2691 bool hasMonitor =
false;
2692 bool hasPosition =
false;
2693 bool rectDone =
false;
2695 std::vector<PersistedWindow> m_persistWindows;
2696 std::vector<PersistedDock> m_persistDocks;
2697 std::vector<PersistedTable> m_persistTables;
2698 std::vector<PersistedToolbars> m_persistToolbars;
2699 std::vector<PersistedValue> m_persistValues;
2700 std::vector<PersistedDocuments> m_persistDocuments;
2701 std::vector<PersistedShortcuts> m_persistShortcuts;
2703 std::unordered_map<std::string, std::vector<SavedDocumentWindow>> m_savedDocuments;
2704 std::unordered_map<ID, RestoredWindow> m_restoredWindows;
2705 void ApplyRestoredWindow(ID windowID, LayoutOverride& constraints, ElementFlags& flags);
2707 void PlaceOnSavedMonitor(RestoredWindow& restored)
const;
2708 int32_t m_cursorSize = 0;
2711 std::vector<bool> m_windowOpen, m_menuOpen, m_tooltipOpen, m_cachedOpen;
2714 std::vector<ConstructionScopes> m_tooltipScopes;
2716 std::string m_loadedThemePath;
2717 float m_loadedFontScale { 1.0f };
2718 std::vector<std::string> m_styleFiles {
"styles.css" };
2719 float m_globalFontScale { 1.0f };
2720 float m_uiScale { 1.0f };
2721 std::optional<bool> m_reducedMotion;
2725 struct ThemeCrossfade
2727 ID window = ID::Invalid();
2728 tachyon::Image* image =
nullptr;
2731 static constexpr float kThemeCrossfadeSecs = 0.2f;
2732 std::vector<ThemeCrossfade> m_crossfades;
2733 float m_crossfadeStart = 0.0f;
2736 void CaptureThemeCrossfade();
2738 void EndThemeCrossfade();
2739 float m_displayScale { 1.0f };
2740 FrameClock m_frameClock;
2741 bool m_themeReloadPending {
false };
2747 void InvalidateCachedScopesForInput(ID overID);
2749 static std::vector<ID> CollectPropagatedAncestors(
const ElementStorage& storage, ID leafID);
2753 void NoteTargetAncestors(int2 mousePos);
2755 ID TooltipHoverID()
const
2761 void InvalidateCachedScopesAbove(ID
id);
2764 void RebuildCachedScopesAbove(ID
id) { m_cacheRebuildRequests.push_back(
id); }
2765 std::vector<ID> m_cacheRebuildRequests;
2768 void NotePanelContentID(ID panelId, ID contentID) { m_panelContentIDs[panelId] = contentID; }
2771 TextAlign nodeRowTextAlign = TextAlign::Start;
2775 int32_t nodeRowFieldMinWidth = 0;
2777 bool BeginDockingFrame();
2778 void EndDockingFrame();
2780 ID activeWindowID { ID::Invalid() };
2781 std::vector<bool> m_windowIdScopeStack;
2784 void EmitNodeViewOverlays(NodeView& view, ID canvasID);
2787 struct TitleBarInfo { ID barID = ID::Invalid(); ID maximizeID = ID::Invalid(); std::vector<ID> captions; };
2788 std::unordered_map<ID, TitleBarInfo> m_titleBars;
2789 std::vector<ID> m_titleBarStack;
2790 std::vector<ID> m_titleBarCaptions;
2791 std::unordered_set<ID> m_closeRequests;
2795 struct SuggestionRow {
IconID icon = IconID::Invalid; std::string_view text; std::string_view trailing; };
2796 static constexpr int kMaxSuggestions = 12;
2797 void SuggestionPopup(ID windowID, ID anchorID, std::span<const SuggestionRow> rows,
int current,
2798 bool reserveIcon, int32_t minWidth, std::function<
void(
int)> onPick);
2800 struct AutocompleteState
2802 ID listWindowID = ID::Invalid();
2804 bool dismissed =
false;
2805 bool picked =
false;
2808 std::unordered_map<ID, AutocompleteState> m_autocomplete;
2812 struct PressOutsideWatch { ID inside[2]; std::function<void()> onPressOutside; };
2813 std::vector<PressOutsideWatch> m_pressOutsideWatches;
2814 void CloseOnPressOutside(ID inside, ID alsoInside, std::function<
void()> onPressOutside)
2815 { m_pressOutsideWatches.push_back({ { inside, alsoInside }, std::move(onPressOutside) }); }
2816 void RunPressOutsideWatches();
2820 void DispatchFileDrops(
const FrameInput& input);
2822 ID OfferFileDrop(EventType type, ID overID, int2 screenPos,
const FileDrop* drop);
2823 ID m_fileDragTargetID = ID::Invalid();
2824 std::vector<FileDrop> m_heldFileDrops;
2825 std::function<void(
const FileDrop&)> m_fileDropHandler;
2826 std::vector<TextStyle> m_mnemonicStyles;
2828 struct ScrimFade {
float amount = 0.0f;
bool wanted =
false;
VisualColorStyleIndex color = VisualColorStyleIndex::Invalid; };
2829 std::unordered_map<ID, ScrimFade> m_scrims;
2830 float m_scrimTime = -1.0f;
2831 void DrawScrims(
float now);
2833 struct PendingAfterDraw { uint32_t endIdx; ElementRef owner; };
2834 std::vector<PendingAfterDraw> m_pendingAfterDraws;
2836 void TitleBarCaption(ID
id) { m_titleBarCaptions.push_back(
id); }
2837 void DockFloatingWindow(FloatingDockWindow& fw);
2845 void EmitColumnSizers(TableEmit& emit,
int colStart,
int colEnd,
2846 bool skipDragged =
false);
2848 void EmitColumnSeparators(TableEmit& emit,
int colStart,
int colEnd);
2850 void EmitColumnBackgrounds(TableEmit& emit,
int colStart,
int colEnd);
2853 void UpdateTableFollowTail(TableState& state, int32_t viewportH, int32_t contentH);
2854 void ScrollTableSectionsToBottom(TableState& state);
2856 void EmitTableSectionSeparator();
2860 const TableEmit& emit,
int c)
const
2862 if (emit.dragActive)
2867 void MirrorTableScroll(TableState* state);
2870 void EmitTableHeaderCell(TableEmit& emit,
tachyon::ID tableID,
int c, int16_t gridCol,
2871 bool isStretchTrack,
int sectionMin,
int sectionMax,
2872 int effectiveSortCol, IconID sortIcon);
2874 void EmitTableHeaderSection(TableEmit& emit,
tachyon::ID tableID,
2875 int colStart,
int colEnd,
bool lastColIsStretch,
2876 int effectiveSortCol, IconID sortIcon);
2879 GridTrack ComputeSectionColumnTrack(
const TableEmit& emit,
int c,
int colEnd,
2880 bool isMiddle,
bool fitContent =
false)
const;
2887 void CloseTableBodySection(TableEmit& emit,
2888 tachyon::ID sectionBodyID,
bool emitVerticalScrollbar,
2889 bool suppressHorzScrollbar =
false);
2891 void EmitVirtualBodyRows(TableEmit& emit,
2892 int colStart,
int colEnd,
2893 int totalRowCount, int32_t actualRowHeight,
2894 int firstVisible,
int lastVisible,
2896 bool isLastSection);
2900 void EmitDraggedColumnOnTop(TableEmit& emit,
tachyon::ID tableID,
2901 int colStart,
int colEnd,
2902 int firstVisible,
int lastVisible,
2904 bool lastColIsStretch,
2905 int effectiveSortCol, IconID sortIcon);
2907 void EmitDirectCellText(
const VirtualTableColumn& column, TableEmit& emit,
2911 int colIdx,
int colStart, int16_t gridRow);
2912 void EmitDirectCellCustom(
const VirtualTableColumn& column, TableEmit& emit,
2916 std::function<
void()> emit_fn,
2917 int colIdx,
int colStart, int16_t gridRow);
2918 void EmitDirectCellTree(
const VirtualTableColumn& column, TableEmit& emit,
2923 int treeDepth,
bool* treeIsOpen, IconID treeIcon,
2924 uint32_t treeAncestorMask,
bool treeIsLastSibling,
2925 std::string* treeRenameBuffer,
bool treeRenameActive,
2927 int colIdx,
int colStart, int16_t gridRow);
2929 void EmitDirectRowBackdrop(
tachyon::ID rowID, int16_t gridRow,
2930 int colStart,
int colEnd,
2935 TableState* tableState,
2936 bool isLastSection);
2938 void EmitDirectRowSpacer(int16_t gridRow,
2939 int colStart,
int colEnd, int32_t height);
2949 bool IsTreeItemSelected(
tachyon::ID id,
int itemIndex)
const;
2953 bool TreeItemRenameCheck(
tachyon::ID bodyID, std::string* renameBuffer, StyleRef textStyle);
2955 struct TreeClickState { tachyon::ID lastClickID =
tachyon::ID::Invalid(); int64_t lastClickTimeNanos = 0; };
Registry of commands: named actions with an optional icon and an optional shortcut key,...
Definition gui_command_manager.h:58
void PopDisabled()
Definition gui_state_atomic_values.h:58
void PopSelected()
Definition gui_state_atomic_values.h:61
void PushIndeterminate()
Definition gui_state_atomic_values.h:66
void PopIndeterminate()
Definition gui_state_atomic_values.h:67
void PushDisabled()
Definition gui_state_atomic_values.h:57
void PushInvalid()
Definition gui_state_atomic_values.h:63
bool IsIndeterminate() const
Definition gui_state_atomic_values.h:71
void PopInvalid()
Definition gui_state_atomic_values.h:64
void PushSelected()
Definition gui_state_atomic_values.h:60
The frame's element tree.
Definition gui_element_storage.h:100
ID GetLastItemID() const
The element last added at the level being built, its children done: after a control with parts,...
Definition gui_element_storage.h:188
AddResult Add(Element &&element, LayoutOverride &&constraints={})
Adds element after the previous one at the current nesting level.
ElementStorageResult BeginChildren()
Begins adding children to the last added element; elements without BeginChildren are leaves.
ElementStorageResult EndChildren()
Closes the innermost BeginChildren. Fails outside construction or without one open.
Stage callbacks run in registration order (no priorities): if A must run before B,...
Definition gui_frame_pipeline.h:74
A container's scope: its End runs when the scope leaves (or at End()).
Definition gui_application.h:2175
Scope & operator=(const Scope &)=delete
Scope(Scope &&other) noexcept
Definition gui_application.h:2179
~Scope()
Definition gui_application.h:2183
void End()
Ends the container now instead of when the scope leaves.
Definition gui_application.h:2186
Scope(GUIApplication &app, bool open)
Made by the scope functions below.
Definition gui_application.h:2178
Scope(const Scope &)=delete
Scope & operator=(Scope &&)=delete
The application: owns the windows, the systems and the frame loop.
Definition gui_application.h:185
void SelectableText(const std::span< ContentRun > &runs, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID (the same every frame).
Definition gui_application.h:1918
tachyon::ElementRef RegisterElement(tachyon::Element &&element, std::string_view text, LayoutOverride &&constraints)
As above, with text registered as its text.
bool BeginTable(ID id, VirtualTableColumn(&columns)[N], TableState &state, StyleRef style, LayoutOverride &&constraints={})
As above, for a C array of columns.
Definition gui_application.h:1198
int MessageDialog(ID id, const MessageDialogDesc &desc, StyleRef style)
A modal question with verb buttons, centered.
void InjectFocus(ID windowID, bool focused)
Gives the window keyboard focus, or takes it away.
bool Field(bool &value, std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's toggle style.
Definition gui_application.h:1442
bool Switch(bool value, std::string_view text, std::function< void(bool)> onToggle, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:594
InputHandlerBroadcaster inputBroadcaster
Sends each platform input event to the input manager and the text system.
Definition gui_application.h:255
bool BeginTitleBar(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:767
void Documents(ID id, DocumentSet &set, LayoutOverride &&constraints={})
The document bar of set, under the title bar, and below it the active document's panels,...
bool BeginTabBar(ID id, int *selectedIndex, std::function< void(int, int)> onReorder, std::function< void(int)> onClose=nullptr, std::function< void(int, tachyon::int2)> onDragOut=nullptr, std::function< void(int, tachyon::int2)> dragVisualizer=nullptr, StyleRef style={}, LayoutOverride &&constraints={}, TabBarLayout *layout=nullptr, const TabBarOptions &options={})
Opens a tab bar of Tabs.
void EndInvalid()
Closes BeginInvalid.
Definition gui_application.h:1113
void DragLabel(std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's drag label style.
Definition gui_application.h:1876
void Field(std::vector< T > &items, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's collection style.
Definition gui_application.h:1693
bool BeginListView(int *selectedIndex, int itemCount, ItemDragDropConfig *dragDrop, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:1043
auto Horizontal(A &&... a)
Definition gui_application.h:2209
friend class GUIApplicationInternals
GUIApplicationInternals (gui_application_internal.h) re-exposes these to the library's own code and t...
Definition gui_application.h:2451
void Image(ID id, ImageIndex image, uint2 sourceSize, StyleRef style, LayoutOverride &&constraints={})
Aspect-preserving: sizes the element to the largest sourceSize-aspect rect that fits the constraints.
bool ColorField(ID id, tachyon::color4b &value, StyleRef style, LayoutOverride &&constraints={})
As above, for an 8-bit color.
void EndReorderableGroup()
Closes BeginReorderableGroup.
bool BeginInvalid()
Controls emitted in between show that their value isn't accepted: the theme's error border (–error) a...
Definition gui_application.h:1111
bool BeginGridView(int *selectedIndex, StyleRef style, MultiSelectState *multiSelect=nullptr, ItemDragDropConfig *dragDrop=nullptr, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:1128
void SetTooltip(std::string_view text, std::string_view shortcut)
As above, for the last control.
Definition gui_application.h:790
bool Slider(ID id, int &value, int minVal, int maxVal, LayoutOverride &&constraints={})
As above, in the theme's slider style.
Definition gui_application.h:1855
bool BeginTitleBar(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:765
auto ReorderableItem(A &&... a)
Definition gui_application.h:2226
bool BeginDockingContainer(ID id, DockingLayout *layout, LayoutOverride &&constraints={})
As above, in the theme's dock style.
Definition gui_application.h:1413
void Cell(std::string_view text)
Cells auto-advance to the next column.
bool BeginReorderableItem(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1014
bool Field(T &value, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID and the default config, updating continuously,...
Definition gui_application.h:1592
void Image(ImageIndex image, uint2 sourceSize, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's image style.
Definition gui_application.h:1941
bool Tab(ID id, const GUIContent &content, StyleRef style, LayoutOverride &&constraints={})
One tab of the tab bar; a click selects it. True when clicked.
void SetErrorTooltip(std::string_view message)
As above, for the last control.
Definition gui_application.h:800
bool CommandButton(CommandID command, StyleRef style, LayoutOverride &&constraints={})
Icon button for a command; the tooltip shows its name and shortcut, e.g. "Undo (Ctrl+Z)".
Result< void > Run()
Loops over the frame calls below until the app quits; an error when the GPU device was lost and could...
void EndIndeterminate()
Closes BeginIndeterminate.
Definition gui_application.h:548
void EndArea()
Closes BeginArea.
auto Table(A &&... a)
Definition gui_application.h:2217
bool BeginListView(ID id, int *selectedIndex, int itemCount, StyleRef style, LayoutOverride &&constraints={})
As above, without drag and drop.
Definition gui_application.h:1033
const std::string & GetThemePath() const
See GUIApplicationInitializeOptions.
Definition gui_application.h:388
bool Tab(const GUIContent &content, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:1401
bool BeginWindow(ID windowLayoutID, std::string_view title, StyleRef styleRef, LayoutOverride &&constraints, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
An OS window, made the first time its ID is seen; build its content while this returns true.
Definition gui_application.h:2094
bool Field(T &value, TextEditBehavior textEditBehavior, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID and the default config, in the theme's number style.
Definition gui_application.h:1588
void Label(ID id, std::string_view text, LayoutOverride &&constraints={})
As the first, in the theme's label style.
Definition gui_application.h:1891
bool TypedField(ID id, T &value, StyleRef style, LayoutOverride &&constraints={})
As above; style is the box's around the number and its type.
Definition gui_application.h:1618
virtual Result< void > Initialize(const InitializeOptions &options={})
Creates the backends not set before, the window manager, the text system and the subsystems,...
bool SliderField(int &value, int minVal, int maxVal, std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's slider field style.
Definition gui_application.h:1849
void SelectableText(const std::span< ContentRun > &runs, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's text style.
Definition gui_application.h:1921
bool GradientField(tachyon::Gradient &value, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1815
bool TypedField(T &value, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1634
void SetUIScale(float scale)
Extra UI zoom on top of the main window's display scale (1 follows the OS).
void SetTooltip(ID targetID, IconID icon, std::string_view text)
As above, with an icon before the text.
bool Checkbox(ID id, bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
Checks and unchecks value itself.
Definition gui_application.h:581
void AddBox(ID id, int2 size, StyleRef styleRef, std::string_view text)
As above, with text.
Definition gui_application.h:2274
bool BeginListView(ID id, int *selectedIndex, int itemCount, ItemDragDropConfig *dragDrop, StyleRef style, LayoutOverride &&constraints={})
Opens a list view of ListItems.
int MessageDialog(const MessageDialogDesc &desc, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's message box style.
Definition gui_application.h:667
auto ContextMenu(A &&... a)
Definition gui_application.h:2206
bool BeginToolbar(bool horizontal=true)
Toolbar scope: a wrap container that swaps theme.controls to the toolbar styles, so default-style wid...
void Field(ID id, std::vector< std::pair< std::string, V > > &items, StyleRef style, LayoutOverride &&constraints={})
A key-value list (std::string keys, V values): a Key / Value header with the types,...
Definition gui_application.h:1698
std::unique_ptr< LayoutEngine > layoutEngine
Lays out the elements each frame. Created by Initialize.
Definition gui_application.h:190
std::unique_ptr< TextAtlasManager > textAtlasManager
The glyph atlas. Created by Initialize.
Definition gui_application.h:194
bool Checkbox(ID id, bool value, std::string_view text, std::function< void(bool)> onToggle, StyleRef style, LayoutOverride &&constraints={})
A checkbox (a box, checked with a tick) and its label; a click calls onToggle with the new value.
bool BeginMenu(std::string_view text, StyleRef buttonStyle, StyleRef menuStyle, StyleRef itemStyle, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:634
StyleRef ReorderableGroupStyle(ReorderDirection direction, bool isWrapped) const
The theme's reorderable group style for a direction and wrapping.
Definition gui_application.h:1000
bool BeginTooltip(ID targetID)
A tooltip with any content on targetID: build it while this returns true.
void MenuFilter()
A filter field for a big menu, first in it: it takes the keyboard when the menu opens,...
bool BeginMenu(ID id, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's menu styles.
Definition gui_application.h:632
static void TransferPanel(tachyon::ID panelID, tachyon::DockNode *sourceNode, DockingLayout *sourceLayout, DockingLayout *targetLayout)
Moves a panel from sourceNode/sourceLayout to targetLayout, fixing up selectedTab.
void StatusText(std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1316
bool TypedField(ID id, T &value, LayoutOverride &&constraints={})
A number field with its type after the value, e.g. "0.5 f32".
Definition gui_application.h:1615
bool BeginVerticalWrap(ID id, LayoutOverride &&constraints={})
As above, in the theme's plain style.
Definition gui_application.h:923
void Field(std::unordered_map< std::string, V > &items, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's collection style.
Definition gui_application.h:1779
bool Field(ID id, T &value, StyleRef style, LayoutOverride &&constraints={})
As the first, updating continuously, with the default config.
Definition gui_application.h:1564
void EndGhostWindow()
Closes BeginGhostWindow or BeginCursorGhostWindow.
Definition gui_application.h:2036
TransitionManager transitionManager
In-progress visual state transitions, per element.
Definition gui_application.h:211
bool MenuItem(ID id, const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
Without a shortcut, in style.
Definition gui_application.h:712
void InjectMouseLeave(ID windowID)
The pointer left the window.
auto VerticalWrap(A &&... a)
Definition gui_application.h:2212
void EndReorderableItem()
Closes BeginReorderableItem.
void VirtualTreeView(std::vector< TreeViewRow > &rows, std::vector< int > &visibleIdx, TableState &state, StyleRef style={}, LayoutOverride &&constraints={}, std::string_view header={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1081
bool Dropdown(int &selected, std::initializer_list< std::string_view > options, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:655
void EmitFloatingDockWindows(const DocumentSet &documents)
With documents in several main windows: in each, after its Documents, the windows of the panels torn ...
void Text(ID id, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
Static text.
bool Toggle(ID id, bool &value, const GUIContent &content, StyleRef style, LayoutOverride &&constraints={})
Toggles value itself.
Definition gui_application.h:615
void EndVerticalWrap()
Closes BeginVerticalWrap.
void ScrollbarOverlay(ID containerID, int2 lastInnerSize=int2{0, 0}, ID vertScrollBarID=ID::Invalid(), ID horzScrollBarID=ID::Invalid(), bool emitVert=true, bool emitHorz=true)
Both bars plus a corner cap; each hides itself without overflow.
auto ReorderableGroup(A &&... a)
Definition gui_application.h:2225
tachyon::ID CreatePanel(std::unordered_map< tachyon::ID, tachyon::Panel > &panels, std::string title, tachyon::IconID icon, std::function< void()> onPanelGUI, std::string panelType={}, std::function< void()> onEnable={}, std::function< void()> onDisable={})
As above, with a new static ID, which it returns.
Definition gui_application.h:298
GUITheme theme
The loaded theme: the style refs, icons and metrics the controls use; theme.GetStyle finds a CSS clas...
Definition gui_application.h:263
bool UpdateFrame()
One frame, for a host with its own main loop:
void HorizontalScrollbar(ID containerID)
As above, with an ID derived from the container's.
Definition gui_application.h:954
MenuManager menuManager
The open menus and the menu bar's triggers.
Definition gui_application.h:216
bool Field(T &value, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID, updating continuously, in the theme's number style.
Definition gui_application.h:1585
auto ListView(A &&... a)
Definition gui_application.h:2219
void EndTabBar()
Closes BeginTabBar.
void EmitFloatingDockWindows()
Call from OnGUI after the main docking container. Empty windows are closed.
bool IsFileDragging() const
Whether files or text from another application are dragged over one of the app's windows.
Definition gui_application.h:1091
StyleManager styleManager
The registered styles; Px converts CSS pixels to pixels at the UI scale.
Definition gui_application.h:244
bool Breadcrumb(ID id, std::span< const std::string > segments, std::function< void(int)> onSelect, LayoutOverride &&constraints={})
As above, in the theme's breadcrumb style.
Definition gui_application.h:1288
bool BeginCursorGhostWindow(ID windowLayoutID, int2 cursorPos, StyleRef styleRef)
As above, with a style, sized to its content.
Definition gui_application.h:2012
void AddBox(int2 size, StyleRef styleRef, std::string_view text, std::source_location site=std::source_location::current())
A fixed-size box with text, with the call site as the ID.
Definition gui_application.h:2330
static void FocusCommandSearch(CommandSearchState &state)
Puts the keyboard in the search next frame; bind it to a command such as Ctrl+K.
Definition gui_application.h:1337
bool SliderField(ID id, float &value, float minVal, float maxVal, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's slider field style.
Definition gui_application.h:1830
void Label(ID id, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
A label for the control after it: a click focuses that control.
bool AutocompleteField(ID id, std::string &value, std::span< const std::string_view > suggestions, StyleRef style, LayoutOverride &&constraints={})
A text field that lists, under itself while it has the keyboard and holds text, the suggestions that ...
void EndGridView()
Closes BeginGridView.
bool DestructiveMenuItem(ID id, const GUIContent &content, std::function< void()> onClick, LayoutOverride &&constraints={})
Without a shortcut, in the theme's item style.
Definition gui_application.h:729
void Image(ImageIndex image, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's image style.
Definition gui_application.h:1931
void PersistShortcuts(std::string key, CommandManager &commands)
Keeps the shortcuts that aren't the ones their commands were registered with, matching commands by mo...
bool GridViewItem(ID id, const GUIContent &content, tachyon::ElementState extraState=tachyon::ElementState::None, std::string *renameBuffer=nullptr, StyleRef itemStyle={}, LayoutOverride &&constraints={})
renameBuffer (optional) enables in-place rename: F2, Ctrl+Shift+Click or a slow re-click opens an edi...
bool BeginTable(ID id, VirtualTableColumn(&columns)[N], TableState &state, LayoutOverride &&constraints={})
As above, for a C array of columns, in the theme's table style.
Definition gui_application.h:1203
static void RebuildTreeViewIndex(std::vector< TreeViewRow > &rows)
Recomputes skipCount / ancestorLineMask / isLastSibling from row depths.
auto DockingContainer(A &&... a)
Definition gui_application.h:2231
void EndWindow()
Closes BeginWindow; called whether or not it returned true.
Definition gui_application.h:2154
void CollectionHeader(std::string_view valueType)
A dictionary's header row: "Key string", "Value <type>".
GUIStateManager guiStateManager
Per-element interaction state (hover, focus, clicks) and the construction stacks (disabled,...
Definition gui_application.h:209
void PersistTable(std::string key, TableState &state, std::span< VirtualTableColumn > columns)
Keeps the table's column widths and order, matching columns by header.
bool Switch(bool &value, std::string_view text={}, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's switch style.
Definition gui_application.h:604
void Text(std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's text style.
Definition gui_application.h:1904
Result< void > RestoreUIState(std::string_view json)
Applies JSON text from SaveUIState.
bool BeginMenu(ID id, std::string_view text, StyleRef buttonStyle, StyleRef menuStyle, StyleRef itemStyle, LayoutOverride &&constraints={})
A menu: a trigger button (in a menu bar or on its own), or a submenu item inside another menu.
void TreeCell(std::string_view text, int depth, bool *isOpen, IconID icon=IconID::Invalid, uint32_t ancestorLineMask=0, bool isLastSibling=true, std::string *renameBuffer=nullptr, bool reserveExpander=true)
Tree-style first column: [indent][arrow or spacer][optional icon][text].
bool ColorField(tachyon::color4f &value, bool allowHDR, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1797
bool Button(const GUIContent &content, std::function< void()> onClick, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's button style.
Definition gui_application.h:565
auto CursorGhostWindow(A &&... a)
Definition gui_application.h:2203
bool BeginReorderableGroup(ReorderDirection direction, std::function< void(int fromIndex, int toIndex)> onReorder, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, not wrapped, with the call site as the ID.
Definition gui_application.h:994
void EndLabelGroup()
Closes BeginLabelGroup.
bool SliderField(ID id, int &value, int minVal, int maxVal, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
Integer variant: snaps to whole numbers.
static void WalkTreeViewVisibility(const std::vector< TreeViewRow > &rows, std::vector< int > &visibleIdx)
Writes the flat indices of visible rows (honoring isOpen) to visibleIdx.
CommandManager commandManager
Commands, their shortcuts and the undo history.
Definition gui_application.h:252
bool BeginLabelGroup(CssPx defaultWidth=120, CssPx minWidth=40, CssPx maxWidth=500, bool resizable=true, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:837
bool Breadcrumb(std::span< const std::string > segments, std::function< void(int)> onSelect, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1290
void VirtualTable(TableState &state, std::span< VirtualTableColumn > columns, int totalRowCount, CssPx rowHeight=0, StyleRef style={}, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1273
bool Field(ID id, T &value, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={})
As the first, updating continuously, in the theme's number style.
Definition gui_application.h:1567
void GetFrameTimingHistory(std::span< FrameTimingSample > out) const
Copies the ring chronologically (oldest first) into out.
void EndContextMenu()
Closes BeginContextMenu; called whether or not it returned true.
bool AutocompleteField(std::string &value, std::span< const std::string_view > suggestions, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1480
void AddBox(StyleRef styleRef, std::string_view text, std::source_location site=std::source_location::current())
A box with text, sized to its content, with the call site as the ID.
Definition gui_application.h:2324
bool Slider(ID id, int &value, int minVal, int maxVal, StyleRef style, LayoutOverride &&constraints={})
Groove + knob without value text; drag-only, integer-valued.
bool BeginReorderableGroup(ReorderDirection direction, std::function< void(int fromIndex, int toIndex)> onReorder, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, not wrapped, with the call site as the ID, in the theme's style for the direction.
Definition gui_application.h:997
void CreatePanel(std::unordered_map< tachyon::ID, tachyon::Panel > &panels, ID id, std::string title, tachyon::IconID icon, std::function< void()> onPanelGUI, std::string panelType={}, std::function< void()> onEnable={}, std::function< void()> onDisable={})
Adds a panel to panels (usually a DockingLayout's).
Document & CreateDocument(DocumentSet &set, std::string name, std::string extension, std::string kind, tachyon::IconID icon)
Adds a document at the end of set, with new static IDs and an empty layout, which the caller fills (C...
void SetWindowBackend(std::unique_ptr< IWindowBackend > backend)
The OS windows and their input; Initialize wraps it to add render-to-image windows.
Definition gui_application.h:438
bool DestructiveMenuItem(const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's item style.
Definition gui_application.h:725
float GetUIScale() const
The graphics backend Initialize uses; without one it creates a vulkan::VulkanGraphicsContext.
Definition gui_application.h:458
void InjectMouseMove(ID windowID, int2 pos, KeyModifier mods=KeyModifier::None)
Input for render-to-image windows (WindowFlags::RenderToImage), which get none from the OS.
bool Field(bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1438
void SetClipboard(std::unique_ptr< IClipboard > clipboardImpl)
Copy and paste for text fields.
Definition gui_application.h:441
bool BeginWindow(ID windowLayoutID, std::string_view title, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
As the full BeginWindow below, in the theme's window style.
Definition gui_application.h:2047
bool CommandSearch(CommandSearchState &state, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1333
void InvalidatePanel(ID panelId)
Invalidates a docked panel's cached content by panel id. Safe from event handlers.
bool Dropdown(int &selected, std::initializer_list< std::string_view > options, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:651
void RequestReloadTheme(std::string_view themePath, float fontScale)
Deferred to the start of the next frame; safe from event handlers.
bool BeginGhostWindow(ID windowLayoutID, int2 position, int2 size, StyleRef styleRef)
position is the top-left in screen space; for drag previews use BeginCursorGhostWindow.
Definition gui_application.h:1956
bool BeginLabelGroup(ID id, CssPx defaultWidth=120, CssPx minWidth=40, CssPx maxWidth=500, bool resizable=true)
Label group: Labels/DragLabels inside share one width, resizable by dragging any label's right edge.
bool BeginHorizontal(ID id, LayoutOverride &&constraints={})
As above, in the theme's plain style.
Definition gui_application.h:890
bool BeginTable(VirtualTableColumn *columns, size_t columnCount, TableState &state, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's table style.
Definition gui_application.h:1211
WindowRegistry windowRegistry
The elements of each window, filled as the windows are built.
Definition gui_application.h:249
void EmitDragHandle()
Non-interactive drag handle for use inside BeginReorderableItem; clicks reach the item.
void EndHorizontalWrap()
Closes BeginHorizontalWrap.
float GetGlobalFontScale() const
The graphics backend Initialize uses; without one it creates a vulkan::VulkanGraphicsContext.
Definition gui_application.h:453
bool CommandSearch(ID id, CommandSearchState &state, LayoutOverride &&constraints={})
As above, in the theme's command search style.
Definition gui_application.h:1331
bool Toggle(ID id, bool &value, const GUIContent &content, LayoutOverride &&constraints={})
As above, in the theme's toggle style.
Definition gui_application.h:617
bool SliderField(ID id, int &value, int minVal, int maxVal, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's slider field style.
Definition gui_application.h:1843
auto TabBar(A &&... a)
Definition gui_application.h:2221
bool Toggle(ID id, bool value, const GUIContent &content, std::function< void(bool)> onToggle, LayoutOverride &&constraints={})
As above, in the theme's toggle style.
Definition gui_application.h:609
auto Tooltip(A &&... a)
Definition gui_application.h:2207
bool MenuItem(const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:708
bool BeginMenuBar(ID id, StyleRef style, LayoutOverride &&constraints={})
Menu bar: place BeginMenu triggers inside.
void SetDrawCacheEnabled(bool enabled)
Enables the retained-render cache (on by default). When off, every scope rebuilds.
Definition gui_application.h:882
bool BeginTable(ID id, VirtualTableColumn *columns, size_t columnCount, TableState &state, StyleRef style, LayoutOverride &&constraints={})
Opens a table.
auto TitleBar(A &&... a)
Definition gui_application.h:2224
bool BeginButtonGroup(LayoutOverride &&constraints={})
Button / toggle group: Buttons / Field(bool) inside are restyled with .first-/.mid-/....
bool Field(std::string &value, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1460
bool BeginReorderableGroup(ID id, ReorderDirection direction, std::function< void(int fromIndex, int toIndex)> onReorder, LayoutOverride &&constraints={})
As above, not wrapped, in the theme's style for the direction.
Definition gui_application.h:982
bool BeginListView(ID id, int *selectedIndex, int itemCount, LayoutOverride &&constraints={})
As above, without drag and drop, in the theme's list style.
Definition gui_application.h:1035
bool Dropdown(int &selected, std::span< const std::string_view > options, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:645
bool Button(const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:563
bool CommandSearch(CommandSearchState &state, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's command search style.
Definition gui_application.h:1335
void InjectKey(ID windowID, KeyCode key, KeyAction action, KeyModifier mods=KeyModifier::None)
A key event; typed text goes through InjectText.
auto DockingFrame(A &&... a)
Definition gui_application.h:2232
void EndDisabled()
Closes BeginDisabled.
Definition gui_application.h:1107
std::chrono::steady_clock::time_point m_frameStart
Internal: when the current frame started (set by UpdateFrame).
Definition gui_application.h:269
int FindListItemIndex(tachyon::ID id) const
A list item's index by ID, for end-of-frame handlers; -1 if unknown.
bool Button(ID id, const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
Controls take (id, icon, text, ..., style, constraints), each part optional.
bool FloatPanel(DockingLayout &layout, ID panelID, int2 screenPos)
Moves a docked panel into its own window at a screen position, as tearing its tab off does; the windo...
bool Dropdown(ID id, int &selected, std::span< const std::string_view > options, LayoutOverride &&constraints={})
As above, in the theme's dropdown style.
Definition gui_application.h:643
void EndMenuBar()
Closes BeginMenuBar.
bool BeginTable(ID id, VirtualTableColumn *columns, size_t columnCount, TableState &state, LayoutOverride &&constraints={})
As above, in the theme's table style.
Definition gui_application.h:1193
float frameTime
The last frame's duration in seconds, including any vsync wait.
Definition gui_application.h:271
bool GridViewItem(const GUIContent &content, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1145
bool SearchField(std::string &value, IconID icon, TextEditBehavior textEditBehavior=TextEditBehavior::ContinuousUpdate, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's search style.
Definition gui_application.h:1469
void AddGhostIcon(IconID icon, std::source_location site=std::source_location::current())
An icon in the open ghost window, 28 x 28 CSS px.
Definition gui_application.h:2018
bool Field(ID id, std::string &value, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride &&constraints={})
A text field editing value; true when it changed.
bool ListItem(ID id, const GUIContent &content, LayoutOverride &&constraints={})
As above, in the theme's item style.
Definition gui_application.h:1056
void EmitFloatingToolbarWindows(std::vector< struct FloatingToolbarItem > &floatingItems, const struct FloatingToolbarOptions *options=nullptr)
One OS window per floating toolbar. Closed windows are erased and their IDs released.
ElementStorage elementStorage
This frame's element tree.
Definition gui_application.h:247
bool ColorField(tachyon::color4b &value, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's color field style.
Definition gui_application.h:1807
bool MenuItem(const GUIContent &content, std::function< void()> onClick=nullptr, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:704
void Banner(Severity severity, const GUIContent &message, std::span< const BannerAction > actions={}, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:686
bool Field(T &value, TextEditBehavior textEditBehavior, StyleRef style, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID.
Definition gui_application.h:1573
GraphicsContext * graphicsContext
the backend from SetGraphicsBackend
Definition gui_application.h:200
bool Field(ID id, bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
A bool as a Toggle labelled text.
bool SliderField(ID id, float &value, float minVal, float maxVal, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
A label, a slider track and a number field for value in [minVal, maxVal]; true when it changed.
void Label(ID id, std::string_view text, std::string_view caption, StyleRef style, LayoutOverride &&constraints={})
A label over a field taller than a row (a list): at the top, with a caption under it such as "3 items...
bool BeginDockingContainer(DockingLayout *layout, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1416
bool Field(std::string &value, TextEditBehavior textEditBehavior, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1456
tachyon::EventHandler MakeLabelHandler()
A label's handler: a click focuses the control the label belongs to.
bool Switch(ID id, bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
Switches value itself.
Definition gui_application.h:598
bool BeginMenuBar(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:743
void CloseDocument(DocumentSet &set, int index)
Closes set's document at index for good: its panels are disabled and destroyed, its torn-off panel wi...
tachyon::EventHandler MakeButtonHandler(std::function< void()> onClick)
A handler that calls onClick on click.
auto StatusBar(A &&... a)
Definition gui_application.h:2223
void VerticalScrollbar(ID scrollBarID, ID containerID)
A vertical scrollbar for containerID, called from inside it: it overlays the container's border box a...
bool BeginTab(ID id, const GUIContent &content, StyleRef style, StyleRef contentStyle, LayoutOverride &&constraints={})
A tab with more in it: its icon and text in contentStyle (the theme's when invalid),...
void StatusText(ID id, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
A text in the status bar.
bool SliderField(float &value, float minVal, float maxVal, std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1833
void EndTitleBar()
Closes BeginTitleBar, adding the window buttons in a custom-title-bar window.
WindowHitArea TitleBarHitTest(ID windowID, int2 screenPos) const
What the OS should do with a screen point of a window with a custom title bar.
void HorizontalScrollbar(ID scrollBarID, ID containerID)
As VerticalScrollbar, horizontal.
bool BeginHorizontalWrap(ID id, StyleRef style, LayoutOverride &&constraints={})
A horizontal container whose children wrap onto further lines.
bool Switch(ID id, bool value, std::string_view text, std::function< void(bool)> onToggle, StyleRef style, LayoutOverride &&constraints={})
An on/off switch (track and knob) with an optional label after it, e.g. "On".
bool GradientField(ID id, tachyon::Gradient &value, LayoutOverride &&constraints={})
As above, in the theme's gradient swatch style.
Definition gui_application.h:1813
bool BeginWindow(ID windowLayoutID, StyleRef styleRef, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
As the full BeginWindow below, without a title.
Definition gui_application.h:2072
DockDropResult FindDockDropTargetAtScreenPos(tachyon::int2 screenPos)
Hit-tests leaf content areas; falls back to tab bars with zone=Center.
bool ColorField(ID id, tachyon::color4f &value, bool allowHDR, StyleRef style, LayoutOverride &&constraints={})
A color swatch that opens a color picker; true when the color changed.
bool Dropdown(ID id, int &selected, std::span< const std::string_view > options, StyleRef style, LayoutOverride &&constraints={})
A dropdown: a field showing options[selected] that opens the list of options under itself.
ID TreeDropTargetRow() const
The tree row a drag is over (drives the drop indicator), or Invalid.
Definition gui_application.h:1087
auto ToggleGroup(A &&... a)
Definition gui_application.h:2216
void SetDisabledTooltip(std::string_view text, std::string_view reason)
As above, for the last control.
Definition gui_application.h:805
void Field(ID id, std::vector< T > &items, StyleRef style, LayoutOverride &&constraints={})
A reorderable list: each row a grip, its index, the field (numbers with their type) and a remove butt...
Definition gui_application.h:1643
bool Field(ID id, T &value, StyleRef style, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={})
As the first, updating continuously.
Definition gui_application.h:1561
void PersistValue(std::string key, bool &value)
Keeps an app value.
void RenderSettingsPanel(SettingsPanelState &state)
Renders into the current container; the caller provides the outer panel.
bool Field(T &value, StyleRef style, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID, updating continuously.
Definition gui_application.h:1576
bool Switch(bool value, std::string_view text, std::function< void(bool)> onToggle, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's switch style.
Definition gui_application.h:596
std::vector< SavedDocumentWindow > TakeSavedDocuments(std::string_view key)
The main windows of documents RestoreUIState read for key, in the order they were listed; empty when ...
auto GhostWindow(A &&... a)
Definition gui_application.h:2202
bool ColorField(tachyon::color4f &value, bool allowHDR=false, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's color field style.
Definition gui_application.h:1799
bool BeginWindow(ID windowLayoutID, std::string_view title, StyleRef styleRef, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
As the full BeginWindow below.
Definition gui_application.h:2053
bool BeginWindow(ID windowLayoutID, StyleRef styleRef, LayoutOverride &&constraints, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
As the full BeginWindow below, without a title.
Definition gui_application.h:2084
bool Switch(bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:602
bool Field(ID id, T &value, TextEditBehavior textEditBehavior, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={})
As above, in the theme's number style.
Definition gui_application.h:1552
void DismissToast(ToastID toast)
Takes a toast away, as its close button does.
auto Selected(A &&... a)
Definition gui_application.h:2229
bool Dropdown(ID id, int &selected, std::initializer_list< std::string_view > options, StyleRef style, LayoutOverride &&constraints={})
As above, in style.
Definition gui_application.h:653
bool BeginTitleBar(ID id, StyleRef style, LayoutOverride &&constraints={})
A menu bar the window is dragged by: what in it isn't a control is the caption (drag to move,...
bool BeginDockingContainer(DockingLayout *layout, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's dock style.
Definition gui_application.h:1419
const std::string & GetResourceRoot() const
See GUIApplicationInitializeOptions.
Definition gui_application.h:395
static constexpr int kFrameHistoryCount
~4s @ 60fps
Definition gui_application.h:277
bool BeginTabBar(int *selectedIndex, std::function< void(int, int)> onReorder, std::function< void(int)> onClose=nullptr, std::function< void(int, tachyon::int2)> onDragOut=nullptr, std::function< void(int, tachyon::int2)> dragVisualizer=nullptr, StyleRef style={}, LayoutOverride &&constraints={}, TabBarLayout *layout=nullptr, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1375
bool ListItem(ID id, const GUIContent &content, StyleRef style, LayoutOverride &&constraints={})
One item of a list view, drawn selected when it is the selected index. True when clicked.
void Field(ID id, std::vector< T > &items, LayoutOverride &&constraints={})
As above, in the theme's collection style.
Definition gui_application.h:1687
void SetTooltip(std::string_view text)
As above, on the control just drawn (its outer element, shown over all its parts).
Definition gui_application.h:782
virtual ~GUIApplication()=default
See GUIApplicationInitializeOptions.
bool BeginVerticalWrap(ID id, StyleRef style, LayoutOverride &&constraints={})
A vertical container whose children wrap onto further columns.
void CloseFloatingDockWindow(size_t index)
Closes the window for good: its panels are disabled and destroyed.
Result< void > RecordFrame()
See UpdateFrame.
void EndStatusBar()
Closes BeginStatusBar.
void Image(ID id, ImageIndex image, LayoutOverride &&constraints={})
As above, in the theme's image style.
Definition gui_application.h:1927
IWindowBackend * windowBackend
SetWindowBackend's windows plus render-to-image windows.
Definition gui_application.h:199
void SetTooltip(IconID icon, std::string_view text)
As above, with an icon, on the control just drawn.
Definition gui_application.h:784
bool Toggle(ID id, bool value, const GUIContent &content, std::function< void(bool)> onToggle, StyleRef style, LayoutOverride &&constraints={})
A button that shows pressed while value is on; a click calls onToggle with the new value.
bool BeginHorizontalWrap(ID id, LayoutOverride &&constraints={})
As above, in the theme's plain style.
Definition gui_application.h:901
bool BeginArea(ID id, LayoutOverride &&constraints={})
As above, in the theme's area style.
Definition gui_application.h:859
bool MenuItem(const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
Without a shortcut, with the call site as the ID, in style.
Definition gui_application.h:714
void SetTooltip(ID targetID, std::string_view text, std::string_view shortcut)
As above, with the keyboard shortcut that does the same in a chip after the text.
void SetAllocationHooks(const AllocationHooks &hooks)
Host memory functions for what can be routed: Vulkan objects, VMA, vk-bootstrap and SDL (only when th...
Definition gui_application.h:446
bool Field(ID id, std::string &value, StyleRef style, LayoutOverride &&constraints={})
As above, updating continuously.
Definition gui_application.h:1450
bool BeginStatusBar(ID id, LayoutOverride &&constraints={})
As above, in the theme's status bar style.
Definition gui_application.h:1304
void EndTooltip()
Closes BeginTooltip; called whether or not it returned true.
void Field(ID id, std::vector< std::pair< std::string, V > > &items, LayoutOverride &&constraints={})
As above, in the theme's collection style.
Definition gui_application.h:1722
auto Cached(A &&... a)
Definition gui_application.h:2208
bool Field(ID id, T &value, TextEditBehavior textEditBehavior, LayoutOverride &&constraints={})
As above, with the default config.
Definition gui_application.h:1555
bool BeginStatusBar(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1306
void Field(std::vector< std::pair< std::string, V > > &items, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's collection style.
Definition gui_application.h:1728
tachyon::ElementRef RegisterElement(tachyon::Element &&element, LayoutOverride &&constraints)
Adds an element, with its interaction state, to the current window; for custom elements.
void Cell(std::function< void()> emit)
Custom-content cell: emit runs inside the cell during EndTable, so its captures must live until then.
bool SearchField(std::string &value, IconID icon, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1467
bool BeginMenuBar(ID id, LayoutOverride &&constraints={})
As above, in the theme's menu bar style.
Definition gui_application.h:741
void RenderNodeView(NodeView &view)
Builds view (canvas, nodes, wires and overlays) in the current container.
bool BeginHorizontal(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:892
bool Checkbox(bool value, std::string_view text, std::function< void(bool)> onToggle, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:577
bool BeginReorderableGroup(ReorderDirection direction, bool isWrapped, std::function< void(int fromIndex, int toIndex)> onReorder, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:988
bool MenuItem(ID id, const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
Optional icon, label, optional shortcut. The icon column is reserved if any sibling has an icon.
void DragLabel(ID id, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
A label whose horizontal drag changes the value of the field after it; a click focuses that field and...
auto HorizontalWrap(A &&... a)
Definition gui_application.h:2211
void Field(std::vector< T > &items, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1690
bool Field(std::string &value, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1448
GradientManager gradientManager
GPU pages for the gradients styles use.
Definition gui_application.h:242
void SelectableText(ID id, const std::span< ContentRun > &runs, std::function< void(intptr_t contentId)> onLinkActivate, StyleRef style, LayoutOverride &&constraints={})
Read-only rich text with links, mouse selection and Ctrl+C.
bool CommandSearch(ID id, CommandSearchState &state, StyleRef style, LayoutOverride &&constraints={})
Finds and runs commandManager's commands: focused, it lists those whose description contains the quer...
bool BeginDockingContainer(ID id, DockingLayout *layout, StyleRef style, LayoutOverride &&constraints={})
Builds layout's docked panels (each one's onPanelGUI) in a container, enabling the visible panels fir...
void SetDisabledTooltip(ID targetID, std::string_view text, std::string_view reason)
A text tooltip that, while targetID is disabled, also says why, on a second, muted line.
void PersistValue(std::string key, float &value)
As above, for a float.
auto Invalid(A &&... a)
Definition gui_application.h:2228
bool BeginHorizontal(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's plain style.
Definition gui_application.h:894
void DragLabel(ID id, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's drag label style.
Definition gui_application.h:1872
bool BeginDisabled()
Controls emitted in between are disabled: drawn dimmed, and they take no input.
Definition gui_application.h:1105
void Toasts()
The toasts, in the current window's bottom-right corner over what's built before; call it last in the...
bool BeginArea(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's area style.
Definition gui_application.h:863
bool BeginTooltip()
As above, on the control just drawn.
Definition gui_application.h:811
int MessageDialog(const MessageDialogDesc &desc, StyleRef style, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:665
void ShowContentTooltip(ID id, const GUIContent &content)
The content's tooltip, if it has one, on the control id.
Definition gui_application.h:542
IDManager idManager
Element IDs: static ones (CreateStaticID), call-site ones (AllocateDynamicID) and parent scopes (Push...
Definition gui_application.h:206
bool Checkbox(bool value, std::string_view text, std::function< void(bool)> onToggle, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's checkbox style.
Definition gui_application.h:579
bool TypedField(T &value, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID and a style for the box.
Definition gui_application.h:1637
bool BeginHorizontal(ID id, StyleRef style, LayoutOverride &&constraints={})
Undecorated flex containers; the Wrap variants wrap onto further lines/columns.
void SelectableText(ID id, const std::span< ContentRun > &runs, StyleRef style, LayoutOverride &&constraints={})
As above, without link handling.
Definition gui_application.h:1912
bool OpenWindow(ID windowLayoutID, std::string_view title, StyleRef styleRef, LayoutOverride &&constraints, ElementFlags flags, int monitorIndex)
Internal: the body of BeginWindow; call BeginWindow.
Definition gui_application.h:2102
void EndDockingContainer()
Closes BeginDockingContainer.
void Field(ID id, std::unordered_map< std::string, V > &items, StyleRef style, LayoutOverride &&constraints={})
Key-value list over an unordered_map.
Definition gui_application.h:1733
bool DestructiveMenuItem(const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
Without a shortcut, with the call site as the ID, in style.
Definition gui_application.h:731
bool Field(ID id, bool &value, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's toggle style.
Definition gui_application.h:1440
bool BeginReorderableGroup(ID id, ReorderDirection direction, std::function< void(int fromIndex, int toIndex)> onReorder, StyleRef style, LayoutOverride &&constraints={})
As above, not wrapped.
Definition gui_application.h:979
bool Slider(int &value, int minVal, int maxVal, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1857
OnGuiFunc onGui
Runs a frame from inside the OS's modal resize loop, so windows repaint while resized.
Definition gui_application.h:259
bool BeginVertical(ID id, LayoutOverride &&constraints={})
As above, in the theme's plain style.
Definition gui_application.h:912
bool applicationQuit
Set to true to end Run (UpdateFrame then returns false).
Definition gui_application.h:267
void PersistValue(std::string key, std::string &value)
As above, for a string.
bool Field(ID id, T &value, LayoutOverride &&constraints={})
As above, updating continuously.
Definition gui_application.h:1558
tachyon::ElementRef MenuItemRow(ID id, tachyon::EventHandler handler, StyleRef rowStyle, bool reserveIcon, IconID icon, std::string_view text, std::string_view trailing, StyleRef trailingStyle, LayoutOverride &&constraints, bool destructive=false)
A menu row: an icon slot, the label and a trailing text (a shortcut or a submenu arrow).
void RestoreWindowPlace(ID windowID, const SavedDocumentWindow &saved)
Puts a window where saved was when it's next declared, as PersistWindow does (on its monitor,...
bool GridViewItem(const GUIContent &content, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
Without rename, with the call site as the ID, in style.
Definition gui_application.h:1151
void SetReducedMotion(std::optional< bool > reduced)
Reduced motion: changes of state show at once instead of blending.
bool BeginSelected()
Items emitted in between render as selected.
Definition gui_application.h:1101
void SetResourceRoot(std::string_view root)
The folder the resources load from: compiled shaders, default fonts and relative theme paths.
Definition gui_application.h:394
bool BeginStatusBar(ID id, StyleRef style, LayoutOverride &&constraints={})
A strip of short status texts, usually along a window's bottom edge.
ITextSystem * textSystem
Shapes, measures and edits text. Created by Initialize.
Definition gui_application.h:198
bool MenuItem(CommandID command)
Menu item for a command: icon, label, shortcut and callback come from the command.
void SetTooltip(ID targetID, IconID icon, std::string_view text, std::string_view shortcut)
As above, with an icon.
bool BeginTable(VirtualTableColumn(&columns)[N], TableState &state, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, for a C array of columns, with the call site as the ID, in the theme's table style.
Definition gui_application.h:1221
bool Toggle(bool value, const GUIContent &content, std::function< void(bool)> onToggle, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's toggle style.
Definition gui_application.h:613
bool BeginGridView(ID id, int *selectedIndex, StyleRef style, MultiSelectState *multiSelect=nullptr, ItemDragDropConfig *dragDrop=nullptr, LayoutOverride &&constraints={})
Opens a grid view of GridViewItems.
GUIRenderer * guiRenderer
The graphics backend's renderer.
Definition gui_application.h:202
bool Switch(ID id, bool value, std::string_view text, std::function< void(bool)> onToggle, LayoutOverride &&constraints={})
As above, in the theme's switch style.
Definition gui_application.h:592
ToastID ShowToast(ToastDesc desc)
Shows a toast in the corner of the window that builds Toasts.
bool Breadcrumb(ID id, std::span< const std::string > segments, std::function< void(int)> onSelect, StyleRef style, LayoutOverride &&constraints={})
A path such as Graphs > Terrain material: segments separated by chevrons, the last one current.
auto Row(A &&... a)
Definition gui_application.h:2218
void SetTooltip(ID targetID, const PropertyHelp &help)
A property's help on targetID, in a larger tooltip: its title, description and footer.
bool BeginArea(ID id, StyleRef style, LayoutOverride &&constraints={})
A container drawn in style, for grouping content; it scrolls when bounded and its style has overflow:...
bool BeginVerticalWrap(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's plain style.
Definition gui_application.h:927
void Field(std::unordered_map< std::string, V > &items, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1776
bool CommandButton(CommandID command, LayoutOverride &&constraints={})
As above, in the theme's button style.
Definition gui_application.h:570
void EndTab()
Closes BeginTab.
void SetErrorTooltip(ID targetID, std::string_view message)
Why a value isn't accepted, in a tooltip on the popup surface with an error border (and arrow).
void Label(std::string_view text, std::string_view caption, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's top label style.
Definition gui_application.h:1889
void EndMenu()
Closes BeginMenu; called whether or not it returned true.
bool TakeEscapeFor(ID popupWindowID, ID triggerID)
While building a popup's trigger: true, and the key taken, when Escape was pressed this frame with th...
float frameBuildTime
CPU work per frame, excluding the vsync stall in present.
Definition gui_application.h:273
auto Window(A &&... a)
Definition gui_application.h:2201
const Result< void > & ThemeReloadResult() const
How the last reload went; on an error the previous theme stays.
Definition gui_application.h:387
static constexpr std::string_view TypeTag()
A number's type as a short tag: f32, f64, i8 ... u64 (empty for other types).
Definition gui_application.h:1597
bool DestructiveMenuItem(ID id, const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
Without a shortcut, in style.
Definition gui_application.h:727
bool DestructiveMenuItem(ID id, const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, LayoutOverride &&constraints={})
As above, in the theme's item style.
Definition gui_application.h:721
auto Menu(A &&... a)
Definition gui_application.h:2204
bool BeginToggleGroup(LayoutOverride &&constraints={})
The same for Toggles and Field(bool).
void AddBox(ID id, StyleRef styleRef, IconID iconID, std::string_view text)
As above, sized to its content.
Definition gui_application.h:2308
void Label(std::string_view text, std::string_view caption, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1887
void Field(std::vector< std::pair< std::string, V > > &items, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1725
tachyon::EventHandler MakeToggleHandler(bool &toggle)
A handler that flips toggle on click.
void InjectText(ID windowID, std::string_view utf8)
Typed text, one character event per codepoint.
void OpenContextMenu(ID targetID, int2 screenPos)
Opens targetID's context menu at a screen point, e.g.
void Image(ImageIndex image, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1929
bool BeginArea(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:861
bool BeginGhostWindow(ID windowLayoutID, int2 position, StyleRef styleRef)
Sized to its content.
Definition gui_application.h:1977
bool BeginVertical(ID id, StyleRef style, LayoutOverride &&constraints={})
A vertical container.
bool SliderField(int &value, int minVal, int maxVal, std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1846
bool GridViewItem(ID id, const GUIContent &content, StyleRef style, LayoutOverride &&constraints={})
Without rename, in style.
Definition gui_application.h:1148
void CloseDockedPanel(DockingLayout &layout, DockNode &leaf, int tabIndex)
Closes the panel at tabIndex of a docked leaf, as the tab's Close action does.
bool Checkbox(bool &value, std::string_view text={}, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's checkbox style.
Definition gui_application.h:587
bool Dropdown(int &selected, std::span< const std::string_view > options, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's dropdown style.
Definition gui_application.h:647
bool IsReducedMotion() const
Whether changes of state show at once now.
Definition gui_application.h:467
auto Vertical(A &&... a)
Definition gui_application.h:2210
bool BeginTable(VirtualTableColumn *columns, size_t columnCount, TableState &state, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1207
bool SearchField(ID id, std::string &value, IconID icon, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride &&constraints={})
A Field with a leading icon inside its border; style is the border's.
Definition gui_application.h:1463
void Label(std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID, in the theme's label style.
Definition gui_application.h:1895
bool BeginReorderableGroup(ID id, ReorderDirection direction, bool isWrapped, std::function< void(int fromIndex, int toIndex)> onReorder, LayoutOverride &&constraints={})
As above, in the theme's style for the direction and wrapping.
Definition gui_application.h:985
bool ColorField(tachyon::color4b &value, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1805
bool Checkbox(bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:585
bool BeginGhostWindow(ID windowLayoutID, int2 position)
A ghost window: caption-less and transparent, e.g.
Definition gui_application.h:1950
bool SearchField(ID id, std::string &value, IconID icon, TextEditBehavior textEditBehavior=TextEditBehavior::ContinuousUpdate, LayoutOverride &&constraints={})
As above, in the theme's search style.
Definition gui_application.h:1465
void EndListView()
Closes BeginListView.
void Text(ID id, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's text style.
Definition gui_application.h:1900
bool Dropdown(ID id, int &selected, std::initializer_list< std::string_view > options, LayoutOverride &&constraints={})
With the options written in place: Dropdown(quality, { "Low", "Medium", "High" }).
Definition gui_application.h:649
bool BeginVertical(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's plain style.
Definition gui_application.h:916
bool BeginCursorGhostWindow(ID windowLayoutID, int2 cursorPos, int2 size, StyleRef styleRef)
As above, with a size and style.
Definition gui_application.h:2002
bool Checkbox(ID id, bool &value, std::string_view text={}, LayoutOverride &&constraints={})
As above, in the theme's checkbox style.
Definition gui_application.h:583
bool BeginWindow(ID windowLayoutID, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
As the full BeginWindow below, without a title, in the theme's window style.
Definition gui_application.h:2066
bool DestructiveMenuItem(const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:723
void Image(ID id, ImageIndex image, uint2 sourceSize, LayoutOverride &&constraints={})
As above, in the theme's image style.
Definition gui_application.h:1937
void InjectMouseScroll(ID windowID, int2 pos, float2 offset, KeyModifier mods=KeyModifier::None)
A wheel scroll by offset at pos.
bool BeginCached(ID id, uint64_t signature=0, LayoutOverride &&constraints={})
As above, in the theme's area style.
Definition gui_application.h:875
bool BeginCached(ID id, StyleRef style, uint64_t signature=0, LayoutOverride &&constraints={})
A container (like BeginArea) whose drawing is kept: while nothing changed it returns false,...
void MenuSeparator()
Divider inside a menu or context menu.
bool BeginWindow(ID windowLayoutID, std::string_view title, LayoutOverride &&constraints, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
As the full BeginWindow below, in the theme's window style.
Definition gui_application.h:2059
auto Area(A &&... a)
Definition gui_application.h:2213
bool BeginHorizontalWrap(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's plain style.
Definition gui_application.h:905
bool BeginGridView(ID id, int *selectedIndex=nullptr, MultiSelectState *multiSelect=nullptr, ItemDragDropConfig *dragDrop=nullptr, LayoutOverride &&constraints={})
As above, in the theme's grid style.
Definition gui_application.h:1126
std::unique_ptr< OSWindowManager > windowManager
The OS windows and their render contexts. Created by Initialize.
Definition gui_application.h:192
void Invalidate(ID id)
Rebuilds id's cached scope, and those around it, next frame. Safe from event handlers.
bool BeginGhostWindow(ID windowLayoutID, int2 position, int2 size)
As above, in the theme's ghost window style.
Definition gui_application.h:1971
bool AutocompleteField(ID id, std::string &value, std::span< const std::string_view > suggestions, LayoutOverride &&constraints={})
As above, in the theme's textbox style.
Definition gui_application.h:1478
bool Toggle(bool value, const GUIContent &content, std::function< void(bool)> onToggle, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:611
void SetTooltip(const PropertyHelp &help)
As above, for the last control.
Definition gui_application.h:795
void PersistValue(std::string key, int &value)
As above, for an int.
DockLeafResult FindDockLeafAtScreenPos(tachyon::int2 screenPos)
Dock leaf whose tab bar contains screenPos, plus its owning layout (needed by TransferPanel for cross...
bool BeginWindow(ID windowLayoutID, LayoutOverride &&constraints, ElementFlags flags=ElementFlags::WindowUserControlled|ElementFlags::WindowIsCentered, int monitorIndex=-1)
As the full BeginWindow below, without a title, in the theme's window style.
Definition gui_application.h:2078
void Banner(ID id, Severity severity, const GUIContent &message, std::span< const BannerAction > actions={}, LayoutOverride &&constraints={})
A banner across the top of a panel: the message (message.icon, else the severity's) on the severity's...
void PersistDocking(std::string key, DockingLayout &layout)
Keeps the layout's dock tree; panels are matched by type, else by title.
void Label(std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID.
Definition gui_application.h:1893
bool BeginCursorGhostWindow(ID windowLayoutID, int2 cursorPos, int2 size)
As above, with a size.
Definition gui_application.h:2007
tachyon::ElementRef RegisterControl(tachyon::Element &&element, LayoutOverride &&constraints)
As RegisterElement, for a control: it joins the Tab order and needs a valid ID.
void SetFileDropHandler(std::function< void(const FileDrop &)> handler)
Gets the drops no element took (none returned true to EventType::FileDrop): the application's own,...
Definition gui_application.h:1098
bool BeginReorderableItem(ID id, StyleRef style, LayoutOverride &&constraints={})
One draggable item of a reorderable group; any content goes inside.
GUIApplicationInitializeOptions InitializeOptions
See GUIApplicationInitializeOptions.
Definition gui_application.h:367
auto MenuBar(A &&... a)
Definition gui_application.h:2205
bool Tab(ID id, const GUIContent &content, LayoutOverride &&constraints={})
As above, in the theme's tab style.
Definition gui_application.h:1397
bool IsRenaming() const
Whether an inline rename editor (a grid item's, a tree row's) is open; an app that sorts by name re-s...
Definition gui_application.h:1156
bool Field(T &value, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID and the default config.
Definition gui_application.h:1579
bool MenuItem(ID id, const GUIContent &content, std::function< void()> onClick=nullptr, LayoutOverride &&constraints={})
As above, without a shortcut, in the theme's item style.
Definition gui_application.h:702
void EndButtonGroup()
Closes BeginButtonGroup.
ID FileDragTargetID() const
The element that takes that drag where it is now: the first from the one under the pointer up whose h...
Definition gui_application.h:1095
bool BeginListView(ID id, int *selectedIndex, int itemCount, ItemDragDropConfig *dragDrop, LayoutOverride &&constraints={})
As above, with drag and drop, in the theme's list style.
Definition gui_application.h:1039
void VirtualGridView(GridViewVirtualState &vstate, int itemCount, int2 cellSize, const std::function< void(int index, ID itemID)> &generateItem, int *selectedIndex=nullptr, MultiSelectState *multiSelect=nullptr, ItemDragDropConfig *dragDrop=nullptr, StyleRef scrollStyle={}, StyleRef rowStyle={}, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1172
void EndToggleGroup()
Closes BeginToggleGroup.
void PresentFrame()
See UpdateFrame.
bool BeginReorderableItem(ID id, LayoutOverride &&constraints={})
As above, in the theme's item style.
Definition gui_application.h:1012
virtual void OnGUI()=0
Builds the UI; called each frame.
void Text(std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1902
bool BeginTitleBar(ID id, LayoutOverride &&constraints={})
As above, in the theme's title bar style.
Definition gui_application.h:763
bool Field(T &value, TextEditBehavior textEditBehavior, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID, in the theme's number style.
Definition gui_application.h:1582
auto LabelGroup(A &&... a)
Definition gui_application.h:2214
bool BeginListView(int *selectedIndex, int itemCount, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, without drag and drop, with the call site as the ID, in style.
Definition gui_application.h:1045
bool BeginHorizontalWrap(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:903
std::string SaveUIState() const
The named state as JSON text.
void PersistDocuments(std::string key, std::function< std::vector< DocumentWindowRef >()> windows)
Keeps the documents of each main window that windows lists when the state is saved: their names,...
TabChainManager tabChainManager
The Tab-key focus order, rebuilt each frame.
Definition gui_application.h:213
void EndTable()
Builds the recorded rows as a VirtualTable.
int MessageDialog(ID id, const MessageDialogDesc &desc)
As above, in the theme's message box style.
Definition gui_application.h:663
bool ColorField(ID id, tachyon::color4b &value, LayoutOverride &&constraints={})
As above, in the theme's color field style.
Definition gui_application.h:1803
bool Slider(int &value, int minVal, int maxVal, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's slider style.
Definition gui_application.h:1859
bool Breadcrumb(std::span< const std::string > segments, std::function< void(int)> onSelect, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:1292
auto ButtonGroup(A &&... a)
Definition gui_application.h:2215
void Field(ID id, std::unordered_map< std::string, V > &items, LayoutOverride &&constraints={})
As above, in the theme's collection style.
Definition gui_application.h:1773
auto Disabled(A &&... a)
Definition gui_application.h:2227
void VirtualTable(ID id, TableState &state, std::span< VirtualTableColumn > columns, int totalRowCount, CssPx rowHeight=0, StyleRef style={}, LayoutOverride &&constraints={})
Virtual-scrolled table: emits only the visible rows, under one ranged ID.
void StatusText(std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's status text style.
Definition gui_application.h:1318
bool DestructiveMenuItem(ID id, const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
An item that destroys something (Delete, Discard), in the error color.
bool CloseRequested(ID windowID)
Whether the user asked to close a window flagged WindowConfirmClose (its close button,...
Result< void > InitializeStyles()
Loads the current theme at the current font scale; an error when it can't be opened.
TooltipManager tooltipManager
When a tooltip shows (delaySeconds) and for which element.
Definition gui_application.h:218
void PersistToolbars(std::string key, std::span< std::vector< ToolbarItem >, kToolbarSideCount > sides)
Keeps each side's toolbar items, by debugName.
bool MenuItem(const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
With a shortcut, the call site as the ID and style.
Definition gui_application.h:710
void PersistWindow(std::string key, ID windowID)
Keeps the window's position, size and mode.
bool BeginContextMenu(ID targetID)
Context menu: opens at the pointer on a right-click on the target element, or below it on Shift+F10 o...
bool AutocompleteField(std::string &value, std::span< const std::string_view > suggestions, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's textbox style.
Definition gui_application.h:1482
void CloseWindow()
Internal: the body of EndWindow for an open window; call EndWindow.
Definition gui_application.h:2239
bool SliderField(float &value, float minVal, float maxVal, std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's slider field style.
Definition gui_application.h:1836
void AddBox(ID id, int2 size, StyleRef styleRef, TextID textID=TextID::Invalid)
A plain box of a fixed size in pixels, in a style; textID is optional.
Definition gui_application.h:2253
void DragLabel(std::string_view text, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1874
virtual void OnStylesReloaded()
Called after every successful theme/font reload (and by subclasses at startup) to re-register styles/...
Definition gui_application.h:381
bool GradientField(tachyon::Gradient &value, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's gradient swatch style.
Definition gui_application.h:1817
void EndHorizontal()
Closes BeginHorizontal.
bool Button(ID id, const GUIContent &content, std::function< void()> onClick, LayoutOverride &&constraints={})
As above, in the theme's button style.
Definition gui_application.h:561
std::unique_ptr< IClipboard > clipboard
from SetClipboard
Definition gui_application.h:195
void SelectableText(ID id, const std::span< ContentRun > &runs, LayoutOverride &&constraints={})
As above, in the theme's text style.
Definition gui_application.h:1915
bool Field(ID id, std::string &value, TextEditBehavior textEditBehavior, LayoutOverride &&constraints={})
As the first, in the theme's text box style.
Definition gui_application.h:1454
auto GridView(A &&... a)
Definition gui_application.h:2220
void Label(ID id, std::string_view text, std::string_view caption, LayoutOverride &&constraints={})
As above, in the theme's top label style.
Definition gui_application.h:1885
bool IsThemeCrossfading() const
True while a theme switch is crossfading (the old look fading out over the new).
Definition gui_application.h:465
ToastDesc * FindToast(ToastID toast)
A shown toast's description, to change (its progress, its body); null once it's gone.
bool ListItem(const GUIContent &content, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1058
bool ColorField(ID id, tachyon::color4f &value, bool allowHDR=false, LayoutOverride &&constraints={})
As above, in the theme's color field style.
Definition gui_application.h:1795
void AddBox(ID id, int2 size, StyleRef styleRef, IconID iconID, std::string_view text)
As above, with an icon and text.
Definition gui_application.h:2291
bool GradientField(ID id, tachyon::Gradient &value, StyleRef style, LayoutOverride &&constraints={})
A gradient swatch that opens a gradient editor; true when the gradient changed.
bool BeginReorderableGroup(ReorderDirection direction, bool isWrapped, std::function< void(int fromIndex, int toIndex)> onReorder, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's style for the direction and wrapping.
Definition gui_application.h:991
bool ListItem(const GUIContent &content, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:1060
bool Toggle(bool &value, const GUIContent &content, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's toggle style.
Definition gui_application.h:621
bool Field(ID id, T &value, TextEditBehavior textEditBehavior, StyleRef style, NumericFieldConfig< ComponentT > config={}, LayoutOverride &&constraints={})
A number field; for a vector type (TypeDimensions), a field per component, each after a colored axis ...
Definition gui_application.h:1491
bool BeginReorderableGroup(ID id, ReorderDirection direction, bool isWrapped, std::function< void(int fromIndex, int toIndex)> onReorder, StyleRef style, LayoutOverride &&constraints={}, std::function< void(int, tachyon::int2)> onDragOut=nullptr, std::function< void(int, tachyon::int2)> dragVisualizer=nullptr)
A container of BeginReorderableItem scopes the user reorders by dragging.
void NodeText(std::string_view text)
Text property body aligned by the row's sockets: left => left, right => right, both => centre.
void EndSelected()
Closes BeginSelected.
Definition gui_application.h:1103
bool BeginIndeterminate()
Value fields emitted in between show a dash for mixed values (e.g.
Definition gui_application.h:546
int2 CursorGhostOffset() const
Where a ghost sits from the cursor, clear of the OS cursor: 14 px for a 32 px cursor,...
Definition gui_application.h:1991
void EndRow()
Ends the row.
bool MenuItemImpl(ID id, const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, StyleRef style, bool destructive, LayoutOverride &&constraints)
SearchField, also giving the ID of its text field (to focus it).
bool BeginListView(int *selectedIndex, int itemCount, ItemDragDropConfig *dragDrop, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1041
bool BeginReorderableItem(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's item style.
Definition gui_application.h:1016
bool RestoreDocumentLayout(Document &document, const SavedDocument &saved)
Lays a document's panels out as saved: panels by type, else title; ones the saved tree doesn't have g...
bool BeginListView(int *selectedIndex, int itemCount, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1037
bool BeginGridView(int *selectedIndex, MultiSelectState *multiSelect=nullptr, ItemDragDropConfig *dragDrop=nullptr, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's grid style.
Definition gui_application.h:1130
void EndCached()
Closes BeginCached; called whether or not it returned true.
bool Tab(const GUIContent &content, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1399
bool BeginMenuBar(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:745
bool BeginStatusBar(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in style.
Definition gui_application.h:1308
void DisableAllPanels(DockingLayout &layout)
Panel lifecycle.
Result< void > ReadWindowPixels(ID windowID, std::span< uint8_t > bgra)
The last rendered frame of a render-to-image window: BGRA8, tightly packed rows, bgra holding width x...
void SetGraphicsBackend(std::unique_ptr< GraphicsContext > backend)
The graphics backend Initialize uses; without one it creates a vulkan::VulkanGraphicsContext.
Definition gui_application.h:433
void Image(ID id, ImageIndex image, StyleRef style, LayoutOverride &&constraints={})
Draws image (from graphicsContext->RegisterImage) stretched over the element's box.
bool MenuItem(ID id, const GUIContent &content, std::string_view shortcut, std::function< void()> onClick, LayoutOverride &&constraints={})
With a shortcut; onClick is required so MenuItem(text, nullptr) stays unambiguous.
Definition gui_application.h:706
bool Field(T &value, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As the first, with the call site as the ID, updating continuously, with the default config.
Definition gui_application.h:1570
auto Toolbar(A &&... a)
Definition gui_application.h:2222
bool Field(ID id, std::string &value, LayoutOverride &&constraints={})
As the first, updating continuously, in the theme's text box style.
Definition gui_application.h:1458
bool Switch(ID id, bool &value, std::string_view text={}, LayoutOverride &&constraints={})
As above, in the theme's switch style.
Definition gui_application.h:600
void InjectMouseButton(ID windowID, int2 pos, MouseButtons button, bool down, KeyModifier mods=KeyModifier::None)
A button press (down) or release at pos.
void VerticalScrollbar(ID containerID)
As above, with an ID derived from the container's.
Definition gui_application.h:950
bool Toggle(bool &value, const GUIContent &content, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:619
bool BeginMenu(std::string_view text, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID, in the theme's menu styles.
Definition gui_application.h:636
void EndToolbar()
Closes BeginToolbar.
bool Field(std::string &value, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1452
void VirtualTreeView(ID id, std::vector< TreeViewRow > &rows, std::vector< int > &visibleIdx, TableState &state, StyleRef style={}, LayoutOverride &&constraints={}, std::string_view header={})
Single-column virtualized tree view (a VirtualTable with one TreeCell column).
virtual void Cleanup()
Releases what Initialize created, including the backends set before it.
bool BeginContextMenu()
As above, on the control just drawn.
Definition gui_application.h:821
void Image(ImageIndex image, uint2 sourceSize, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:1939
tachyon::ElementRef RegisterControl(tachyon::Element &&element, std::string_view text, LayoutOverride &&constraints)
As above, with text registered as its text.
bool DestructiveMenuItem(const GUIContent &content, std::function< void()> onClick, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
Without a shortcut, with the call site as the ID, in the theme's item style.
Definition gui_application.h:733
bool GridViewItem(ID id, const GUIContent &content, LayoutOverride &&constraints)
As above, without rename.
Definition gui_application.h:1142
tachyon::ElementRef RegisterControl(tachyon::Element &&element, std::function< TextID(tachyon::Element &element)> createTextID, LayoutOverride &&constraints)
As above; createTextID registers the text, given the element with its current state.
bool BeginCursorGhostWindow(ID windowLayoutID, int2 cursorPos)
A ghost window at the cursor, offset by CursorGhostOffset; 28 x 28 CSS px.
Definition gui_application.h:1997
bool BeginTable(VirtualTableColumn(&columns)[N], TableState &state, StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, for a C array of columns, with the call site as the ID.
Definition gui_application.h:1216
bool Checkbox(ID id, bool value, std::string_view text, std::function< void(bool)> onToggle, LayoutOverride &&constraints={})
As above, in the theme's checkbox style.
Definition gui_application.h:575
void MenuHeader(std::string_view text)
A section's name between items, e.g. "View", lined up with the labels.
void SetStyleFiles(std::span< const std::string_view > files)
The CSS rule files loaded after the palette, in order; relative paths are next to the palette file.
void EndVertical()
Closes BeginVertical.
void StatusText(ID id, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's status text style.
Definition gui_application.h:1314
auto Indeterminate(A &&... a)
Definition gui_application.h:2230
void VirtualGridView(ID id, GridViewVirtualState &vstate, int itemCount, int2 cellSize, const std::function< void(int index, ID itemID)> &generateItem, int *selectedIndex=nullptr, MultiSelectState *multiSelect=nullptr, ItemDragDropConfig *dragDrop=nullptr, StyleRef scrollStyle={}, StyleRef rowStyle={}, LayoutOverride &&constraints={})
generateItem(index, itemID) must emit exactly one cell, typically GridViewItem(itemID,...
bool BeginVerticalWrap(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:925
void SetTooltip(ID targetID, std::string_view text)
A text tooltip on targetID, shown when the pointer rests on it.
bool BeginRow()
Starts a row; its Cells fill the columns in order.
bool BeginVertical(StyleRef style, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:914
void AddBox(int2 size, StyleRef styleRef, TextID textID=TextID::Invalid, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:2268
std::unique_ptr< InputManager > inputManager
Routes input events to the elements; also holds global handlers. Created by Initialize.
Definition gui_application.h:188
Definition gui_renderer.h:43
Owns the per-frame state objects and runs their BeginFrame / EndFrame in order.
Definition gui_state_manager.h:65
ElementDataStore & GetElementDataStore()
Definition gui_state_manager.h:108
InteractionState & Interaction()
Definition gui_state_manager.h:87
ElementState GetCurrentState(ID id) const
The state of id (hovered, focused, disabled, ...) from Interaction, Construction and Labels.
void SetModified(bool v)
Whether transient state changed this frame.
Definition gui_state_manager.h:118
ConstructionScopes & Construction()
Definition gui_state_manager.h:93
LabelBinding & Labels()
Definition gui_state_manager.h:99
The library's styles, icons and theme metrics, the defaults the controls draw with.
Definition gui_theme.h:46
StyleRef emptyVertWrapStyleRef
vertical flex, wrap
Definition gui_theme.h:55
StyleRef imageStyleRef
default box for the Image() element
Definition gui_theme.h:82
StyleRef collectionAreaStyleRef
card-like well behind the list & dictionary Field() helpers
Definition gui_theme.h:318
StyleRef collectionRowStyleRef
list field: a row
Definition gui_theme.h:323
StyleRef tableStyleRef
Table: the table.
Definition gui_theme.h:225
StyleRef titleBarStyleRef
a window's own title bar (BeginTitleBar)
Definition gui_theme.h:344
StyleRef checkboxStyleRef
Checkbox: the control.
Definition gui_theme.h:166
StyleRef gradientSwatchStyleRef
GradientField: the swatch.
Definition gui_theme.h:194
StyleRef vectorComponentStyleRef
a vector component's field
Definition gui_theme.h:282
StyleRef staticTextStyleRef
plain non-interactive text
Definition gui_theme.h:81
StyleRef collectionIndexStyleRef
list field: a row's index
Definition gui_theme.h:324
StyleRef switchStyleRef
Switch: the control (track + label).
Definition gui_theme.h:117
StyleRef gridViewStyleRef
BeginGridView's default.
Definition gui_theme.h:400
StyleRef vertReorderableGroupStyleRef
Definition gui_theme.h:389
StyleRef typedFieldTypeStyleRef
TypedField: the type tag.
Definition gui_theme.h:321
StyleRef sliderFieldTrackStyleRef
SliderField: the track holding the parts below.
Definition gui_theme.h:107
StyleRef vertReorderableGroupWrapStyleRef
Definition gui_theme.h:391
StyleRef dockContainerStyleRef
a docking container
Definition gui_theme.h:482
StyleRef windowStyleRef
BeginWindow's default.
Definition gui_theme.h:307
StyleRef groupLabelTopStyleRef
Label with a caption: the container.
Definition gui_theme.h:334
StyleRef ghostIconStyleRef
the icon in a drag ghost
Definition gui_theme.h:79
StyleRef emptyHorzStyleRef
horizontal flex, no wrap; groups elements without drawing anything
Definition gui_theme.h:52
StyleRef collectionEntryStyleRef
dictionary: a row
Definition gui_theme.h:328
StyleRef menuStyleRef
a menu's window
Definition gui_theme.h:339
StyleRef emptyHorzWrapStyleRef
horizontal flex, wrap
Definition gui_theme.h:53
StyleRef collectionAddEntryStyleRef
dictionary: Add entry
Definition gui_theme.h:327
IconID tabCloseIcon
a tab's close button
Definition gui_theme.h:504
StyleRef collectionValueStyleRef
dictionary: a value
Definition gui_theme.h:329
StyleRef colorFieldStyleRef
ColorField: swatch, hex and alpha in a row.
Definition gui_theme.h:132
StyleRef listItemStyleRef
ListItem's default.
Definition gui_theme.h:394
StyleRef menuItemRowStyleRef
interactive row: icon slot + label + trailing shortcut/arrow
Definition gui_theme.h:354
StyleRef listViewStyleRef
BeginListView's default.
Definition gui_theme.h:393
const ControlStyles * controls
the bundle in use
Definition gui_theme.h:50
StyleRef collectionListStyleRef
list field: the rows
Definition gui_theme.h:322
StyleRef commandSearchStyleRef
Definition gui_theme.h:288
StyleRef statusBarStyleRef
BeginStatusBar's default.
Definition gui_theme.h:283
StyleRef typedFieldStyleRef
TypedField: the box.
Definition gui_theme.h:319
StyleRef menuBarStyleRef
horizontal strip at the top of the main window
Definition gui_theme.h:342
StyleRef tabStyleRef
the "+N" button after the tabs that fit
Definition gui_theme.h:430
StyleRef fieldElementGroupStyleRef
Built in code: an undecorated, growing, wrapping flex row (a multi-value drag field).
Definition gui_theme.h:57
StyleRef breadcrumbStyleRef
the breadcrumb path bar
Definition gui_theme.h:274
StyleRef ghostWindowStyleRef
BeginGhostWindow's default: the window following a drag.
Definition gui_theme.h:78
StyleRef collectionAddStyleRef
list field: Add item
Definition gui_theme.h:326
StyleRef horzReorderableGroupStyleRef
Definition gui_theme.h:388
StyleRef messageBoxStyleRef
MessageDialog: the window.
Definition gui_theme.h:150
StyleRef typedFieldInputStyleRef
TypedField: the value.
Definition gui_theme.h:320
tachyon::VisualColorStyleIndex nanTextColor
a number field's NaN
Definition gui_theme.h:540
StyleRef labelStyleRef
Label()'s default.
Definition gui_theme.h:83
StyleRef searchTextboxStyleRef
Definition gui_theme.h:416
StyleRef reorderableItemStyleRef
Definition gui_theme.h:387
StyleRef collectionRemoveStyleRef
list / dictionary: remove
Definition gui_theme.h:325
StyleRef emptyVertStyleRef
vertical flex, no wrap
Definition gui_theme.h:54
StyleRef sliderStyleRef
Slider: a groove and knob, no value text.
Definition gui_theme.h:113
StyleRef statusTextStyleRef
text in the status bar
Definition gui_theme.h:284
StyleRef axisLabelStyleRefs[4]
vector fields: the label of each component (X, Y, Z, W)
Definition gui_theme.h:278
StyleRef dragLabelStyleRef
DragLabel()'s default.
Definition gui_theme.h:86
StyleRef collectionStyleRef
BeginArea / BeginCached default.
Definition gui_theme.h:382
StyleRef horzReorderableGroupWrapStyleRef
Definition gui_theme.h:390
The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient,...
Definition gui_gradient_manager.h:64
A graphics backend: the device, the window contexts that render the GUI's windows,...
Definition gui_graphics_context.h:60
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
bool PopParent()
Pops the last PushParent. Never pops the root; false on underflow or outside a frame.
bool PushParent(ID parent_id)
Makes parent_id the parent: dynamic and ranged IDs created under it inherit its hash.
ID CreateStaticID()
A persistent ID tracked by slot and generation; release it with ReleaseStaticID.
Text and icon registration, measurement, rendering and editing.
Definition gui_text_system.h:178
virtual void SetTextColor(TextID textId, VisualColorStyleIndex color)=0
Draw a registered text in color instead of its style's text color, until it is registered again (call...
TextID RegisterEditableNumber(ID elementId, T &value, TextEditBehavior behavior, StyleRef styleIndex, ElementState state, bool &wasModified, NumericFieldConfig< T > config={})
Registers an editable number, clamped to config's [minVal, maxVal] after an edit.
Definition gui_text_system.h:285
virtual TextID RegisterText(ID elementId, IconID iconId, std::string_view text, StyleRef styleIndex, ElementState state)=0
Registers static text, with an optional icon, for elementId.
Makes and manages the OS windows and delivers their input; GUIApplication::SetWindowBackend sets one,...
Definition gui_window_backend.h:105
An image made by GraphicsContext::CreateImage; the backend defines its contents.
Definition gui_image.h:40
ID GetHoveredID() const
Definition gui_interaction_state.h:57
bool HasBeenClicked(ID id) const
Definition gui_interaction_state.h:84
ID GetHoveredDisabledID() const
The disabled element under the cursor when nothing is hovered: it takes no input, but shows its toolt...
Definition gui_interaction_state.h:60
void ClearPendingLabel()
Definition gui_label_binding.h:32
A value, or the Error saying why there is none.
Definition gui_result.h:36
Bakes serializable Styles into deduplicated runtime layout/visual styles; a StyleRef holds indices in...
Definition gui_style_manager.h:39
int32_t Px(int32_t cssPx) const noexcept
A size given in code (CSS px) at the UI scale: whole pixels, and a non-zero size stays at least 1.
Definition gui_style_manager.h:77
Tracks the next/prev tab targets around the focused element, rebuilt each frame during construction a...
Definition gui_tab_chain_manager.h:18
void BeginWindow(ID windowID)
Starts collecting windowID's tab targets until EndWindow; only the active window builds a chain.
Definition gui_tab_chain_manager.h:47
void EndWindow()
Ends the window begun by BeginWindow; its chain wraps around.
Definition gui_tab_chain_manager.h:84
Tracks in-progress visual state transitions per element ID.
Definition gui_transition_manager.h:43
bool IsReducedMotion() const
Definition gui_transition_manager.h:103
Per-window lists of ElementRefs in addition (render) order, driven during ElementStorage construction...
Definition gui_window_registry.h:33
RegistryResult BeginWindowScope(ID id, const ElementRef &ref)
Registers a window element just added to the ElementStorage and opens its scope: following Adds go to...
Definition gui_window_registry.h:149
RegistryResult Add(const ElementRef &ref)
Adds a non-window element to the innermost window scope's render list.
Definition gui_window_registry.h:178
RegistryResult EndWindowScope()
Closes the innermost window scope; NoActiveWindow when none is open.
Definition gui_window_registry.h:293
void VERIFY(ElementStorageResult result)
Checks the result of an element-storage call (e.g.
MessageIcon
The icon beside a MessageDialog's text.
Definition gui_application.h:104
EventHandler MakeNumericalBoxHandler(GUIStateManager &guiStateManager, T &value, NumericFieldConfig< T > config={})
Numeric field handler: a left click focuses it for typing, and LabelDrag* events from its label drag ...
Definition gui_default_handlers.h:207
MessageButtonKind
How a MessageButton is styled: Primary for the main choice, Danger for a destructive one.
Definition gui_application.h:106
EventHandler ReportingChanges(GUIStateManager &guiStateManager, T *value, EventHandler inner)
Wraps a handler that writes *value: it runs during input, after the control's call returned,...
Definition gui_default_handlers.h:191
EventHandler MakeMultiDimDragHandler(GUIStateManager &guiStateManager, T &value, NumericFieldConfig< typename TypeDimensions< T >::ComponentType > config={})
Applies LabelDrag* events to all components (multi-dimensional Field groups).
Definition gui_default_handlers.h:271
@ Quit
Definition gui_application.h:104
@ Question
Definition gui_application.h:104
@ Primary
Definition gui_application.h:106
@ Secondary
Definition gui_application.h:106
@ Danger
Definition gui_application.h:106
TabBarLayout
How a tab bar lays out tabs that don't fit on one row.
Definition gui_dock_node.h:56
constexpr int kToolbarSideCount
number of ToolbarSide values
Definition controls_toolbar_dock.h:33
ReorderDirection
Main axis of a reorderable group.
Definition gui_reorderable_subsystem.h:18
Severity
How serious a notification is: its icon and color.
Definition gui_notification_types.h:21
uint32_t ToastID
A toast shown by ShowToast; 0 is none.
Definition gui_notification_types.h:41
@ Vertical
Definition gui_reorderable_subsystem.h:18
@ Horizontal
Definition gui_reorderable_subsystem.h:18
void ReportMisuse(LogCategory category, const char *message)
API misuse (an unbalanced Begin/End, a call outside its frame, ...) is reported, not fatal: the calle...
@ Error
Definition gui_logging.h:28
ElementStorageResult
Outcome of an ElementStorage call.
Definition gui_element_storage.h:43
ElementFlags
What an element is and how it behaves, combined with |.
Definition gui_element_flags.h:18
@ DoNotMeasureText
Definition gui_element_flags.h:26
@ WindowNoCaption
Definition gui_element_flags.h:33
@ WindowIsCentered
Definition gui_element_flags.h:34
@ None
Definition gui_element_flags.h:19
@ WindowUserControlled
Definition gui_element_flags.h:32
@ PropagatesDescendantState
Hover/Focused when any descendant is.
Definition gui_element_flags.h:45
@ IsWindow
Definition gui_element_flags.h:28
@ WindowIsTransparent
Definition gui_element_flags.h:35
ImageIndex
Index of an image in the graphics context's image set, as the shaders sample it.
Definition gui_image.h:37
VisualColorStyleIndex
Index into StyleManager's color style pool; Invalid (0) draws nothing (transparent).
Definition gui_style.h:33
TextID
Handle for text registered with the text system (ITextSystem::RegisterText and friends).
Definition gui_style_text.h:13
IconID
Handle for an icon registered with ITextSystem::RegisterIconFromSVG / RegisterIconFromSVGFile.
Definition gui_style_text.h:15
VisualBoxStyleIndex
Index into StyleManager's visual box style pool; Invalid (0) = none.
Definition gui_style_ref.h:17
TextAlign
Alignment of text in its box (CSS: text-align, -tachyon-vertical-text-align).
Definition gui_style_text.h:68
ElementState
Interaction state bits of an element; they pick the Style::states variant it draws with.
Definition gui_style.h:42
@ Fixed
out of flow in overlay space; doesn't scroll with the parent
Definition gui_style.h:219
@ Invalid
Definition gui_style_text.h:13
@ Invalid
Definition gui_style_text.h:15
@ None
Definition gui_style.h:43
TextEditBehavior
Definition gui_text_system.h:99
@ None
Definition gui_text_system.h:100
@ ContinuousUpdate
update the text on every keystroke, not only on commit
Definition gui_text_system.h:101
std::function< void()> OnGuiFunc
Definition gui_base_types.h:14
RequestCloseResult
Outcome of an OSWindowManager close request; negative values are failures.
Definition gui_os_window_manager.h:41
WindowMode
A window's state (IWindowBackend::SetWindowMode). Any window can go fullscreen.
Definition gui_window_backend.h:60
RegistryResult
Outcome of a WindowRegistry call.
Definition gui_window_registry.h:18
WindowHitArea
What a point of a window with a custom title bar (WindowFlags::CustomTitleBar) is to the OS.
Definition gui_window_backend.h:52
AddWindowResult
Outcome of OSWindowManager::GetOrCreateWindow; negative values are failures.
Definition gui_os_window_manager.h:29
@ Closing
close requested (this frame) or already closed
Definition gui_os_window_manager.h:54
Definition gui_logging.h:24
Memory functions a host gives the library, for the allocations that can be routed: Vulkan objects,...
Definition gui_allocation_hooks.h:15
Handle to a registered command, stable for the manager's lifetime.
Definition gui_command_manager.h:32
State of a CommandSearch box; user-owned, keep it alive across frames.
Definition gui_widget_state_types.h:31
bool focusRequested
set by FocusCommandSearch, taken next frame
Definition gui_widget_state_types.h:37
StyleRef textbox
.textbox / .toolbar-textbox
Definition gui_theme.h:30
StyleRef menuTrigger
.menu-trigger / .toolbar-menu-trigger
Definition gui_theme.h:32
StyleRef toggle
.toggle / .toolbar-toggle
Definition gui_theme.h:29
StyleRef number
numeric fields: the textbox in the monospace font
Definition gui_theme.h:31
StyleRef button
.button / .toolbar-button
Definition gui_theme.h:28
A size in CSS px.
Definition gui_units.h:18
Result of FindDockDropTargetAtScreenPos: the drop target and its layout.
Definition gui_docking_types.h:152
Result of FindDockLeafAtScreenPos: the leaf and its layout, both null on a miss.
Definition gui_docking_types.h:146
Docking tree node: a leaf with panel tabs, or a split with two children where splitSize applies to th...
Definition gui_dock_node.h:64
A docking area: the split/tab tree and the panels its leaves refer to by ID.
Definition gui_docking_types.h:125
The documents one main window shows, in tab order, and which one is active.
Definition gui_docking_types.h:201
A document: a level, prefab, material graph, ... with its own panels.
Definition gui_docking_types.h:174
An element's slot in ElementStorage: its depth and index within that depth.
Definition gui_element.h:127
Definition gui_element.h:33
ElementState state
Definition gui_element.h:45
TextID textID
Definition gui_element.h:39
ElementFlags flags
Definition gui_element.h:44
ID id
Definition gui_element.h:34
StyleRef styleRef
Definition gui_element.h:42
A failure: its category and a human-readable message.
Definition gui_result.h:26
Files or text dropped from another application.
Definition gui_input_state.h:70
What GUIApplication::Initialize sets up besides the core systems.
Definition gui_application.h:147
bool closeMenusOnWindowMove
open menus close when a window moves or resizes
Definition gui_application.h:151
bool loadStyles
load the theme (InitializeStyles)
Definition gui_application.h:148
std::string_view fallbackFonts
The optional fallback fonts (Noto: other scripts, emoji, symbols), relative to the resource root,...
Definition gui_application.h:154
bool repaintWhileResizing
onGui = OnFrame, unless onGui is already set
Definition gui_application.h:150
bool commandShortcuts
route keys to commandManager's shortcuts
Definition gui_application.h:149
Rolling per-frame timing history in ms, recorded only while profiling is enabled.
Definition gui_application.h:276
float buildMs
Definition gui_application.h:276
float totalMs
Definition gui_application.h:276
Definition gui_application.h:2681
std::span< VirtualTableColumn > columns
Definition gui_application.h:2681
TableState * state
Definition gui_application.h:2681
Tree-view backing state, rebuilt per frame; not part of the API.
Definition gui_application.h:2368
std::vector< TreeViewRow > rows
Definition gui_application.h:2369
std::vector< int > visibleIdx
Definition gui_application.h:2370
TableState tableState
Definition gui_application.h:2371
A page: a stable ID, its name in the tree, and render, which builds its content.
Definition gui_application.h:2350
std::function< void()> render
Builds the page's content while it is selected.
Definition gui_application.h:2356
std::string name
Shown in the page tree.
Definition gui_application.h:2354
tachyon::ID id
Stable across frames.
Definition gui_application.h:2352
What RenderSettingsPanel shows: its pages, the selected one and the tree width.
Definition gui_application.h:2347
CssPx treeWidth
The page tree's width; its sizer changes it.
Definition gui_application.h:2364
tachyon::ID AddPage(tachyon::ID id, std::string_view name, std::function< void()> render)
id must be stable. The first page added is selected initially.
Definition gui_application.h:2375
std::vector< Page > pages
Added with AddPage.
Definition gui_application.h:2360
tachyon::ID selectedID
The page shown; a click in the tree changes it.
Definition gui_application.h:2362
What a control shows: a text, an icon or both, and an optional tooltip.
Definition gui_content.h:22
std::string_view tooltip
shown on hover when not empty
Definition gui_content.h:25
Up to kMaxStops color stops plus an angle and interpolation color space.
Definition gui_style_gradient.h:91
User-owned, persistent state of a virtualized GridView; keep it alive across frames.
Definition gui_tree_grid_types.h:90
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
Per-element overrides of style layout properties.
Definition gui_constraints.h:150
constexpr bool HasFixedWidth() const
Whether an explicit width / height is set; axis 0 = width, 1 = height.
Definition gui_constraints.h:194
LayoutOverride & PositionX(PositionConstraintAxis ax) &
Sets one axis's constraint, or only its PositionType.
Definition gui_constraints.h:292
PositionConstraintAxis x
Definition gui_constraints.h:153
LayoutOverride & NoShrink() &
Shorthands for FlexGrow(0) / FlexShrink(0).
Definition gui_constraints.h:323
LayoutOverride & KeepWithNext(bool v=true) &
Forces a line break after / before this element, or keeps it on the same line as the next one.
Definition gui_constraints.h:312
PositionConstraintAxis y
Position constraints; set with the position builders.
Definition gui_constraints.h:153
static LayoutOverride FixedWidth(CssPx w)
Definition gui_constraints.h:187
static LayoutOverride FixedSize(CssPx w, CssPx h)
Sizes in CSS px (scaled by the UI scale) or in Pixels (as they are); see gui_units....
Definition gui_constraints.h:184
LayoutOverride & Width(CssPx w) &
Size, min and max size, in CSS px (scaled by the UI scale) or Pixels (as they are).
Definition gui_constraints.h:232
LayoutOverride & MinWidth(CssPx w) &
Size, min and max size, in CSS px (scaled by the UI scale) or Pixels (as they are).
Definition gui_constraints.h:236
LayoutOverride & FlexGrow(int16_t v) &
Overrides the style's flex-grow / flex-shrink.
Definition gui_constraints.h:317
LayoutOverride & NoGrow() &
Shorthands for FlexGrow(0) / FlexShrink(0).
Definition gui_constraints.h:322
static LayoutOverride Auto()
No overrides: everything comes from the style.
Definition gui_constraints.h:182
LayoutOverride & Position(int2 p) &
Position builders, in pixels (near = left/top, far = right/bottom).
Definition gui_constraints.h:252
What a MessageDialog shows.
Definition gui_application.h:130
MessageIcon icon
beside the text
Definition gui_application.h:131
std::string_view title
a question: "Quit Test?"
Definition gui_application.h:132
bool * dontAskAgain
shows "Don't ask again" when set
Definition gui_application.h:138
int cancelButton
Esc and the close button; -1: the default one.
Definition gui_application.h:136
std::span< const MessageDialogItem > items
affected items, listed in a well
Definition gui_application.h:137
std::string_view message
one or two sentences on what happens
Definition gui_application.h:133
std::span< const MessageButton > buttons
MessageDialog returns an index into these.
Definition gui_application.h:134
std::string_view details
collapsible technical details (mono)
Definition gui_application.h:139
int defaultButton
focused at first; Enter
Definition gui_application.h:135
An affected item, listed in a well: a name, an optional color dot and note, and a checkbox when check...
Definition gui_application.h:121
std::string_view meta
e.g. "12 edits"
Definition gui_application.h:123
std::string_view name
e.g. a file name
Definition gui_application.h:122
color4f color
alpha 0: no dot
Definition gui_application.h:124
bool * checked
shows a checkbox bound to it when set
Definition gui_application.h:125
Selected item IDs of a multi-select view; user-owned, keep it alive across frames.
Definition gui_widget_state_types.h:22
All state of one node-view widget; no global state.
Definition gui_node_view_types.h:215
Drag speed and range of a numeric Field, specialized per value type.
Definition gui_numeric_field_config.h:19
static constexpr PositionConstraintAxis Relative()
In flow, shifted by near (or back by far when near is unset).
Definition gui_constraints.h:94
int16_t near
left/top inset, or anchor offset (pixels)
Definition gui_constraints.h:82
PositionType type
Definition gui_constraints.h:78
A property's help, shown in a larger tooltip (SetTooltip): its name, what it does,...
Definition gui_content.h:43
A main window of documents as SaveUIState kept it (TakeSavedDocuments).
Definition gui_docking_types.h:246
A document as SaveUIState kept it: which one it was, and how its panels were laid out.
Definition gui_docking_types.h:238
A registered style, as StyleManager::Register returns it: indices into the shared style pools,...
Definition gui_style_ref.h:25
User-owned, persistent state of one table: column widths, selection, sort, options.
Definition gui_table_types.h:145
What a toast says (ShowToast). Change it later through FindToast.
Definition gui_notification_types.h:30
static constexpr int dimensions
Definition gui_type_dimensions.h:15
static T & GetComponent(T &value, int)
Definition gui_type_dimensions.h:16
A VirtualTable column: the TableColumn plus cell generator, sort order and section.
Definition gui_table_types.h:90
Definition gui_base_types.h:384
Definition gui_base_types.h:395
Definition gui_base_types.h:121
Integer 2D vector.
Definition gui_base_types.h:19
int32_t x
Definition gui_base_types.h:20
int32_t y
Definition gui_base_types.h:20
Definition gui_base_types.h:75