9#include <unordered_map>
10#include <unordered_set>
14#include <source_location>
17#include <initializer_list>
145 std::span<const MessageDialogItem>
items;
250 std::unique_ptr<SliderFieldTrackSubsystem> m_sliderFieldTrack;
251 std::unique_ptr<MenuRectsSubsystem> m_menuRects;
252 std::unique_ptr<LabelGroupSubsystem> m_labelGroup;
253 std::unique_ptr<ButtonGroupSubsystem> m_buttonGroup;
254 std::unique_ptr<ColorPickerSubsystem> m_colorPickerSub;
255 std::unique_ptr<GradientEditorSubsystem> m_gradientEditorSub;
256 std::unique_ptr<RenameSubsystem> m_renameSub;
257 std::unique_ptr<ReorderableSubsystem> m_reorderable;
258 std::unique_ptr<DockTabDragSubsystem> m_dockTabDragSub;
259 ToolbarWindowDragSubsystem m_toolbarWindowDrag{};
260 std::unique_ptr<UICacheManager> m_uiCache;
314 std::function<
void()> onPanelGUI,
315 std::string panelType = {},
316 std::function<void()> onEnable = {},
317 std::function<void()> onDisable = {});
322 std::function<
void()> onPanelGUI,
323 std::string panelType = {},
324 std::function<void()> onEnable = {},
325 std::function<void()> onDisable = {})
328 CreatePanel(panels,
id, std::move(title), icon, std::move(onPanelGUI),
329 std::move(panelType), std::move(onEnable), std::move(onDisable));
330 panels[id].internal.ownsID =
true;
446 const std::optional<AccentColors>&
GetAccent()
const {
return m_accent; }
512 void SetGraphicsBackend(std::unique_ptr<GraphicsContext> backend) { m_graphicsBackend = std::move(backend); }
517 void SetWindowBackend(std::unique_ptr<IWindowBackend> backend) { m_osWindowBackend = std::move(backend); }
619 template <
class OnClick>
649 bool reserveIcon,
IconID icon, std::string_view text,
650 std::string_view trailing,
StyleRef trailingStyle,
651 LayoutOverride&& constraints,
bool destructive =
false,
bool lit =
false);
681 std::string_view unassigned =
"Unassigned",
LayoutOverride&& constraints = {});
683 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)); }
698 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)); }
700 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)); }
702 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)); }
706 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)); }
708 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)); }
715 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)); }
717 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)); }
719 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)); }
723 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)); }
725 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)); }
732 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)); }
740 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)); }
936 inline bool BeginMenu(
const GUIContent& content,
StyleRef buttonStyle,
StyleRef menuStyle,
StyleRef itemStyle,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return BeginMenu(
idManager.AllocateDynamicID(site), content, buttonStyle, menuStyle, itemStyle, std::move(constraints)); }
953 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)); }
959 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)); }
961 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)); }
963 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)); }
996 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
997 {
Banner(
idManager.AllocateDynamicID(site), severity, message, actions, std::move(constraints)); }
1019 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)); }
1023 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)); }
1032 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)); }
1095 void SetTooltip(
ID targetID, std::string_view text, std::string_view shortcut);
1150 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); }
1171 template<
typename E>
requires std::is_enum_v<E>
1174 return SegmentedImpl(
id,
int(selected), options, [&selected](
int index) { selected = E(index); }, std::move(constraints));
1177 template<
typename T>
requires (std::is_enum_v<T> || std::is_same_v<T, int>)
1179 std::source_location site = std::source_location::current())
1181 return Segmented(
idManager.AllocateDynamicID(site), selected, options, std::move(constraints));
1295 bool emitVert =
true,
1296 bool emitHorz =
true);
1310 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);
1313 {
return BeginReorderableGroup(
id, direction,
false, std::move(onReorder), style, std::move(constraints)); }
1376 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)); }
1378 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)); }
1403 const std::unordered_set<ID>& openRows,
1404 std::vector<int>& visibleIdx);
1410 std::vector<int>& visibleIdx,
TableState& state);
1422 std::vector<TreeViewRow>& rows,
1423 std::vector<int>& visibleIdx,
1427 std::string_view header = {});
1431 std::source_location site = std::source_location::current())
1432 {
VirtualTreeView(
idManager.AllocateDynamicID(site), rows, visibleIdx, state, style, std::move(constraints), header); }
1506 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)); }
1516 std::string* renameBuffer =
nullptr,
1534 bool IsRenaming()
const {
return m_renameSub && m_renameSub->isActive; }
1541 int itemCount,
int2 cellSize,
1542 const std::function<
void(
int index,
ID itemID)>& generateItem,
1543 int* selectedIndex =
nullptr,
1548 LayoutOverride&& constraints = {});
1551 const std::function<
void(
int index,
ID itemID)>& generateItem,
1554 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1555 {
VirtualGridView(
idManager.AllocateDynamicID(site), vstate, itemCount, cellSize, generateItem, selectedIndex, multiSelect, dragDrop, scrollStyle, rowStyle, std::move(constraints)); }
1578 {
return BeginTable(
id, columns, N, state, style, std::move(constraints)); }
1586 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1587 {
return BeginTable(
idManager.AllocateDynamicID(site), columns, columnCount, state, style, std::move(constraints)); }
1590 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1595 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1596 {
return BeginTable(
idManager.AllocateDynamicID(site), columns, N, state, style, std::move(constraints)); }
1600 LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
1615 void Cell(std::function<
void()> emit);
1633 uint32_t ancestorLineMask = 0,
1634 bool isLastSibling =
true,
1635 std::string* renameBuffer =
nullptr,
1636 bool reserveExpander =
true);
1638 inline void TreeCell(std::string_view text,
int depth,
bool* isOpen,
1640 uint32_t ancestorLineMask = 0,
1641 bool isLastSibling =
true,
1642 std::string* renameBuffer =
nullptr,
1643 bool reserveExpander =
true)
1644 {
TreeCell(text, depth,
TreeOpenRef{ .flag = isOpen }, icon, ancestorLineMask, isLastSibling, renameBuffer, reserveExpander); }
1655 std::span<VirtualTableColumn> columns,
1657 CssPx rowHeight = 0,
1663 std::source_location site = std::source_location::current())
1664 {
VirtualTable(
idManager.AllocateDynamicID(site), state, columns, totalRowCount, rowHeight, style, std::move(constraints)); }
1680 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)); }
1756 std::function<
void(
int,
int)> onReorder,
1757 std::function<
void(
int)> onClose =
nullptr,
1758 std::function<
void(
int,
tachyon::int2)> onDragOut =
nullptr,
1759 std::function<
void(
int,
tachyon::int2)> dragVisualizer =
nullptr,
1763 const TabBarOptions& options = {});
1766 std::function<
void(
int,
int)> onReorder,
1767 std::function<
void(
int)> onClose =
nullptr,
1768 std::function<
void(
int,
tachyon::int2)> onDragOut =
nullptr,
1769 std::function<
void(
int,
tachyon::int2)> dragVisualizer =
nullptr,
1772 std::source_location site = std::source_location::current())
1773 {
return BeginTabBar(
idManager.AllocateDynamicID(site), selectedIndex, std::move(onReorder), std::move(onClose), std::move(onDragOut), std::move(dragVisualizer), style, std::move(constraints), layout); }
1841 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)); }
1868 inline bool SearchField(
ID id, std::string& value,
const GUIContent& content,
TextEditBehavior textEditBehavior,
StyleRef style,
LayoutOverride&& constraints = {}) {
return SearchField(
id, value, content, textEditBehavior, style, std::move(constraints),
nullptr); }
1872 inline bool SearchField( std::string& value,
const GUIContent& content,
TextEditBehavior textEditBehavior,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return SearchField(
idManager.AllocateDynamicID(site), value, content, textEditBehavior, style, std::move(constraints)); }
1895 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1901 [
this](tachyon::Element& element) {
return textSystem->
RegisterText(element.id,
"\xe2\x80\x94", element.styleRef, element.state); },
1902 std::move(constraints));
1910 if (nodeRowFieldMinWidth > 0 && !constraints.
HasFixedWidth())
1912 bool modified =
false;
1915 [
this, &modified, &value, textEditBehavior, config](tachyon::Element& element) {
1917 if constexpr (std::is_floating_point_v<T>)
1918 if (std::isnan(value))
1922 std::move(constraints));
1929 bool modified =
false;
1931 constraints.
Width(0);
1941 for (
int i = 0; i < TypeDimensions<T>::dimensions; i++)
1946 .MinWidth(40)) || modified;
1956 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1959 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1962 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1965 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1968 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1971 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1974 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1977 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1978 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)); }
1980 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1983 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1986 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1989 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1992 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
1996 template<typename T, typename ComponentT = typename TypeDimensions<T>::ComponentType>
2001 template<
typename T>
2004 if constexpr (std::is_same_v<T, float>)
return "f32";
2005 else if constexpr (std::is_same_v<T, double>)
return "f64";
2006 else if constexpr (std::is_same_v<T, int8_t>)
return "i8";
2007 else if constexpr (std::is_same_v<T, int16_t>)
return "i16";
2008 else if constexpr (std::is_same_v<T, int32_t>)
return "i32";
2009 else if constexpr (std::is_same_v<T, int64_t>)
return "i64";
2010 else if constexpr (std::is_same_v<T, uint8_t>)
return "u8";
2011 else if constexpr (std::is_same_v<T, uint16_t>)
return "u16";
2012 else if constexpr (std::is_same_v<T, uint32_t>)
return "u32";
2013 else if constexpr (std::is_same_v<T, uint64_t>)
return "u64";
2014 else if constexpr (std::is_same_v<T, std::string>)
return "string";
2019 template<
typename T>
2022 template<
typename T>
2027 const ID boxID =
idManager.AllocateDynamicID(
"typed_field");
2028 const ID typeID =
idManager.AllocateDynamicID(
"typed_field_type");
2030 BeginFieldBox(boxID, style, std::move(constraints));
2038 template<
typename T>
2041 template<
typename T>
2047 template<
typename T>
2050 if (
BeginArea(
id, style, std::move(constraints)))
2054 auto onReorder = [&items](
int from,
int to)
2056 if (from < 0 || from >= (
int)items.size())
return;
2057 if (to < 0 || to >= (
int)items.size())
return;
2058 T moved = std::move(items[from]);
2059 items.erase(items.begin() + from);
2060 items.insert(items.begin() + to, std::move(moved));
2066 for (
int i = 0; i < (int)items.size(); i++)
2073 if constexpr (std::is_arithmetic_v<T>)
2076 Field(items[i], tachyon::LayoutOverride{}.FlexGrow(1));
2084 Button(
idManager.AllocateDynamicID(
"list_add"),
"+ Add item", [&items]() { items.push_back({}); },
2091 template<
typename T>
2094 template<
typename T>
2095 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)); }
2097 template<
typename T>
2098 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)); }
2102 template<
typename V>
2105 if (BeginArea(
id, style, std::move(constraints)))
2108 [[maybe_unused]]
const bool pushed = idManager.
PushParent(
id);
2109 CollectionHeader(TypeTag<V>());
2110 for (
int i = 0; i < (int)items.size(); i++)
2117 tachyon::LayoutOverride{}.FlexGrow(1).FlexBasis(
Pixels{ 0 }));
2118 Button(theme.
tabCloseIcon, [&items, i]() { items.erase(items.begin() + i); },
2122 Button(idManager.AllocateDynamicID(
"dictionary_add"),
"+ Add entry",
2124 if (pushed) (void)idManager.
PopParent();
2129 template<
typename V>
2132 template<
typename V>
2133 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)); }
2135 template<
typename V>
2136 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)); }
2140 template<
typename V>
2143 if (BeginArea(
id, style, std::move(constraints)))
2146 [[maybe_unused]]
const bool pushed = idManager.
PushParent(
id);
2147 CollectionHeader(TypeTag<V>());
2150 std::string renameFrom, renameTo;
2151 bool rename =
false;
2152 for (
auto& pair : items)
2155 std::string key = pair.first;
2158 renameFrom = pair.first;
2163 Button(theme.
tabCloseIcon, [&items, k = pair.first]() { items.erase(k); },
2167 if (rename && !items.contains(renameTo))
2169 auto node = items.extract(renameFrom);
2170 node.key() = renameTo;
2171 items.insert(std::move(node));
2173 Button(idManager.AllocateDynamicID(
"dictionary_add"),
"+ Add entry",
2175 if (pushed) (void)idManager.
PopParent();
2180 template<
typename V>
2183 template<
typename V>
2184 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)); }
2186 template<
typename V>
2187 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)); }
2226 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)); }
2234 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)); }
2279 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)); }
2282 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)); }
2292 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)); }
2295 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)); }
2300 template<
typename T>
requires std::is_arithmetic_v<T>
2303 template<
typename T>
requires std::is_arithmetic_v<T>
2304 inline bool Slider(
ID id, T& value, std::type_identity_t<T> minVal, std::type_identity_t<T> maxVal,
LayoutOverride&& constraints = {}) {
return Slider<T>(
id, value, minVal, maxVal, theme.
sliderStyleRef, std::move(constraints)); }
2306 template<
typename T>
requires std::is_arithmetic_v<T>
2307 inline bool Slider(T& value, std::type_identity_t<T> minVal, std::type_identity_t<T> maxVal,
StyleRef style,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Slider<T>(idManager.AllocateDynamicID(site), value, minVal, maxVal, style, std::move(constraints)); }
2309 template<
typename T>
requires std::is_arithmetic_v<T>
2310 inline bool Slider(T& value, std::type_identity_t<T> minVal, std::type_identity_t<T> maxVal,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return Slider<T>(idManager.AllocateDynamicID(site), value, minVal, maxVal, theme.
sliderStyleRef, std::move(constraints)); }
2314 template<
typename T>
requires std::is_arithmetic_v<T>
2317 if (maxVal < minVal) std::swap(minVal, maxVal);
2319 [[maybe_unused]]
const bool pushed = idManager.
PushParent(
id);
2320 bool changed = Slider<T>(idManager.AllocateDynamicID(
"range_slider"), value, minVal, maxVal,
2323 config.minVal = minVal;
2324 config.maxVal = maxVal;
2325 changed = Field<T>(idManager.AllocateDynamicID(
"range_value"), value, TextEditBehavior::ContinuousUpdate,
2326 theme.
controls->
number, config, LayoutOverride::FixedWidth(CssPx{ 56 }).NoGrow().NoShrink()) || changed;
2327 if (pushed) (void)idManager.
PopParent();
2333 template<
typename T>
requires std::is_arithmetic_v<T>
2334 inline bool RangeField(T& value, std::type_identity_t<T> minVal, std::type_identity_t<T> maxVal,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
return RangeField<T>(idManager.AllocateDynamicID(site), value, minVal, maxVal, std::move(constraints)); }
2349 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)); }
2351 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)); }
2362 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)); }
2364 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)); }
2368 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)); }
2370 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)); }
2377 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)); }
2379 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)); }
2384 std::function<
void(intptr_t contentId)> onLinkActivate,
2388 { SelectableText(
id, runs, {}, style, std::move(constraints)); }
2394 { SelectableText(idManager.AllocateDynamicID(site), runs, {}, style, std::move(constraints)); }
2396 inline void SelectableText(
const std::span<ContentRun>& runs,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current())
2397 { SelectableText(idManager.AllocateDynamicID(site), runs, {}, theme.
staticTextStyleRef, std::move(constraints)); }
2404 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)); }
2414 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)); }
2447 inline void Image(
ID id,
ImageIndex image,
uint2 sourceSize,
const ImageDisplay& display,
LayoutOverride&& constraints = {}) {
Image(
id, image, sourceSize,
UVRect{}, display, theme.
imageStyleRef, std::move(constraints)); }
2449 inline void Image(
ImageIndex image,
uint2 sourceSize,
const ImageDisplay& display,
LayoutOverride&& constraints = {}, std::source_location site = std::source_location::current()) {
Image(idManager.AllocateDynamicID(site), image, sourceSize,
UVRect{}, display, theme.
imageStyleRef, std::move(constraints)); }
2468 m_windowOpen.push_back(
false);
2475 return BeginWindow(windowLayoutID, styleRef, std::move(constraints), elementFlags);
2489 m_windowOpen.push_back(
false);
2494 return BeginWindow(windowLayoutID, styleRef, std::move(constraints), elementFlags);
2501 const int32_t o = m_cursorSize > 0 ? (m_cursorSize * 14 + 16) / 32 :
styleManager.
Px(14);
2502 return int2{ o, o };
2534 auto dragGhostIconID =
idManager.AllocateDynamicID(site);
2537 .id = dragGhostIconID,
2544 VERIFY(ghostIconRes.status);
2599 return BeginWindow(windowLayoutID,
"", styleRef, std::move(constraints), flags, monitorIndex);
2609 const bool open =
OpenWindow(windowLayoutID, title, styleRef, std::move(constraints), flags, monitorIndex);
2610 m_windowOpen.push_back(open);
2619 ReportMisuse(
"GUIApplication: BeginWindow with an invalid ID (not shown)");
2629 if (!m_restoredWindows.empty())
2630 ApplyRestoredWindow(windowLayoutID, constraints, flags);
2632 if (monitorIndex == -1)
2644 .id = windowLayoutID,
2646 .styleRef = styleRef,
2647 .monitorIndex = (int16_t)monitorIndex,
2652 std::move(constraints));
2653 VERIFY(addResult.status);
2661 m_windowIdScopeStack.push_back(pushed);
2662 activeWindowID = windowLayoutID;
2669 if (m_windowOpen.empty())
2671 ReportMisuse(
"GUIApplication: EndWindow without BeginWindow (ignored)");
2674 const bool open = m_windowOpen.back();
2675 m_windowOpen.pop_back();
2686 template<
void (GUIApplication::*EndFn)()>
2692 Scope(
Scope&& other) noexcept : m_app(std::exchange(other.m_app,
nullptr)), m_open(other.m_open) {}
2704 explicit operator bool()
const {
return m_open; }
2755 if (!m_windowIdScopeStack.empty() && m_windowIdScopeStack.back())
2757 if (!m_windowIdScopeStack.empty())
2758 m_windowIdScopeStack.pop_back();
2772 boxElement.
textID = textID;
2794 .styleRef = styleRef,
2811 .styleRef = styleRef,
2828 .styleRef = styleRef,
2837 void AddBox(
StyleRef styleRef, std::string_view text, std::source_location site = std::source_location::current())
2843 void AddBox(
int2 size,
StyleRef styleRef, std::string_view text, std::source_location site = std::source_location::current())
2893 std::function<
void()> render)
2899 std::function<
void()> render)
2901 pages.push_back({ id, std::string(name), std::move(render), icon });
2949 void PersistDocuments(std::string key, std::function<std::vector<DocumentWindowRef>()> windows);
2972 const std::function<std::optional<ID>(std::string_view key)>& makePanel = {});
2990 const std::function<std::optional<ID>(std::string_view key)>& makePanel = {});
3005 bool SegmentedImpl(
ID id,
int selected, std::span<const std::string_view> options,
3009 std::vector<ID> m_cacheRecordStack;
3012 bool m_keyboardPending =
false;
3013 bool m_tabPending =
false;
3014 uint64_t m_inputFlagsFrame = 0;
3015 void RefreshCachedInputFlags();
3018 void NoteSwatchClaim(
ID swatchID);
3024 std::string PendingLabelText()
const;
3026 std::string_view PendingLabelTextView()
const;
3028 struct ColorSwatchLook SwatchLook() const;
3034 std::vector<const ControlStyles*> controlStylesStack;
3038 ID contextMenuTargetID { ID::Invalid() };
3039 std::optional<int2> contextMenuScreenPos;
3040 bool m_contextMenuClaimed =
false;
3041 uint32_t m_contextMenuOpenings = 0;
3042 ID tabDragGhostWindowID{ ID::Invalid() };
3044 FrameTimingSample frameTimingHistory[kFrameHistoryCount] = {};
3045 int frameTimingHead = 0;
3048 ColumnDragState m_columnDrag{};
3049 TreeDropState m_treeDropState{};
3053 std::unordered_map<tachyon::ID, int> m_listItemIndexByID;
3055 RecentIDMap<int32_t> m_busyButtonWidths;
3062 RecentIDMap<TasksPopover> m_tasksPopovers;
3064 void TaskBar(ID
id,
const ProgressTask& task, StyleRef trackStyle, LayoutOverride&& constraints);
3066 void StepGlyph(ID
id, TaskState state);
3071 TreeViewState m_treeState{};
3072 GridViewState m_gridViewState;
3075 std::unordered_map<tachyon::ID, GridItemRenameInfo> m_gridItemRenameByID;
3079 std::optional<TableEmit> m_tableEmit;
3081 std::vector<std::optional<TableEmit>> m_outerTableEmits;
3083 int CurrentCellCol()
const
3085 const int c = m_tableEmit->currentCol;
3086 assert(c <
int(m_tableEmit->columnCount));
3090 TabBarState m_tabBarState;
3091 TabState m_tabState;
3094 void EnableVisiblePanels(DockingLayout& layout);
3098 DockingConstructionState m_dockingState;
3102 std::vector<DockingLayout*> m_dockingLayoutsThisFrame{};
3104 std::vector<Panel> m_closedPanels;
3107 struct CommandModeClaim {
CommandMode mode; uint64_t frame; };
3108 std::unordered_map<ID, CommandModeClaim> m_commandModeClaims;
3109 uint64_t m_commandModeFrame = 0;
3111 CommandMode m_claimedCommandMode = CommandMode::Default;
3114 std::vector<struct ToolbarDockState*> m_toolbarDocksThisFrame{};
3117 void SyncDockingScrollOffsets();
3120 void SyncToolbarDockRects();
3125 std::vector<std::unique_ptr<FloatingDockWindow>> m_floatingDockWindows;
3128 void EmitFloatingDockWindowsOf(
const DocumentSet* documents);
3132 std::vector<DocumentSet*> m_documentSetsThisFrame{};
3134 bool ActivateDocumentOf(
const DockingLayout* layout);
3140 ID
id = ID::Invalid();
3141 float shownAt = 0.0f;
3142 float leftAt = -1.0f;
3143 float shownFor = 0.0f;
3145 std::vector<ShownToast> m_toasts;
3147 float m_toastsTime = -1.0f;
3148 bool m_toastsExpanded =
false;
3150 struct StatusBarSeen { ID
id = ID::Invalid();
float builtAt = -1.0f; };
3151 std::unordered_map<ID, StatusBarSeen> m_statusBars;
3152 ID m_toastStackID = ID::Invalid();
3153 bool m_toastsBuilt =
false;
3155 DocumentDrag m_documentDrag;
3156 std::vector<IntRect> m_documentBarRects;
3157 std::optional<DocumentMove> m_documentMove;
3159 void ApplyDocumentMove();
3161 void SyncDocumentRects();
3166 void RegisterFrameHooks();
3167 void RegisterFrameBalanceChecks();
3171 bool OpenMenu(ID menuID,
const GUIContent& content, StyleRef buttonStyle, StyleRef menuStyle, StyleRef itemStyle, LayoutOverride&& constraints);
3175 enum class TooltipBox : uint8_t { Plain, Lines,
Help,
Error };
3176 bool OpenTooltip(ID targetID, TooltipBox box = TooltipBox::Plain);
3178 void ShowPinTooltip(
const NodeGraph& view, ID socketID, PropertyEndpoint pin,
bool isOutput);
3180 void CloseTooltip();
3184 ID
id = ID::Invalid();
3185 ID windowID = ID::Invalid();
3190 bool textOnly =
false;
3191 int16_t monitorIndex = -1;
3196 CutShortText FindCutShortText(int2 mousePos)
const;
3199 void ShowCutShortText();
3200 CutShortText m_cutShort{};
3202 mutable std::vector<ElementRef> m_cutShortWalk;
3204 GradientF m_gradientFieldGiven, m_gradientFieldEdited;
3205 bool OpenContextMenuWindow(ID targetID);
3206 bool OpenCached(ID
id, StyleRef style, uint64_t signature, LayoutOverride&& constraints);
3207 static void ReportInvalidControlID(ID
id);
3209 void RegisterTabStop(ID
id);
3211 bool SearchField(ID
id, std::string& value,
const GUIContent& content, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride&& constraints, ID* outFieldID);
3214 void BeginFieldBox(ID
id, StyleRef style, LayoutOverride&& constraints);
3219 void ApplyPendingStyleReload();
3221 bool BoxSidesField(ID
id, uint16_t*
const (&sides)[4],
const std::string_view (&captions)[4],
3222 const std::string_view (&names)[4], NumericFieldConfig<int32_t> config, LayoutOverride&& constraints);
3226 void UpdateMouseCursor(ID hoverID, ID hoverWindowID, int2 mousePosition);
3228 void OnRender(
float elapsedTimeSecs);
3231 void FireStateTransitions(
float elapsedTimeSecs);
3234 struct TransitionsSeen
3236 std::vector<ID> hover;
3237 std::vector<ID> focused;
3238 ID active = ID::Invalid();
3240 TransitionsSeen m_transitionsSeen;
3241 TransitionsSeen m_transitionsNow;
3243 void RenderBoxShadows(IntRect rectLayout, IntRect clipRectScreen,
const TransitionState& ts,
bool ring);
3245 void RenderShadowLayer(IntRect rectLayout, IntRect clipRectScreen,
const VisualShadow& s,
float radius);
3247 void RenderInvalidHalo(IntRect rectLayout, IntRect clipRectScreen,
const TransitionState& ts,
float grown);
3250 void RenderInvalidBorder(IntRect rectLayout, IntRect clipRectScreen,
const TransitionState& ts, IntRect snappedPx);
3254 IntRect OpaqueInterior(IntRect rectLayout,
const TransitionState& ts)
const;
3257 bool IsBoxBlank(
const Element& element,
const TransitionState& ts)
const;
3259 Result<void> RecoverDevice();
3262 std::string m_resourceRoot;
3263 std::unique_ptr<IWindowBackend> m_osWindowBackend;
3264 ImageWindowBackend* m_imageWindows {
nullptr };
3266 int2 InjectedScreenPos(ID windowID, int2 pos,
bool press =
false);
3267 void InjectedFocus(ID windowID,
bool press);
3268 AllocationHooks m_allocationHooks;
3269 std::unique_ptr<GraphicsContext> m_graphicsBackend;
3270 MouseButtons m_lastPhysicalButtons { MouseButtons::None };
3271 std::string ResourcePath(std::string_view path)
const;
3272 std::string m_themePath {
"themes/dark.css" };
3273 bool m_initialized =
false;
3274 bool m_inFrame =
false;
3275 Result<void> m_themeReload {};
3278 struct PersistedWindow { std::string key; ID target; };
3279 struct PersistedDock { std::string key; DockingLayout* target; };
3281 struct PersistedToolbars { std::string key; std::span<std::vector<ToolbarItem>,
kToolbarSideCount> target; };
3282 struct PersistedValue {
using Target = std::variant<bool*, int*, float*, std::string*>; std::string key; Target target; };
3283 struct PersistedDocuments { std::string key; std::function<std::vector<DocumentWindowRef>()> target; };
3284 struct PersistedShortcuts { std::string key; CommandManager* target; };
3285 struct PersistedPresets { std::string key; LayoutPresets* target; };
3286 struct RestoredWindow
3291 bool hasMonitor =
false;
3292 bool hasPosition =
false;
3293 bool rectDone =
false;
3295 std::vector<PersistedWindow> m_persistWindows;
3296 std::vector<PersistedDock> m_persistDocks;
3297 std::vector<PersistedTable> m_persistTables;
3298 std::vector<PersistedToolbars> m_persistToolbars;
3299 std::vector<PersistedValue> m_persistValues;
3300 std::vector<PersistedDocuments> m_persistDocuments;
3301 std::vector<PersistedShortcuts> m_persistShortcuts;
3302 std::vector<PersistedPresets> m_persistPresets;
3303 std::vector<std::string> m_persistThemeVariables;
3305 std::unordered_map<std::string, std::vector<SavedDocumentWindow>> m_savedDocuments;
3306 std::unordered_map<ID, RestoredWindow> m_restoredWindows;
3307 void ApplyRestoredWindow(ID windowID, LayoutOverride& constraints, ElementFlags& flags);
3309 void PlaceOnSavedMonitor(RestoredWindow& restored)
const;
3310 int32_t m_cursorSize = 0;
3313 std::vector<bool> m_windowOpen, m_menuOpen, m_tooltipOpen, m_cachedOpen;
3314 bool m_nextMenuIsDropdown =
false;
3317 std::vector<ConstructionScopes> m_tooltipScopes;
3320 std::vector<ConstructionScopes> m_menuScopes;
3322 std::string m_loadedThemePath;
3323 float m_loadedFontScale { 1.0f };
3324 std::optional<AccentColors> m_accent;
3325 std::optional<AccentColors> m_loadedAccent;
3327 std::map<std::string, ThemeVariableOverrides, std::less<>> m_themeVariables;
3331 void CurveTree(CurveViewRef view);
3332 void CurveRuler(CurveViewRef view);
3335 static std::string ThemePathKey(std::string_view themePath);
3337 double m_themeReloadAt = -1.0;
3339 static constexpr double kThemeSettleSecs = 0.4;
3340 std::vector<std::string> m_styleFiles {
"styles.css" };
3341 float m_globalFontScale { 1.0f };
3342 float m_uiScale { 1.0f };
3343 std::optional<bool> m_reducedMotion;
3348 struct ThemeCrossfade
3350 ID window = ID::Invalid();
3351 tachyon::Image* image =
nullptr;
3354 static constexpr float kThemeCrossfadeSecs = 0.2f;
3355 std::vector<ThemeCrossfade> m_crossfades;
3356 float m_crossfadeStart = 0.0f;
3359 void CaptureThemeCrossfade();
3361 void EndThemeCrossfade();
3362 float m_displayScale { 1.0f };
3363 FrameClock m_frameClock;
3364 bool m_themeReloadPending {
false };
3367 RedrawMode m_redrawMode = RedrawMode::WhenNeeded;
3368 RedrawRequests m_redrawRequests;
3369 bool m_moreFrames =
true;
3370 uint64_t m_seenEvents = 0;
3371 int64_t m_timerAt = INT64_MAX;
3372 float m_buildTimerAt = INFINITY;
3373 int64_t m_frameTickNanos = 0;
3374 bool m_paceFrames =
false;
3375 std::thread::id m_uiThread;
3376 VsyncLock m_vsyncLock;
3379 void PaceFrame(
float hz);
3382 float AnimationRefreshRate()
const;
3385 void ScheduleFrameAt(
float frameSecs) { m_buildTimerAt = std::min(m_buildTimerAt, frameSecs); }
3387 void NoteFrameNeeds(
float elapsedTimeSecs);
3393 void InvalidateCachedScopesForInput(ID overID);
3395 static std::vector<ID> CollectPropagatedAncestors(
const ElementStorage& storage, ID leafID);
3397 static void CollectPropagatedAncestors(
const ElementStorage& storage, ID leafID, std::vector<ID>& out);
3401 void NoteTargetAncestors(int2 mousePos);
3404 void NoteContextMenuOwner();
3406 ID TooltipHoverID()
const
3412 void InvalidateCachedScopesAbove(ID
id);
3415 void RebuildCachedScopesAbove(ID
id) { m_cacheRebuildRequests.push_back(
id); }
3416 std::vector<ID> m_cacheRebuildRequests;
3419 void NotePanelContentID(ID panelId, ID contentID) { m_panelContentIDs[panelId] = contentID; }
3422 void ReleaseOwnIDs();
3424 void ErasePanels(DockingLayout& layout);
3427 void ApplyClaimedCommandMode();
3430 void DispatchInput(ID overID);
3434 std::vector<ID> ActedOnIDs(ID overID)
const;
3436 void ReportChangedPanels(std::vector<ID> actedOn);
3439 TextAlign nodeRowTextAlign = TextAlign::Start;
3443 int32_t nodeRowFieldMinWidth = 0;
3445 bool BeginDockingFrame();
3446 void EndDockingFrame();
3448 ID activeWindowID { ID::Invalid() };
3449 std::vector<bool> m_windowIdScopeStack;
3452 void EmitNodeViewOverlays(NodeViewRef view, ID canvasID);
3455 struct TitleBarInfo { ID barID = ID::Invalid(); ID maximizeID = ID::Invalid(); std::vector<ID> captions; };
3456 RecentIDMap<TitleBarInfo> m_titleBars;
3457 std::vector<ID> m_titleBarStack;
3458 std::vector<ID> m_titleBarCaptions;
3459 std::unordered_set<ID> m_closeRequests;
3463 struct SuggestionRow {
IconID icon = IconID::Invalid; std::string_view text; std::string_view trailing; };
3464 static constexpr int kMaxSuggestions = 12;
3465 void SuggestionPopup(ID windowID, ID anchorID, std::span<const SuggestionRow> rows,
int current,
3466 bool reserveIcon, int32_t minWidth, std::function<
void(
int)> onPick);
3468 struct AutocompleteState
3470 ID listWindowID = ID::Invalid();
3472 bool dismissed =
false;
3473 bool picked =
false;
3476 RecentIDMap<AutocompleteState> m_autocomplete;
3479 struct RetiredWindow { ID
id = ID::Invalid(); uint32_t framesLeft = 0; };
3480 std::vector<RetiredWindow> m_retiredWindows;
3482 void PruneStaleControlState();
3486 struct PressOutsideWatch { ID inside[2]; std::function<void()> onPressOutside; };
3487 std::vector<PressOutsideWatch> m_pressOutsideWatches;
3488 void CloseOnPressOutside(ID inside, ID alsoInside, std::function<
void()> onPressOutside)
3489 { m_pressOutsideWatches.push_back({ { inside, alsoInside }, std::move(onPressOutside) }); }
3490 void RunPressOutsideWatches();
3495 void DispatchFileDrops(
const FrameInput& input);
3497 ID OfferFileDrop(EventType type, ID overID, int2 screenPos,
const FileDrop* drop);
3498 ID m_fileDragTargetID = ID::Invalid();
3499 ID m_drawnDropTargetID = ID::Invalid();
3500 std::vector<FileDrop> m_heldFileDrops;
3501 std::function<void(
const FileDrop&)> m_fileDropHandler;
3502 std::vector<TextStyle> m_mnemonicStyles;
3504 struct ScrimFade {
float amount = 0.0f;
bool wanted =
false;
VisualColorStyleIndex color = VisualColorStyleIndex::Invalid; };
3505 std::unordered_map<ID, ScrimFade> m_scrims;
3506 float m_scrimTime = -1.0f;
3507 void DrawScrims(
float now);
3509 struct PendingAfterDraw { uint32_t endIdx; ElementRef owner; };
3510 std::vector<PendingAfterDraw> m_pendingAfterDraws;
3512 void TitleBarCaption(ID
id) { m_titleBarCaptions.push_back(
id); }
3513 void DockFloatingWindow(FloatingDockWindow& fw);
3523 bool& cancelled, StyleRef style, LayoutOverride&& constraints);
3527 void EmitColumnSizers(TableEmit& emit,
int colStart,
int colEnd,
3528 bool skipDragged =
false);
3530 void EmitColumnSeparators(TableEmit& emit,
int colStart,
int colEnd);
3532 void EmitColumnBackgrounds(TableEmit& emit,
int colStart,
int colEnd);
3535 void UpdateTableFollowTail(TableState& state, int32_t viewportH, int32_t contentH);
3536 void ScrollTableSectionsToBottom(TableState& state);
3538 void EmitTableSectionSeparator();
3542 const TableEmit& emit,
int c)
const
3544 if (emit.dragActive)
3549 void MirrorTableScroll(TableState* state);
3552 void EmitTableHeaderCell(TableEmit& emit,
tachyon::ID tableID,
int c, int16_t gridCol,
3553 bool isStretchTrack,
int sectionMin,
int sectionMax,
3554 int effectiveSortCol, IconID sortIcon);
3556 void EmitTableHeaderSection(TableEmit& emit,
tachyon::ID tableID,
3557 int colStart,
int colEnd,
bool lastColIsStretch,
3558 int effectiveSortCol, IconID sortIcon);
3561 GridTrack ComputeSectionColumnTrack(
const TableEmit& emit,
int c,
int colEnd,
3562 bool isMiddle,
bool fitContent =
false)
const;
3569 void CloseTableBodySection(TableEmit& emit,
3570 tachyon::ID sectionBodyID,
bool emitVerticalScrollbar,
3571 bool suppressHorzScrollbar =
false);
3573 void EmitVirtualBodyRows(TableEmit& emit,
3574 int colStart,
int colEnd,
3575 int totalRowCount, int32_t actualRowHeight,
3576 int firstVisible,
int lastVisible,
3578 bool isLastSection);
3582 void EmitDraggedColumnOnTop(TableEmit& emit,
tachyon::ID tableID,
3583 int colStart,
int colEnd,
3584 int firstVisible,
int lastVisible,
3586 bool lastColIsStretch,
3587 int effectiveSortCol, IconID sortIcon);
3589 void EmitDirectCellText(
const VirtualTableColumn& column, TableEmit& emit,
3593 int colIdx,
int colStart, int16_t gridRow);
3594 void EmitDirectCellCustom(
const VirtualTableColumn& column, TableEmit& emit,
3598 std::function<
void()> emit_fn,
3599 int colIdx,
int colStart, int16_t gridRow);
3606 int treeDepth, TreeOpenRef treeIsOpen, IconID treeIcon,
3607 uint32_t treeAncestorMask,
bool treeIsLastSibling,
3608 std::string* treeRenameBuffer,
bool treeRenameActive,
3610 int colIdx,
int colStart, int16_t gridRow);
3612 void EmitDirectRowBackdrop(
tachyon::ID rowID, int16_t gridRow,
3613 int colStart,
int colEnd,
3618 TableState* tableState,
3619 bool isLastSection);
3621 void EmitDirectRowSpacer(int16_t gridRow,
3622 int colStart,
int colEnd, int32_t height);
3632 bool IsTreeItemSelected(
tachyon::ID id,
int itemIndex)
const;
3636 bool TreeItemRenameCheck(
tachyon::ID bodyID, std::string* renameBuffer, StyleRef textStyle);
3638 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:63
void PopShownState()
Definition gui_state_atomic_values.h:82
void PopSelected()
Definition gui_state_atomic_values.h:66
void PushIndeterminate()
Definition gui_state_atomic_values.h:71
void PushShownState(ElementState states)
Everything built until PopShownState looks as in states too (Hover, Active, Focused): a picture of a ...
Definition gui_state_atomic_values.h:77
void PopIndeterminate()
Definition gui_state_atomic_values.h:72
void PushDisabled()
Definition gui_state_atomic_values.h:62
void PushInvalid()
Definition gui_state_atomic_values.h:68
bool IsIndeterminate() const
Definition gui_state_atomic_values.h:93
void PopInvalid()
Definition gui_state_atomic_values.h:69
void PushSelected()
Definition gui_state_atomic_values.h:65
ID GetTakerID() const
The element whose handler took the drag under the pointer: the validated target or one of its ancesto...
Definition gui_drag_drop_state.h:116
The frame's element tree.
Definition gui_element_storage.h:96
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:193
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:2688
Scope & operator=(const Scope &)=delete
Scope(Scope &&other) noexcept
Definition gui_application.h:2692
~Scope()
Definition gui_application.h:2696
void End()
Ends the container now instead of when the scope leaves.
Definition gui_application.h:2699
Scope(GUIApplication &app, bool open)
Made by the scope functions below.
Definition gui_application.h:2691
Scope(const Scope &)=delete
Scope & operator=(Scope &&)=delete
The application: owns the windows, the systems and the frame loop.
Definition gui_application.h:209
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:2393
void Image(ID id, ImageIndex image, uint2 sourceSize, const UVRect &uv, LayoutOverride &&constraints={})
As above, in the theme's image style.
Definition gui_application.h:2432
bool BeginShownState(ElementState states)
The controls until EndShownState look hovered, pressed (Active) or focused as states say,...
Definition gui_application.h:1480
void Spinner(ID id, SpinnerSize size=SpinnerSize::Medium, LayoutOverride &&constraints={})
A ring with an arc going round it, a turn every 0.8 s, in the theme's track and accent colors: work u...
bool Slider(T &value, std::type_identity_t< T > minVal, std::type_identity_t< T > 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:2310
tachyon::ElementRef RegisterElement(tachyon::Element &&element, std::string_view text, LayoutOverride &&constraints)
As above, with text registered as its text.
bool BeginMenu(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 menu styles.
Definition gui_application.h:938
void TaskProgress(const ProgressTask &task, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:806
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:1576
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:1845
bool Plot(ID id, PlotViewRef view, LayoutOverride &&constraints={})
Series of values as lines, bars or areas over the x range (a histogram's channels),...
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:715
bool SearchField(std::string &value, const GUIContent &content, 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:1872
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:1076
void ClearThemeVariables()
Back to the theme's own values for all of them, for the theme loaded.
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:1476
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:2351
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:2098
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:1376
auto Horizontal(A &&... a)
Definition gui_application.h:2722
friend class GUIApplicationInternals
GUIApplicationInternals (gui_application_internal.h) re-exposes these to the library's own code and t...
Definition gui_application.h:3002
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:1474
bool SearchField(std::string &value, const GUIContent &content, 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:1874
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:1506
void SetTooltip(std::string_view text, std::string_view shortcut)
As above, for the last control.
Definition gui_application.h:1099
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:1074
void SetRedrawMode(RedrawMode mode)
How often Run draws a frame; RedrawMode::WhenNeeded by default, which sleeps while nothing changes.
Definition gui_application.h:586
auto ReorderableItem(A &&... a)
Definition gui_application.h:2739
bool BeginDockingContainer(ID id, DockingLayout *layout, LayoutOverride &&constraints={})
As above, in the theme's dock style.
Definition gui_application.h:1803
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:1347
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:1997
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:2416
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:1109
bool CommandButton(CommandID command, StyleRef style, LayoutOverride &&constraints={})
Icon button for a command; the tooltip shows its name, and its shortcut in a chip after it ("Undo" th...
Result< void > Run()
Loops over the frame calls below until the app quits; an error when the GPU device was lost and could...
virtual ~GUIApplication()
Cleans up when Cleanup wasn't called (an early return, a failed test), so the device,...
void EndIndeterminate()
Closes BeginIndeterminate.
Definition gui_application.h:663
void EndArea()
Closes BeginArea.
auto Table(A &&... a)
Definition gui_application.h:2730
bool BeginListView(ID id, int *selectedIndex, int itemCount, StyleRef style, LayoutOverride &&constraints={})
As above, without drag and drop.
Definition gui_application.h:1366
const std::string & GetThemePath() const
See GUIApplicationInitializeOptions.
Definition gui_application.h:437
void InjectPen(ID windowID, const PenState &pen)
The pen, before the pointer events it goes with; a default PenState is the mouse.
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:1791
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:2607
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:1993
void Label(ID id, std::string_view text, LayoutOverride &&constraints={})
As the first, in the theme's label style.
Definition gui_application.h:2366
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:2023
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:2294
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:2396
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:2251
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:2039
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:702
void AddBox(ID id, int2 size, StyleRef styleRef, std::string_view text)
As above, with text.
Definition gui_application.h:2787
bool BeginListView(ID id, int *selectedIndex, int itemCount, ItemDragDropConfig *dragDrop, StyleRef style, LayoutOverride &&constraints={})
Opens a list view of ListItems.
void ProgressBar(ID id, float value, bool failed, StyleRef style, LayoutOverride &&constraints={})
A bar value (0 to 1, clamped) of the way full; failed fills it in the error color,...
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:975
auto ContextMenu(A &&... a)
Definition gui_application.h:2719
void Image(ID id, ImageIndex image, const ImageDisplay &display, LayoutOverride &&constraints={})
As above, the whole image, in the theme's image style.
Definition gui_application.h:2440
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:2103
static void WalkTreeViewVisibility(const std::vector< TreeViewRow > &rows, const std::unordered_set< ID > &openRows, std::vector< int > &visibleIdx)
Writes the flat indices of the rows shown to visibleIdx: those under no closed branch,...
std::unique_ptr< LayoutEngine > layoutEngine
Lays out the elements each frame. Created by Initialize.
Definition gui_application.h:214
std::unique_ptr< TextAtlasManager > textAtlasManager
The glyph atlas. Created by Initialize.
Definition gui_application.h:218
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.
StyleRef ReorderableGroupStyle(ReorderDirection direction, bool isWrapped) const
The theme's reorderable group style for a direction and wrapping.
Definition gui_application.h:1333
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,...
void StatusProgress(const ProgressTask &task, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:820
static void TransferPanel(tachyon::ID panelID, tachyon::DockNode *sourceNode, DockingLayout *sourceLayout, DockingLayout *targetLayout)
Moves a panel from sourceNode/sourceLayout to targetLayout, fixing up selectedTab.
bool Plot(PlotViewRef view, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:908
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:1704
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:2020
bool BeginVerticalWrap(ID id, LayoutOverride &&constraints={})
As above, in the theme's plain style.
Definition gui_application.h:1256
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:2187
bool Field(ID id, T &value, StyleRef style, LayoutOverride &&constraints={})
As the first, updating continuously, with the default config.
Definition gui_application.h:1969
void EndGhostWindow()
Closes BeginGhostWindow or BeginCursorGhostWindow.
Definition gui_application.h:2549
TransitionManager transitionManager
In-progress visual state transitions, per element.
Definition gui_application.h:236
bool MenuItem(ID id, const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
Without a shortcut, in style.
Definition gui_application.h:1021
void InjectMouseLeave(ID windowID)
The pointer left the window.
auto VerticalWrap(A &&... a)
Definition gui_application.h:2725
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:1429
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:963
void EmitFloatingDockWindows(const DocumentSet &documents)
With documents in several main windows: in each, after its Documents, the windows of the panels torn ...
void ClaimCommandMode(ID owner, CommandMode mode)
For a control with shortcuts of its own (CommandManager::RegisterMode): while the focus is within own...
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:736
void EndVerticalWrap()
Closes BeginVerticalWrap.
WheelMode GetWheelMode() const
The graphics backend Initialize uses; without one it creates a vulkan::VulkanGraphicsContext.
Definition gui_application.h:553
void Image(ID id, ImageIndex image, const UVRect &uv, const ImageDisplay &display, StyleRef style, LayoutOverride &&constraints={})
The part uv of image shown as display says: tinted, its channels picked (one shown as grey,...
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:2738
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:321
GUITheme theme
The loaded theme: the style refs, icons and metrics the controls use; theme.GetStyle finds a CSS clas...
Definition gui_application.h:285
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:1287
MenuManager menuManager
The open menus and the menu bar's triggers.
Definition gui_application.h:241
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:1990
void CurveEditor(CurveViewRef view, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:894
auto ListView(A &&... a)
Definition gui_application.h:2732
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:1439
StyleManager styleManager
The registered styles; Px converts CSS pixels to pixels at the UI scale.
Definition gui_application.h:269
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:1676
bool BeginCursorGhostWindow(ID windowLayoutID, int2 cursorPos, StyleRef styleRef)
As above, with a style, sized to its content.
Definition gui_application.h:2520
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:2843
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:1725
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:2275
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 ...
std::string SaveDockLayout(const DockingLayout &layout) const
A layout's dock tree as text, panels by type, else title, as a LayoutPreset keeps it; empty when it h...
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:1038
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:2406
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:1581
bool BusyButton(ID id, const GUIContent &content, bool busy, std::string_view busyText, std::function< void()> onClick, LayoutOverride &&constraints={})
As above, in the theme's button style.
Definition gui_application.h:750
static void RebuildTreeViewIndex(std::vector< TreeViewRow > &rows)
Recomputes skipCount / ancestorLineMask / isLastSibling from row depths.
void SetAccent(std::optional< AccentColors > accent)
Replaces the palette's accent with accent (its dark color in a dark palette, its light one in a light...
auto DockingContainer(A &&... a)
Definition gui_application.h:2744
void EndWindow()
Closes BeginWindow; called whether or not it returned true.
Definition gui_application.h:2667
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:234
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:725
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:2379
Result< void > RestoreUIState(std::string_view json)
Applies JSON text from SaveUIState.
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)
As above, the open state a bool of yours; null for leaves.
Definition gui_application.h:1638
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:2226
bool Segmented(T &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.
Definition gui_application.h:1178
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:685
auto CursorGhostWindow(A &&... a)
Definition gui_application.h:2716
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:1327
void DocumentBar(ID id, DocumentSet &set, LayoutOverride &&constraints=LayoutOverride::Auto())
As above, in the theme's document bar style.
Definition gui_application.h:1826
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.
CommandManager commandManager
Commands, their shortcuts and the undo history.
Definition gui_application.h:277
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:1150
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:1678
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:1661
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:1972
void GetFrameTimingHistory(std::span< FrameTimingSample > out) const
Copies the ring chronologically (oldest first) into out.
bool GradientField(ID id, tachyon::GradientF &value, StyleRef style, LayoutOverride &&constraints={})
As above, for a GradientF: up to GradientF::kMaxStops stops, colors over 1 (HDR), and each stop's int...
void EndContextMenu()
Closes BeginContextMenu; called whether or not it returned true.
void EndShownState()
Closes BeginShownState.
Definition gui_application.h:1482
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:1885
bool Timeline(ID id, TimelineState &state, const TimelineOptions &options, LayoutOverride &&constraints={})
Playback on one row: go to the start, step back a frame, play or pause, step on a frame,...
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:2837
void ClosePanel(DockingLayout &layout, ID panelID)
Closes a panel of layout for good, wherever it is: out of its tree (its leaf closing up when it empti...
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:1330
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:517
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:1034
float GetUIScale() const
The graphics backend Initialize uses; without one it creates a vulkan::VulkanGraphicsContext.
Definition gui_application.h:537
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:1841
void SetClipboard(std::unique_ptr< IClipboard > clipboardImpl)
Copy and paste for text fields, and of images.
Definition gui_application.h:520
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:2560
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:1721
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:959
void RequestReloadTheme(std::string_view themePath, float fontScale)
Deferred to the start of the next frame; safe from event handlers.
static void WalkTreeViewVisibility(const std::vector< TreeViewRow > &rows, std::vector< int > &visibleIdx, TableState &state)
As above, for a tree drawn by a table with state, open as its openRows says: when rows were opened or...
void CurveEditor(ID id, CurveViewRef view, LayoutOverride &&constraints={})
The curve editor a CurveField opens, as a control of its own: the channels and the selected key's tim...
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:2464
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:1223
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:1589
WindowRegistry windowRegistry
The elements of each window, filled as the windows are built.
Definition gui_application.h:274
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:532
bool CommandSearch(ID id, CommandSearchState &state, LayoutOverride &&constraints={})
As above, in the theme's command search style.
Definition gui_application.h:1719
bool Toggle(ID id, bool &value, const GUIContent &content, LayoutOverride &&constraints={})
As above, in the theme's toggle style.
Definition gui_application.h:738
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:2288
auto TabBar(A &&... a)
Definition gui_application.h:2734
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:730
auto Tooltip(A &&... a)
Definition gui_application.h:2720
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:1017
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:1215
bool BeginTable(ID id, VirtualTableColumn *columns, size_t columnCount, TableState &state, StyleRef style, LayoutOverride &&constraints={})
Opens a table.
bool Slider(ID id, T &value, std::type_identity_t< T > minVal, std::type_identity_t< T > maxVal, LayoutOverride &&constraints={})
As above, in the theme's slider style.
Definition gui_application.h:2304
auto TitleBar(A &&... a)
Definition gui_application.h:2737
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:1863
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:1315
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:1368
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:953
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:683
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:1723
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:2745
bool GradientField(ID id, tachyon::GradientF &value, LayoutOverride &&constraints={})
As above, in the theme's gradient swatch style.
Definition gui_application.h:2258
void EndDisabled()
Closes BeginDisabled.
Definition gui_application.h:1470
std::chrono::steady_clock::time_point m_frameStart
Internal: when the current frame started (set by UpdateFrame).
Definition gui_application.h:291
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:951
void IndeterminateProgressBar(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:775
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:1571
float frameTime
The last frame's duration in seconds, including any vsync wait or Run's pace wait.
Definition gui_application.h:293
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:1523
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:2526
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:1389
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:272
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:2236
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:1013
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:995
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:1978
GraphicsContext * graphicsContext
the backend from SetGraphicsBackend
Definition gui_application.h:225
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...
void CircularProgress(ID id, float value, LayoutOverride &&constraints={})
As above, in the theme's style.
Definition gui_application.h:787
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:1806
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:1859
tachyon::EventHandler MakeLabelHandler()
A label's handler: a click focuses the control the label belongs to.
bool SearchField(ID id, std::string &value, const GUIContent &content, TextEditBehavior textEditBehavior, StyleRef style, LayoutOverride &&constraints={})
A Field with a leading icon inside its border; style is the border's.
Definition gui_application.h:1868
bool Switch(ID id, bool &value, std::string_view text, StyleRef style, LayoutOverride &&constraints={})
Switches value itself.
Definition gui_application.h:719
bool Viewport(ID id, ViewportView &view, LayoutOverride &&constraints={})
A 3D view: the app's scene, drawn by view.onRender into an image the library keeps at the view's size...
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:1052
void SetColorSwatches(std::span< const tachyon::color4f > colors)
The color picker's swatches, which the user adds to and removes from; set them to start from the app'...
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...
auto StatusBar(A &&... a)
Definition gui_application.h:2736
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:2278
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 SearchField(ID id, std::string &value, const GUIContent &content, TextEditBehavior textEditBehavior=TextEditBehavior::ContinuousUpdate, LayoutOverride &&constraints={})
As above, in the theme's search style.
Definition gui_application.h:1870
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:2249
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:2585
DockDropResult FindDockDropTargetAtScreenPos(tachyon::int2 screenPos)
The leaf whose content (as last laid out) holds screenPos, the part of it the point is in (an edge,...
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.
bool BeginMenu(ID id, const GUIContent &content, LayoutOverride &&constraints={})
As above, in the theme's menu styles.
Definition gui_application.h:934
void Image(ImageIndex image, uint2 sourceSize, const ImageDisplay &display, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:2449
ID TreeDropTargetRow() const
The tree row a drag is over (drives the drop indicator), or Invalid.
Definition gui_application.h:1435
bool Timeline(TimelineState &state, const TimelineOptions &options, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:846
bool CornersField(ID id, BoxCorners &value, NumericFieldConfig< int32_t > config={ .stepPerPixel=0.25,.minVal=0,.maxVal=64 }, LayoutOverride &&constraints={})
As EdgesField, for corner radii: top left, top right, bottom right and bottom left.
auto ToggleGroup(A &&... a)
Definition gui_application.h:2729
void SetDisabledTooltip(std::string_view text, std::string_view reason)
As above, for the last control.
Definition gui_application.h:1114
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:2048
void TaskProgress(ID id, const ProgressTask &task, LayoutOverride &&constraints={})
A piece of work in full: its name and percent (or note) over its bar, a cancel button when onCancel i...
bool Field(ID id, T &value, StyleRef style, NumericFieldConfig< ComponentT > config, LayoutOverride &&constraints={})
As the first, updating continuously.
Definition gui_application.h:1966
uint32_t ContextMenuOpenings() const
Counts the context menus opened, a right click on a target whose menu is already open included.
Definition gui_application.h:1139
void PersistValue(std::string key, bool &value)
Keeps an app value.
bool BeginDropdownMenu(ID id, const GUIContent &content, StyleRef buttonStyle, StyleRef menuStyle, StyleRef itemStyle, LayoutOverride &&constraints={})
A menu opened from a dropdown: as BeginMenu, with an arrow after its text also in a menu bar or title...
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:1981
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:717
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:2715
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:2228
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:2566
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:2597
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:723
void DocumentLine(const DocumentSet &set, LayoutOverride &&constraints=LayoutOverride::Auto())
The line under the document bar of set, in the active document's color, across what it's in: after th...
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:1957
void CloseAllDocuments(DocumentSet &set)
Closes every document of set, as CloseDocument does each: at exit, say.
void RenderNodeView(NodeViewRef view)
Builds view (canvas, nodes, wires and overlays) in the current container: a NodeView,...
DragVisualizer ImageDragGhost(ImageIndex image, uint2 size)
A ghost for a drag of a picture: image fitted into 64 x 64 CSS px by the pointer, keeping its shape.
void DismissToast(ToastID toast)
Takes a toast away, as its close button does.
void Skeleton(LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:798
auto Selected(A &&... a)
Definition gui_application.h:2742
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:961
bool CurveField(ID id, CurveViewRef view, LayoutOverride &&constraints={})
A curve in a box, over the curves' range: a click opens the curve editor (CurveEditor) in a window un...
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,...
void ProgressSteps(ID id, std::span< const ProgressTask > steps, LayoutOverride &&constraints={})
The steps of a longer job, one a row: a glyph for its state (a check once done, a spinner while runni...
bool RangeField(T &value, std::type_identity_t< T > minVal, std::type_identity_t< T > maxVal, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:2334
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:1809
void ProgressSteps(std::span< const ProgressTask > steps, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:814
const std::string & GetResourceRoot() const
See GUIApplicationInitializeOptions.
Definition gui_application.h:468
static constexpr int kFrameHistoryCount
~4s @ 60fps
Definition gui_application.h:299
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:1765
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:2092
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:1091
bool BeginVerticalWrap(ID id, StyleRef style, LayoutOverride &&constraints={})
A vertical container whose children wrap onto further columns.
void Image(ImageIndex image, const UVRect &uv, 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:2424
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:2402
IWindowBackend * windowBackend
SetWindowBackend's windows plus render-to-image windows.
Definition gui_application.h:224
void SetTooltip(IconID icon, std::string_view text)
As above, with an icon, on the control just drawn.
Definition gui_application.h:1093
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:1234
void Spinner(SpinnerSize size=SpinnerSize::Medium, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:781
bool BeginArea(ID id, LayoutOverride &&constraints={})
As above, in the theme's area style.
Definition gui_application.h:1192
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:1023
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:525
void IndeterminateProgressBar(ID id, StyleRef style, LayoutOverride &&constraints={})
A bar for work of unknown length: a segment with soft ends slides along it, from start to end every 1...
RedrawMode GetRedrawMode() const
Builds the UI; called each frame.
Definition gui_application.h:587
bool Field(ID id, std::string &value, StyleRef style, LayoutOverride &&constraints={})
As above, updating continuously.
Definition gui_application.h:1853
bool BeginStatusBar(ID id, LayoutOverride &&constraints={})
As above, in the theme's status bar style.
Definition gui_application.h:1692
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:2130
void ProgressBar(ID id, float value, LayoutOverride &&constraints={})
As above, not failed, in the theme's bar style.
Definition gui_application.h:765
auto Cached(A &&... a)
Definition gui_application.h:2721
bool Field(ID id, T &value, TextEditBehavior textEditBehavior, LayoutOverride &&constraints={})
As above, with the default config.
Definition gui_application.h:1960
void Image(ID id, ImageIndex image, const UVRect &uv, StyleRef style, LayoutOverride &&constraints={})
Draws the part uv of image stretched over the element's padding box: a cell of an atlas (UVRect::From...
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:1694
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:2136
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.
void ReleaseDockingLayout(DockingLayout &layout)
Closes a layout for good, as ForgetDockingLayout does, and empties it: its panels are hidden (onDisab...
bool BeginMenuBar(ID id, LayoutOverride &&constraints={})
As above, in the theme's menu bar style.
Definition gui_application.h:1050
void TimelineEditor(TimelineViewRef view, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:871
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:1225
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:698
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:1321
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.
ID DropTargetID() const
The element that takes the drag under the pointer, wherever the drag came from: files from another ap...
Definition gui_application.h:1452
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:2724
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:2095
void RequestRedrawIn(float seconds)
Asks for a frame seconds from now (a clock's next tick). Safe from any thread.
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:1851
const ThemeVariableOverrides & GetThemeVariables() const
The variables set with SetThemeVariable for the theme loaded.
GradientManager gradientManager
GPU pages for the gradients styles use.
Definition gui_application.h:267
void Image(ID id, ImageIndex image, uint2 sourceSize, const ImageDisplay &display, LayoutOverride &&constraints={})
As above, the whole image, in the theme's image style.
Definition gui_application.h:2447
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.
float SecondsUntilFrame() const
Seconds until a frame is needed: 0 when NeedsFrame is true, INFINITY when nothing is due (only input ...
void PersistValue(std::string key, float &value)
As above, for a float.
auto Invalid(A &&... a)
Definition gui_application.h:2741
bool BeginMenu(const GUIContent &content, 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:936
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:1227
void DragLabel(ID id, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's drag label style.
Definition gui_application.h:2347
bool BeginDisabled()
Controls emitted in between are disabled: drawn dimmed, and they take no input.
Definition gui_application.h:1468
void Toasts()
The toasts, in the current window's bottom-right corner over what's built before; call it last in the...
void IndeterminateProgressBar(ID id, LayoutOverride &&constraints={})
As above, in the theme's bar style.
Definition gui_application.h:773
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:1196
bool BeginTooltip()
As above, on the control just drawn.
Definition gui_application.h:1120
bool CurveField(CurveViewRef view, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:887
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:973
void ShowContentTooltip(ID id, const GUIContent &content)
The content's tooltip, if it has one, on the control id.
Definition gui_application.h:657
IDManager idManager
Element IDs: static ones (CreateStaticID), call-site ones (AllocateDynamicID) and parent scopes (Push...
Definition gui_application.h:231
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:700
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:2042
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:2387
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:2615
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:2141
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:1040
static TreeOpenRef TreeViewOpenRef(const std::vector< TreeViewRow > &rows, size_t flat, TableState &state)
The TreeCell open state of flat row flat in the view with state: its key in state....
Definition gui_application.h:1413
bool Field(ID id, bool &value, std::string_view text, LayoutOverride &&constraints={})
As above, in the theme's toggle style.
Definition gui_application.h:1843
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:1312
OnGuiFunc onGui
Runs a frame from inside the OS's modal resize loop, so windows repaint while resized.
Definition gui_application.h:281
bool BeginVertical(ID id, LayoutOverride &&constraints={})
As above, in the theme's plain style.
Definition gui_application.h:1245
bool applicationQuit
Set to true to end Run (UpdateFrame then returns false).
Definition gui_application.h:289
void PersistValue(std::string key, std::string &value)
As above, for a string.
bool GradientField(tachyon::GradientF &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:2262
void StatusProgress(ID id, const ProgressTask &task, LayoutOverride &&constraints={})
A piece of work in a status bar: a small spinner, its name, a 120px bar and its note ("1,...
bool Field(ID id, T &value, LayoutOverride &&constraints={})
As above, updating continuously.
Definition gui_application.h:1963
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:1529
void SetReducedMotion(std::optional< bool > reduced)
Reduced motion: changes of state show at once instead of blending.
bool ShadowField(ID id, BoxShadow &value, LayoutOverride &&constraints={})
A shadow: its color over its offsets (X, Y), blur and spread.
void DocumentBar(ID id, DocumentSet &set, StyleRef style, LayoutOverride &&constraints=LayoutOverride::Auto())
The document bar of set alone: its tabs, "+", "N open" and the line in the active document's color.
bool BeginSelected()
Items emitted in between render as selected.
Definition gui_application.h:1464
void SetResourceRoot(std::string_view root)
The folder the resources load from: compiled shaders, default fonts and relative theme paths.
Definition gui_application.h:467
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:223
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:1599
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:734
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:227
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:713
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.
ID DragGhostWindowID() const
The window a drag's ghost goes in, by the pointer (see BeginCursorGhostWindow).
Definition gui_application.h:1458
auto Row(A &&... a)
Definition gui_application.h:2731
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:1260
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:2184
void PersistLayoutPresets(std::string key, LayoutPresets &presets)
Keeps the layouts the user saved and the file types' layouts; the app adds its built-in ones itself,...
bool BusyButton(ID id, const GUIContent &content, bool busy, std::string_view busyText, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
A button at work: a spinner in place of its icon and busyText ("Saving...") in place of its text,...
void Image(ID id, ImageIndex image, const UVRect &uv, LayoutOverride &&constraints={})
As above, in the theme's image style.
Definition gui_application.h:2422
bool CommandButton(CommandID command, LayoutOverride &&constraints={})
As above, in the theme's button style.
Definition gui_application.h:691
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).
bool BeginDropdownMenu(ID id, const GUIContent &content, LayoutOverride &&constraints={})
As above, in the theme's menu-bar dropdown style (menu-bar-dropdown) and menu styles.
Definition gui_application.h:944
void AddRecentColor(tachyon::color4f color)
Adds a color to the picker's recent ones, as OK does: newest first, each once, at most 8.
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:2364
void TreeCell(std::string_view text, int depth, TreeOpenRef 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].
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:295
auto Window(A &&... a)
Definition gui_application.h:2714
const Result< void > & ThemeReloadResult() const
How the last reload went; on an error the previous theme stays.
Definition gui_application.h:436
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:2002
void Skeleton(ID id, LayoutOverride &&constraints={})
As above, in the theme's style.
Definition gui_application.h:796
bool DestructiveMenuItem(ID id, const GUIContent &content, std::function< void()> onClick, StyleRef style, LayoutOverride &&constraints={})
Without a shortcut, in style.
Definition gui_application.h:1036
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:1030
auto Menu(A &&... a)
Definition gui_application.h:2717
bool BeginToggleGroup(LayoutOverride &&constraints={})
The same for Toggles and Field(bool).
void PersistThemeVariables(std::string key)
Keeps each theme's variables, set with SetThemeVariable.
void AddBox(ID id, StyleRef styleRef, IconID iconID, std::string_view text)
As above, sized to its content.
Definition gui_application.h:2821
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:2362
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:2133
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:2404
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:1194
bool BeginGhostWindow(ID windowLayoutID, int2 position, StyleRef styleRef)
Sized to its content.
Definition gui_application.h:2485
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:2291
bool GridViewItem(ID id, const GUIContent &content, StyleRef style, LayoutOverride &&constraints={})
Without rename, in style.
Definition gui_application.h:1526
void CloseDockedPanel(DockingLayout &layout, DockNode &leaf, int tabIndex)
Closes the panel at tabIndex of a docked leaf, as the tab's Close action does.
const std::optional< AccentColors > & GetAccent() const
SetAccent's accent; none while the palette's own is used.
Definition gui_application.h:446
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:708
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:955
bool ShortcutButton(ID id, const CommandManager::Command &command, std::function< void()> onClick, std::string_view unassigned="Unassigned", LayoutOverride &&constraints={})
A command's shortcut as keycaps, one per key ("Ctrl" "C"); a chord's two steps apart by a comma.
bool IsReducedMotion() const
Whether changes of state show at once now.
Definition gui_application.h:546
auto Vertical(A &&... a)
Definition gui_application.h:2723
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:1585
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:2370
void SetThemeVariable(std::string_view name, std::string_view value)
Sets a theme variable ("--bg-panel") to a CSS value ("#202020", "6px", "0 4px 12px rgba(0,...
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:1318
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:2234
bool Segmented(ID id, int &selected, std::span< const std::string_view > options, LayoutOverride &&constraints={})
One of a few choices side by side, as a button group with the chosen segment selected: selected is it...
bool Slider(T &value, std::type_identity_t< T > minVal, std::type_identity_t< T > 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:2307
bool Segmented(ID id, E &selected, std::span< const std::string_view > options, LayoutOverride &&constraints={})
As above, for an enum whose values are the segments' indices.
Definition gui_application.h:1172
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:706
bool BeginGhostWindow(ID windowLayoutID, int2 position)
A ghost window: caption-less and transparent, e.g.
Definition gui_application.h:2458
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:2375
bool RestoreDocumentLayout(Document &document, const SavedDocument &saved, const std::function< std::optional< ID >(std::string_view key)> &makePanel={})
Lays a document's panels out as saved, and gives them their own states back:
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:957
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:1249
bool BeginCursorGhostWindow(ID windowLayoutID, int2 cursorPos, int2 size, StyleRef styleRef)
As above, with a size and style.
Definition gui_application.h:2510
tachyon::EventHandler MakeButtonHandler(OnClick &&onClick)
A handler that calls onClick on click.
Definition gui_application.h:620
bool Checkbox(ID id, bool &value, std::string_view text={}, LayoutOverride &&constraints={})
As above, in the theme's checkbox style.
Definition gui_application.h:704
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:2579
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:1032
void Image(ID id, ImageIndex image, uint2 sourceSize, LayoutOverride &&constraints={})
As above, in the theme's image style.
Definition gui_application.h:2412
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:1208
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.
void Image(ID id, ImageIndex image, uint2 sourceSize, const UVRect &uv, const ImageDisplay &display, StyleRef style, LayoutOverride &&constraints={})
The part uv of an image sourceSize pixels big, shown as display says, sized like the aspect-preservin...
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:2572
auto Area(A &&... a)
Definition gui_application.h:2726
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:1238
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:1504
std::unique_ptr< OSWindowManager > windowManager
The OS windows and their render contexts. Created by Initialize.
Definition gui_application.h:216
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:2479
bool Viewport(ViewportView &view, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:922
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:1883
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:732
void SetWheelMode(WheelMode mode)
What the wheel and a trackpad's two-finger scroll do over the canvases that pan and zoom (node view,...
Definition gui_application.h:552
void SetTooltip(const PropertyHelp &help)
As above, for the last control.
Definition gui_application.h:1104
void PersistValue(std::string key, int &value)
As above, for an int.
void Image(ID id, ImageIndex image, uint2 sourceSize, const UVRect &uv, StyleRef style, LayoutOverride &&constraints={})
The part uv of an image sourceSize pixels big, sized like the aspect-preserving Image above to the as...
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:2591
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:2368
bool BeginCursorGhostWindow(ID windowLayoutID, int2 cursorPos, int2 size)
As above, with a size.
Definition gui_application.h:2515
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:1446
bool BeginReorderableItem(ID id, StyleRef style, LayoutOverride &&constraints={})
One draggable item of a reorderable group; any content goes inside.
bool ShowsFocusRing(const tachyon::Element &element) const
Whether element draws its focus ring (:focus-visible): it's focused and focus came from the keyboard,...
Definition gui_application.h:1485
GUIApplicationInitializeOptions InitializeOptions
See GUIApplicationInitializeOptions.
Definition gui_application.h:416
auto MenuBar(A &&... a)
Definition gui_application.h:2718
bool Tab(ID id, const GUIContent &content, LayoutOverride &&constraints={})
As above, in the theme's tab style.
Definition gui_application.h:1787
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:1534
void ForgetDockingLayout(DockingLayout &layout)
Before an app destroys layout: closes the windows of the panels torn off it (they would dock back int...
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:1984
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:1011
void CircularProgress(ID id, float value, StyleRef style, LayoutOverride &&constraints={})
A ring filled value (0 to 1, clamped) of the way round, clockwise from the top, the percentage in its...
bool BackgroundTasks(std::span< const ProgressTask > tasks, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:827
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:1443
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:1372
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:1550
void TimelineEditor(ID id, TimelineViewRef view, LayoutOverride &&constraints={})
A timeline editor over view: a toolbar (the transport, with the previous and next key in place of the...
void EndToggleGroup()
Closes BeginToggleGroup.
void PresentFrame()
See UpdateFrame.
void Image(ImageIndex image, uint2 sourceSize, const UVRect &uv, 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:2434
bool BeginReorderableItem(ID id, LayoutOverride &&constraints={})
As above, in the theme's item style.
Definition gui_application.h:1345
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:2377
bool BeginTitleBar(ID id, LayoutOverride &&constraints={})
As above, in the theme's title bar style.
Definition gui_application.h:1072
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:1987
auto LabelGroup(A &&... a)
Definition gui_application.h:2727
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:1378
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:1236
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:238
void EndTable()
Builds the recorded rows as a VirtualTable.
void DocumentPanels(DocumentSet &set, LayoutOverride &&constraints=LayoutOverride::Auto())
The active document's panels of set, after its DocumentBar.
void ClearThemeVariable(std::string_view name)
Back to the theme's own value for name.
int MessageDialog(ID id, const MessageDialogDesc &desc)
As above, in the theme's message box style.
Definition gui_application.h:971
bool ColorField(ID id, tachyon::color4b &value, LayoutOverride &&constraints={})
As above, in the theme's color field style.
Definition gui_application.h:2232
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:1680
auto ButtonGroup(A &&... a)
Definition gui_application.h:2728
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:2181
auto Disabled(A &&... a)
Definition gui_application.h:2740
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:1706
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:243
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:1019
void PersistWindow(std::string key, ID windowID)
Keeps the window's position, size and mode.
std::vector< tachyon::color4f > ColorSwatches() const
A color swatch that opens a color picker; true when the color changed.
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:1887
void CloseWindow()
Internal: the body of EndWindow for an open window; call EndWindow.
Definition gui_application.h:2752
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:2281
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:2766
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:2349
virtual void OnStylesReloaded()
Called after every successful theme/font reload (and by subclasses at startup) to re-register styles/...
Definition gui_application.h:430
bool BackgroundTasks(ID id, std::span< const ProgressTask > tasks, LayoutOverride &&constraints={})
A "3 tasks" pill with a chevron, for a status bar, that opens a popover listing tasks: each with its ...
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, bool lit=false)
A menu row: an icon slot, the label and a trailing text (a shortcut or a submenu arrow).
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:2253
void EndHorizontal()
Closes BeginHorizontal.
void ProgressBar(float value, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:767
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:676
std::unique_ptr< IClipboard > clipboard
Text and images to copy and paste (Get / Set, GetImage / SetImage); from SetClipboard.
Definition gui_application.h:220
void SelectableText(ID id, const std::span< ContentRun > &runs, LayoutOverride &&constraints={})
As above, in the theme's text style.
Definition gui_application.h:2390
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:1857
auto GridView(A &&... a)
Definition gui_application.h:2733
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:2360
bool IsThemeCrossfading() const
True while a theme switch is crossfading (the old look fading out over the new).
Definition gui_application.h:544
bool RangeField(ID id, T &value, std::type_identity_t< T > minVal, std::type_identity_t< T > maxVal, LayoutOverride &&constraints={})
A number in [minVal, maxVal]: a slider taking the row's room and a value box after it to type into.
Definition gui_application.h:2315
ToastDesc * FindToast(ToastID toast)
A shown toast's description, to change (its progress, its body); null once it's gone.
bool Slider(ID id, T &value, std::type_identity_t< T > minVal, std::type_identity_t< T > maxVal, StyleRef style, LayoutOverride &&constraints={})
Groove + knob without value text; drag-only.
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:1391
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:2224
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:2804
bool GradientField(ID id, tachyon::Gradient &value, StyleRef style, LayoutOverride &&constraints={})
A gradient swatch that opens a gradient editor; true when the gradient changed.
void Image(ImageIndex image, const ImageDisplay &display, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:2442
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:1324
void Skeleton(ID id, StyleRef style, LayoutOverride &&constraints={})
A placeholder bar where content is still loading, sized as the content it stands for (give it a width...
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:1393
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:742
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:1896
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:1466
bool BeginIndeterminate()
Value fields emitted in between show a dash for mixed values (e.g.
Definition gui_application.h:661
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:2499
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:1374
void Image(ImageIndex image, const UVRect &uv, 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:2426
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:1349
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:1370
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:1508
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:1789
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:1054
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:1696
void DisableAllPanels(DockingLayout &layout)
Panel lifecycle.
void CircularProgress(float value, LayoutOverride &&constraints={}, std::source_location site=std::source_location::current())
As above, with the call site as the ID.
Definition gui_application.h:789
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:512
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:1015
bool ApplyDockLayout(DockingLayout &layout, std::string_view tree, const std::function< std::optional< ID >(std::string_view key)> &makePanel={})
Lays a layout's panels out as tree (SaveDockLayout's text) says:
bool EdgesField(ID id, BoxEdges &value, NumericFieldConfig< int32_t > config={ .stepPerPixel=0.25,.minVal=0,.maxVal=64 }, LayoutOverride &&constraints={})
Border widths, padding or the like: a number field for each side, captioned T, R, B and L,...
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:1975
auto Toolbar(A &&... a)
Definition gui_application.h:2735
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:1861
bool Switch(ID id, bool &value, std::string_view text={}, LayoutOverride &&constraints={})
As above, in the theme's switch style.
Definition gui_application.h:721
bool NeedsFrame() const
Whether a frame is needed now.
void AddGhostIcon(IconID icon, int2 size, std::source_location site=std::source_location::current())
As above, size in pixels: in a ghost window of that size, a small icon by the cursor,...
Definition gui_application.h:2532
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:1283
void InjectPinch(ID windowID, float scale, KeyModifier mods=KeyModifier::None)
A trackpad pinch by scale where the pointer is.
bool BeginButtonGroup(ID id, LayoutOverride &&constraints={})
As above, with the group's own ID.
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:740
bool BeginMenu(ID id, const GUIContent &content, 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 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:1855
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.
void RequestRedraw()
Asks for a frame, for a change the UI can't see by itself: data from another thread,...
bool BeginContextMenu()
As above, on the control just drawn.
Definition gui_application.h:1130
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:2414
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:1042
bool GridViewItem(ID id, const GUIContent &content, LayoutOverride &&constraints)
As above, without rename.
Definition gui_application.h:1520
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:2505
void DrawnValid(tachyon::ElementRef ref)
The element just registered drawn as valid inside a BeginInvalid scope: the part of a control that sh...
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:1594
bool GradientField(tachyon::GradientF &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:2260
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:696
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:1702
auto Indeterminate(A &&... a)
Definition gui_application.h:2743
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:1258
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:1247
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:2781
std::unique_ptr< InputManager > inputManager
Routes input events to the elements; also holds global handlers. Created by Initialize.
Definition gui_application.h:212
Definition gui_renderer.h:78
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
DragDropState & Drag()
Definition gui_state_manager.h:90
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:80
StyleRef emptyVertWrapStyleRef
vertical flex, wrap
Definition gui_theme.h:90
StyleRef imageStyleRef
default box for the Image() element
Definition gui_theme.h:117
StyleRef collectionAreaStyleRef
card-like well behind the list & dictionary Field() helpers
Definition gui_theme.h:376
StyleRef collectionRowStyleRef
list field: a row
Definition gui_theme.h:381
StyleRef rangeFieldStyleRef
RangeField: the row holding the slider and value box.
Definition gui_theme.h:152
StyleRef tableStyleRef
Table: the table.
Definition gui_theme.h:265
StyleRef titleBarStyleRef
a window's own title bar (BeginTitleBar)
Definition gui_theme.h:416
StyleRef checkboxStyleRef
Checkbox: the control.
Definition gui_theme.h:202
StyleRef gradientSwatchStyleRef
GradientField: the swatch.
Definition gui_theme.h:230
StyleRef vectorComponentStyleRef
a vector component's field
Definition gui_theme.h:338
StyleRef menuBarDropdownStyleRef
a dropdown in the menu bar or title bar (BeginDropdownMenu)
Definition gui_theme.h:402
StyleRef staticTextStyleRef
plain non-interactive text
Definition gui_theme.h:116
StyleRef collectionIndexStyleRef
list field: a row's index
Definition gui_theme.h:382
StyleRef switchStyleRef
Switch: the control (track + label).
Definition gui_theme.h:153
StyleRef gridViewStyleRef
BeginGridView's default.
Definition gui_theme.h:473
StyleRef vertReorderableGroupStyleRef
Definition gui_theme.h:462
StyleRef typedFieldTypeStyleRef
TypedField: the type tag.
Definition gui_theme.h:379
StyleRef sliderFieldTrackStyleRef
SliderField: the track holding the parts below.
Definition gui_theme.h:142
StyleRef vertReorderableGroupWrapStyleRef
Definition gui_theme.h:464
StyleRef dockContainerStyleRef
a docking container
Definition gui_theme.h:696
StyleRef windowStyleRef
BeginWindow's default.
Definition gui_theme.h:364
StyleRef groupLabelTopStyleRef
Label with a caption: the container.
Definition gui_theme.h:392
StyleRef ghostIconStyleRef
the icon in a drag ghost
Definition gui_theme.h:114
StyleRef emptyHorzStyleRef
horizontal flex, no wrap; groups elements without drawing anything
Definition gui_theme.h:87
StyleRef collectionEntryStyleRef
dictionary: a row
Definition gui_theme.h:386
StyleRef menuStyleRef
a menu's window
Definition gui_theme.h:397
StyleRef circularProgressStyleRef
CircularProgress: its size and its percentage's text.
Definition gui_theme.h:517
StyleRef emptyHorzWrapStyleRef
horizontal flex, wrap
Definition gui_theme.h:88
StyleRef collectionAddEntryStyleRef
dictionary: Add entry
Definition gui_theme.h:385
IconID tabCloseIcon
a tab's close button
Definition gui_theme.h:722
StyleRef collectionValueStyleRef
dictionary: a value
Definition gui_theme.h:387
StyleRef colorFieldStyleRef
ColorField: swatch, hex and alpha in a row.
Definition gui_theme.h:168
StyleRef listItemStyleRef
ListItem's default.
Definition gui_theme.h:467
StyleRef menuItemRowStyleRef
interactive row: icon slot + label + trailing shortcut/arrow
Definition gui_theme.h:427
StyleRef listViewStyleRef
BeginListView's default.
Definition gui_theme.h:466
const ControlStyles * controls
the bundle in use
Definition gui_theme.h:85
StyleRef collectionListStyleRef
list field: the rows
Definition gui_theme.h:380
StyleRef commandSearchStyleRef
a field's placeholder while it is empty (SearchField)
Definition gui_theme.h:344
StyleRef statusBarStyleRef
BeginStatusBar's default.
Definition gui_theme.h:339
StyleRef typedFieldStyleRef
TypedField: the box.
Definition gui_theme.h:377
StyleRef menuBarStyleRef
horizontal strip at the top of the main window
Definition gui_theme.h:400
StyleRef tabStyleRef
a docked tab whose group holds the focus
Definition gui_theme.h:503
StyleRef fieldElementGroupStyleRef
Built in code: an undecorated, growing, wrapping flex row (a multi-value drag field).
Definition gui_theme.h:92
StyleRef breadcrumbStyleRef
the breadcrumb path bar
Definition gui_theme.h:330
StyleRef skeletonStyleRef
Skeleton: a placeholder bar.
Definition gui_theme.h:518
StyleRef ghostWindowStyleRef
BeginGhostWindow's default: the window following a drag.
Definition gui_theme.h:113
StyleRef collectionAddStyleRef
list field: Add item
Definition gui_theme.h:384
StyleRef horzReorderableGroupStyleRef
Definition gui_theme.h:461
StyleRef messageBoxStyleRef
MessageDialog: the window.
Definition gui_theme.h:186
StyleRef typedFieldInputStyleRef
TypedField: the value.
Definition gui_theme.h:378
tachyon::VisualColorStyleIndex nanTextColor
a number field's NaN
Definition gui_theme.h:790
StyleRef progressBarStyleRef
ProgressBar's track, 6px high.
Definition gui_theme.h:512
StyleRef labelStyleRef
Label()'s default.
Definition gui_theme.h:118
StyleRef searchTextboxStyleRef
Definition gui_theme.h:489
StyleRef reorderableItemStyleRef
Definition gui_theme.h:460
StyleRef collectionRemoveStyleRef
list / dictionary: remove
Definition gui_theme.h:383
StyleRef emptyVertStyleRef
vertical flex, no wrap
Definition gui_theme.h:89
StyleRef sliderStyleRef
Slider: a groove and knob, no value text.
Definition gui_theme.h:148
StyleRef documentBarStyleRef
the bar: its row over the line
Definition gui_theme.h:681
StyleRef statusTextStyleRef
text in the status bar
Definition gui_theme.h:340
StyleRef axisLabelStyleRefs[4]
vector fields: the label of each component (X, Y, Z, W)
Definition gui_theme.h:334
StyleRef dragLabelStyleRef
DragLabel()'s default.
Definition gui_theme.h:121
StyleRef collectionStyleRef
BeginArea / BeginCached default.
Definition gui_theme.h:455
StyleRef horzReorderableGroupWrapStyleRef
Definition gui_theme.h:463
The atlas that the colors of color styles are baked into: pages of 2D textures, one row per gradient,...
Definition gui_gradient_manager.h:65
A graphics backend: the device, the window contexts that render the GUI's windows,...
Definition gui_graphics_context.h:53
Makes element IDs: per-frame dynamic / ranged IDs (hashed from the call site or a hint and the parent...
Definition gui_id_manager.h:31
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:189
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, a float or double s...
Definition gui_text_system.h:297
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:112
An image made by GraphicsContext::CreateImage; the backend defines its contents.
Definition gui_image.h:102
ID GetHoveredID() const
Definition gui_interaction_state.h:63
bool HasBeenClicked(ID id) const
Definition gui_interaction_state.h:94
bool IsFocusVisible() const
Definition gui_interaction_state.h:88
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:66
void ClearPendingLabel()
Definition gui_label_binding.h:32
The layouts a document can be given: the app's built-in ones, then the ones the user saved,...
Definition gui_layout_presets.h:33
Per-ID state kept between frames for the elements still built: an entry not written for kKeepFrames f...
Definition gui_recent_id_map.h:25
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:78
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:52
void EndWindow()
Ends the window begun by BeginWindow; its chain wraps around.
Definition gui_tab_chain_manager.h:109
Tracks the running transitions of the elements' state channels.
Definition gui_transition_manager.h:53
bool IsReducedMotion() const
Definition gui_transition_manager.h:108
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:112
SpinnerSize
How large a Spinner is.
Definition gui_progress_types.h:14
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:273
RedrawMode
How often GUIApplication::Run draws a frame (GUIApplication::SetRedrawMode).
Definition gui_redraw.h:15
BasicViewRef< TimelineData, TimelineViewState > TimelineViewRef
A timeline and one view of it, as TimelineEditor and the helpers take them.
Definition gui_timeline_types.h:259
MessageButtonKind
How a MessageButton is styled: Primary for the main choice, Danger for a destructive one.
Definition gui_application.h:114
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:257
BasicViewRef< CurveData, CurveViewState > CurveViewRef
Curves and one view of them, as CurveField, CurveEditor and the helpers take them.
Definition gui_curve_types.h:231
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:337
EventHandler MakeButtonHandler(GUIStateManager &guiStateManager, OnClick &&onClick)
Button handler: a left click, or an activation key while focused, calls onClick (a null one is nothin...
Definition gui_default_handlers.h:141
@ Quit
Definition gui_application.h:112
@ Question
Definition gui_application.h:112
@ Medium
16px, beside a line of text
Definition gui_progress_types.h:16
@ Primary
Definition gui_application.h:114
@ Secondary
Definition gui_application.h:114
@ Danger
Definition gui_application.h:114
tachyon::ID TreeViewRowKey(const TreeViewRow &row, size_t flat)
How a view's TableState::openRows names the row at flat index flat: its own ID, or for a row without ...
Definition gui_tree_grid_types.h:89
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:35
BasicNodeViewRef< NodeGraph, NodeViewState > NodeViewRef
Definition gui_node_view_types.h:593
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:42
BasicViewRef< PlotData, PlotViewState > PlotViewRef
A plot and one view of it, as Plot and the helpers take them.
Definition gui_plot_types.h:112
@ 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:39
ElementFlags
What an element is and how it behaves, combined with |.
Definition gui_element_flags.h:17
std::function< void(const DragVisualContext &context)> DragVisualizer
Draws the dragged item while a drag is in progress.
Definition gui_drag_drop_state.h:62
@ DoNotMeasureText
Definition gui_element_flags.h:25
@ ShownFocused
Shown focused (GUIApplication::BeginShownState): its focus ring shows whether or not focus came from ...
Definition gui_element_flags.h:60
@ WindowNoCaption
Definition gui_element_flags.h:32
@ WindowIsCentered
Definition gui_element_flags.h:33
@ None
Definition gui_element_flags.h:18
@ WindowUserControlled
Definition gui_element_flags.h:31
@ PropagatesDescendantState
Hover/Focused when any descendant is.
Definition gui_element_flags.h:47
@ IsWindow
Definition gui_element_flags.h:27
@ WindowIsTransparent
Definition gui_element_flags.h:34
ImageIndex
Index of an image in the graphics context's image set, as the shaders sample it.
Definition gui_image.h:99
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
std::map< std::string, std::string, std::less<> > ThemeVariableOverrides
Theme variables set in code, by name ("--bg-panel") to a CSS value ("#202020", "6px",...
Definition gui_theme.h:56
@ 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
@ Focused
has keyboard focus (CSS: :focus)
Definition gui_style.h:46
TextEditBehavior
Definition gui_text_system.h:98
@ None
Definition gui_text_system.h:99
@ ContinuousUpdate
update the text on every keystroke, not only on commit
Definition gui_text_system.h:100
std::function< void()> OnGuiFunc
Definition gui_base_types.h:13
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:17
Per-corner values (border radius).
Definition gui_style.h:90
Per-side values of the box model (margin, padding, border widths).
Definition gui_style.h:64
One CSS box-shadow layer, outside the border box.
Definition gui_style.h:121
Handle to a registered command, stable for the manager's lifetime.
Definition gui_command_manager.h:32
A registered command.
Definition gui_command_manager.h:62
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:64
StyleRef menuTrigger
.menu-trigger / .toolbar-menu-trigger
Definition gui_theme.h:66
StyleRef toggle
.toggle / .toolbar-toggle
Definition gui_theme.h:63
StyleRef number
numeric fields: the textbox in the monospace font
Definition gui_theme.h:65
StyleRef button
.button / .toolbar-button
Definition gui_theme.h:62
A size in CSS px.
Definition gui_units.h:18
Result of FindDockDropTargetAtScreenPos: the drop target and its layout.
Definition gui_docking_types.h:190
Result of FindDockLeafAtScreenPos: the leaf and its layout, both null on a miss.
Definition gui_docking_types.h:184
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:158
The documents one main window shows, in tab order, and which one is active.
Definition gui_docking_types.h:239
A document: a level, prefab, material graph, ... with its own panels.
Definition gui_docking_types.h:212
An element's slot in ElementStorage: its depth and index within that depth.
Definition gui_element.h:126
Definition gui_element.h:32
ElementState state
Definition gui_element.h:44
TextID textID
Definition gui_element.h:38
ElementFlags flags
Definition gui_element.h:43
ID id
Definition gui_element.h:33
StyleRef styleRef
Definition gui_element.h:41
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:142
What GUIApplication::Initialize sets up besides the core systems.
Definition gui_application.h:158
bool closeMenusOnWindowMove
open menus close when a window moves or resizes
Definition gui_application.h:162
bool loadStyles
load the theme (InitializeStyles)
Definition gui_application.h:159
std::string_view fallbackFonts
The optional fallback fonts (Noto: other scripts, emoji, symbols), relative to the resource root,...
Definition gui_application.h:165
std::optional< GraphicsAPI > graphicsAPI
The graphics API to render with.
Definition gui_application.h:178
bool repaintWhileResizing
onGui = OnFrame, unless onGui is already set
Definition gui_application.h:161
std::string_view gpu
Which GPU to render with, when there's more than one: "integrated", "discrete", the GPU's number in t...
Definition gui_application.h:173
bool commandShortcuts
route keys to commandManager's shortcuts
Definition gui_application.h:160
uint32_t imageSlots
How many images can be registered at once, fonts, icons and gradients included.
Definition gui_application.h:169
Rolling per-frame timing history in ms, recorded only while profiling is enabled.
Definition gui_application.h:298
float buildMs
Definition gui_application.h:298
float totalMs
Definition gui_application.h:298
Definition gui_application.h:3280
std::span< VirtualTableColumn > columns
Definition gui_application.h:3280
TableState * state
Definition gui_application.h:3280
Tree-view backing state, rebuilt per frame; not part of the API.
Definition gui_application.h:2885
std::vector< TreeViewRow > rows
Definition gui_application.h:2886
std::vector< int > visibleIdx
Definition gui_application.h:2887
TableState tableState
Definition gui_application.h:2888
A page: a stable ID, its name in the tree, and render, which builds its content.
Definition gui_application.h:2863
std::function< void()> render
Builds the page's content while it is selected.
Definition gui_application.h:2869
std::string name
Shown in the page tree.
Definition gui_application.h:2867
IconID icon
Before its name in the page list; optional.
Definition gui_application.h:2871
tachyon::ID id
Stable across frames.
Definition gui_application.h:2865
What RenderSettingsPanel shows: its pages, the selected one and the tree width.
Definition gui_application.h:2860
CssPx treeWidth
The page tree's width; its sizer changes it.
Definition gui_application.h:2881
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:2892
std::vector< Page > pages
Added with AddPage.
Definition gui_application.h:2875
tachyon::ID selectedID
The page shown; a click in the tree changes it.
Definition gui_application.h:2879
std::string header
Above the page list, as a small caption ("Preferences"); none when empty.
Definition gui_application.h:2877
tachyon::ID AddPage(tachyon::ID id, std::string_view name, IconID icon, std::function< void()> render)
As above, with an icon before its name in the page list.
Definition gui_application.h:2898
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
A gradient of float colors, for data such as a material editor's gradient map: up to kMaxStops stops,...
Definition gui_style_gradient.h:303
Up to kMaxStops color stops plus an angle and interpolation color space.
Definition gui_style_gradient.h:93
User-owned, persistent state of a virtualized GridView; keep it alive across frames.
Definition gui_tree_grid_types.h:105
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
How an image is shown, in this order:
Definition gui_image.h:42
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:57
Per-element overrides of style layout properties.
Definition gui_constraints.h:151
constexpr bool HasFixedWidth() const
Whether an explicit width / height is set; axis 0 = width, 1 = height.
Definition gui_constraints.h:195
LayoutOverride & PositionX(PositionConstraintAxis ax) &
Sets one axis's constraint, or only its PositionType.
Definition gui_constraints.h:293
PositionConstraintAxis x
Definition gui_constraints.h:154
LayoutOverride & NoShrink() &
Shorthands for FlexGrow(0) / FlexShrink(0).
Definition gui_constraints.h:328
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:313
PositionConstraintAxis y
Position constraints; set with the position builders.
Definition gui_constraints.h:154
static LayoutOverride FixedWidth(CssPx w)
Definition gui_constraints.h:188
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:185
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:233
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:237
LayoutOverride & FlexGrow(int16_t v) &
Overrides the style's flex-grow / flex-shrink.
Definition gui_constraints.h:318
LayoutOverride & NoGrow() &
Shorthands for FlexGrow(0) / FlexShrink(0).
Definition gui_constraints.h:327
static LayoutOverride Auto()
No overrides: everything comes from the style.
Definition gui_constraints.h:183
LayoutOverride & Position(int2 p) &
Position builders, in pixels (near = left/top, far = right/bottom).
Definition gui_constraints.h:253
What a MessageDialog shows.
Definition gui_application.h:138
MessageIcon icon
beside the text
Definition gui_application.h:139
std::string_view title
a question: "Quit Test?"
Definition gui_application.h:140
bool * dontAskAgain
shows "Don't ask again" when set
Definition gui_application.h:146
int cancelButton
Esc and the close button; -1: the default one.
Definition gui_application.h:144
std::span< const MessageDialogItem > items
affected items, listed in a well
Definition gui_application.h:145
std::string_view message
one or two sentences on what happens
Definition gui_application.h:141
std::string * input
Shows a text field editing it, under the message, with the keyboard in it at first; Enter in it choos...
Definition gui_application.h:150
std::span< const MessageButton > buttons
MessageDialog returns an index into these.
Definition gui_application.h:142
std::string_view details
collapsible technical details (mono)
Definition gui_application.h:147
int defaultButton
focused at first; Enter
Definition gui_application.h:143
An affected item, listed in a well: a name, an optional color dot and note, and a checkbox when check...
Definition gui_application.h:129
std::string_view meta
e.g. "12 edits"
Definition gui_application.h:131
std::string_view name
e.g. a file name
Definition gui_application.h:130
color4f color
alpha 0: no dot
Definition gui_application.h:132
bool * checked
shows a checkbox bound to it when set
Definition gui_application.h:133
Selected item IDs of a multi-select view; user-owned, keep it alive across frames.
Definition gui_widget_state_types.h:22
Drag speed and range of a numeric Field, specialized per value type.
Definition gui_numeric_field_config.h:54
The pen, as it was at a pointer event.
Definition gui_input_state.h:40
A size in device pixels, used as is (not scaled by the UI scale).
Definition gui_units.h:28
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 piece of work, as TaskProgress, ProgressSteps, StatusProgress and BackgroundTasks show it.
Definition gui_progress_types.h:33
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:289
A document as SaveUIState kept it: which one it was, and how its panels were laid out.
Definition gui_docking_types.h:278
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:162
std::unordered_set< tachyon::ID > openRows
VirtualTreeView and WalkTreeViewVisibility: the rows open in this view, by TreeViewRowKey.
Definition gui_table_types.h:256
What a Timeline covers. The markers are only read during the call.
Definition gui_timeline_types.h:46
Where playback is: what a Timeline shows and edits.
Definition gui_timeline_types.h:25
What a toast says (ShowToast). Change it later through FindToast.
Definition gui_notification_types.h:30
Where a tree row's open state lives: a bool of the caller's (flag), or the rows a view has open (set,...
Definition gui_table_types.h:142
One row of a flat-data tree view (VirtualTreeView); rows are in depth-first order.
Definition gui_tree_grid_types.h:66
bool HasChildren() const
Definition gui_tree_grid_types.h:84
static constexpr int dimensions
Definition gui_type_dimensions.h:15
static T & GetComponent(T &value, int)
Definition gui_type_dimensions.h:16
The part of an image to draw, in UV: 0,0 is its top-left corner and 1,1 its bottom-right.
Definition gui_image.h:15
A viewport: what it shows and how. Keep it from frame to frame, as a CurveView.
Definition gui_viewport_types.h:100
A VirtualTable column: the TableColumn plus cell generator, sort order and section.
Definition gui_table_types.h:90
Definition gui_base_types.h:383
Definition gui_base_types.h:394
Definition gui_base_types.h:120
Integer 2D vector.
Definition gui_base_types.h:18
int32_t x
Definition gui_base_types.h:19
int32_t y
Definition gui_base_types.h:19
Definition gui_base_types.h:74