GGUI/Public/UIPanels.h file

Tool-window building blocks: splits, tabs, menu bar, toolbar.

ui.Split({ .Direction = GGSplit::Columns, .Ratio = &ratio, .Min = 120 },
         [=](UI& ui) { Outliner(ui); },
         [=](UI& ui) { Details(ui); });

auto tab = ui.State<int>(0);
ui.Tabs({ .bClosable = true }, tab, [&]
{
    ui.Tab("Scene", [=](UI& ui) { ScenePanel(ui); });
    ui.Tab("Assets", { .OnClose = [] { CloseAssets(); } }, [=](UI& ui) { AssetPanel(ui); });
});

if (auto bar = ui.MenuBar())                       // or ui.MenuBar([&] { ... });
    ui.SubMenu("File", [=](UI& ui) { ui.MenuItem(OpenScene); ui.Separator(); ui.MenuItem(Quit); });

if (auto bar = ui.Toolbar())                       // or ui.Toolbar([&] { ... });
{
    ui.ToolButton(moveIcon, MoveTool, { .bChecked = bMoving });        // action: title, tooltip, chord
    ui.Separator();
    ui.ToolButton(gridIcon, { .Tooltip = "Show the grid" }, [] { ToggleGrid(); });
}

Only the selected tab's content is built. Titles and tooltips are localised. Shortcuts are actions (UIActions.h), never display text. Tool buttons and tabs that don't fit are listed in a menu at the end of their row.

Namespaces

namespace GGUI
namespace GGUI::Splits
Splits as they are, for tools and tests.

Classes

struct GGUI::SplitProps
Properties of ui.Split: two panes and a divider between them.
struct GGUI::TabsProps
Properties of ui.Tabs.
struct GGUI::TabProps
Properties of one ui.Tab.
struct GGUI::ToolbarProps
Properties of ui.Toolbar.
struct GGUI::ToolButtonProps
Properties of ui.ToolButton.