Panels in a dock layout that the user can rearrange, tear off and dock again.
Panels in a dock layout that the user can rearrange, tear off and dock again.Walkthrough: Docking.
#include <cstdio>
#include <string>
{
public:
{
return result;
windowID = idManager.CreateStaticID();
dockID = idManager.CreateStaticID();
const tachyon::ID scene = CreatePanel(layout.panels,
"Scene", noIcon, [
this] { ScenePanel(); });
const tachyon::ID details = CreatePanel(layout.panels,
"Details", noIcon, [
this] { DetailsPanel(); });
const tachyon::ID log = CreatePanel(layout.panels,
"Log", noIcon, [
this] { Text(
"Nothing logged yet."); });
const tachyon::ID help = CreatePanel(layout.panels,
"Help", noIcon, [
this] { Text(
"Drag the tabs around."); });
return {};
}
void OnGUI() override
{
{
EndDockingContainer();
EmitFloatingDockWindows();
}
EndWindow();
}
private:
void ScenePanel()
{
for (int i = 0; i < 4; ++i)
}
void DetailsPanel()
{
Text("Selected object " + std::to_string(selected));
BeginLabelGroup();
DragLabel("Scale");
Field(scale);
EndLabelGroup();
}
int selected = 0;
float scale = 1.0f;
};
int main()
{
DockingApp app;
if (result)
result = app.Run();
app.Cleanup();
if (!result)
{
return 1;
}
return 0;
}
The application: owns the windows, the systems and the frame loop.
Definition gui_application.h:185
A value, or the Error saying why there is none.
Definition gui_result.h:36
const Error & GetError() const
The error; only valid when !HasValue().
Definition gui_result.h:61
std::unique_ptr< DockNode > MakeLeaf(std::initializer_list< ID > panelIds={})
A leaf with the given panel tabs.
std::unique_ptr< DockNode > MakeSplit(DockSplitMode mode, CssPx splitSize, std::unique_ptr< DockNode > first, std::unique_ptr< DockNode > second, CssPx minFirstSize=80, CssPx minSecondSize=80)
A split node owning first and second; sizes in CSS px.
DockSplitMode
Split direction and which child is pinned to splitSize; the other child flexes.
Definition gui_dock_node.h:25
IconID
Handle for an icon registered with ITextSystem::RegisterIconFromSVG / RegisterIconFromSVGFile.
Definition gui_style_text.h:15
@ Invalid
Definition gui_style_text.h:15
A docking area: the split/tab tree and the panels its leaves refer to by ID.
Definition gui_docking_types.h:125
std::string message
what went wrong, for logs and users
Definition gui_result.h:28
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
Per-element overrides of style layout properties.
Definition gui_constraints.h:150
LayoutOverride & Centered() &
Centered in the parent on both axes.
Definition gui_constraints.h:259
static LayoutOverride FixedSize(CssPx w, CssPx h)
Sizes in CSS px (scaled by the UI scale) or in Pixels (as they are); see gui_units....
Definition gui_constraints.h:184
LayoutOverride & NoGrow() &
Shorthands for FlexGrow(0) / FlexShrink(0).
Definition gui_constraints.h:322
static LayoutOverride Auto()
No overrides: everything comes from the style.
Definition gui_constraints.h:182