GGDockSpace class
#include <GGUI/Public/UIDock.h>
GGDockSpace: the registered panels and their current layout, across all dock windows.
Not thread-safe. Touch it only from the update of a document that shows it.
Public types
- struct WindowInfo
- A floating window, as the host makes it.
- struct PanelInfo
- A registered panel, for menus.
Public static variables
- static std::string_view DefaultName constexpr
- the layout set in code
Constructors, destructors, conversion operators
- GGDockSpace()
- No panels, and an empty layout.
- ~GGDockSpace()
- GGDockSpace(const GGDockSpace&) deleted
Public functions
- auto operator=(const GGDockSpace&) -> GGDockSpace& deleted
- void Panel(const GGPanel& panel, ComponentFn content)
- Register a panel's content. Registering again replaces it.
- void Panel(const GGPanel& panel, const PanelProps& props, ComponentFn content)
- The same, with how it behaves.
- void SetDefault(const GGDockLayout& layout)
- The built-in layout. Also applied immediately if no other layout has been applied yet.
- void Reset()
- Go back to the default layout.
- auto IsOpen(const GGPanel& panel) const -> bool
- Whether
panelis in the layout. - void Show(const GGPanel& panel)
- Open the panel (in the main window's first tab group), or activate it if already open.
- void Close(const GGPanel& panel)
- Take the panel out of the layout.
- void Toggle(const GGPanel& panel)
- Close it if open, show it if not.
- void Move(const GGPanel& panel, const GGPanel& beside, GGDockSide side)
- Move a panel into
beside'stab group, or split that group onside. - auto Float(const GGPanel& panel, float width = 0.0f, float height = 0.0f) -> uint32_t
- Tear a panel off into its own window. Returns the window's key; the host opens the OS window.
- auto FloatAt(uint64_t panel, float x, float y, bool bPlaced) -> uint32_t
- The same, at a screen position (a tab dropped outside every window);
bPlacedfalse lets the host place it. - void CloseWindow(uint32_t key)
- Close the window and every panel in it.
- auto FloatingWindows() const -> std::vector<WindowInfo>
- Every window except the main one. The host reconciles OS windows against this.
- void SetWindowPlace(uint32_t key, float x, float y, float width, float height)
- Record where the OS actually put a window, so the layout saves it.
- void SetAbove(uint32_t key, bool bAbove)
- Whether window
keystays above the main window. - auto SaveAs(std::string_view name) -> bool
- Save the current layout under
name, replacing any with that name. Fails for "Default". - auto Use(std::string_view name) -> bool
- Apply the layout named
name. False if there is none. - auto Remove(std::string_view name) -> bool
- Forget the layout named
name. False for "Default", or one that isn't there. - auto Layouts() const -> std::vector<std::string>
- Layout names, "Default" first.
- auto Current() const -> std::string_view
- Name of the layout last used or saved. The live layout may have been edited since.
- auto Capture() const -> GGDockLayout
- The layout as it is now.
- void Apply(const GGDockLayout& layout)
- Arrange the panels as
layoutsays. - auto Save() const -> std::string
- Every layout as text (format at the top of this file).
- auto Load(std::string_view text, std::string* problems = nullptr) -> uint32_t
- Read layouts from
text, as Save writes them, and return how many were read. - void Maximize(uint64_t panel)
- Show
panel'stab group alone in its window until Maximize(0) or the layout changes. Not saved with the layout. - auto Maximized() const -> uint64_t
- The panel shown alone; 0 if none.
- auto Pointed() const -> uint64_t
- The front panel of the tab group the pointer was last over; 0 before it has been over one.
- auto Panels() const -> std::vector<PanelInfo>
- Registered panels, sorted by title. For menus.
- void Show(uint64_t panel)
- Show, by ID.
- void Close(uint64_t panel)
- Close, by ID.
- auto Arranged() const -> uint64_t
- Incremented each time a whole layout is applied. The host uses it to snap windows to the layout's saved positions.
- auto Changed() const -> const GGRevision&
- Bumped on any structural change; ui.Dock rebuilds on it.
- auto Digest() const -> uint64_t
- Hash of everything Save() writes. Changes when the saved text would.
- auto GroupCount(uint32_t window = 0) const -> uint32_t
- How many tab groups window
windowhas (0: the main one). For tools and tests. - auto GroupPanels(uint32_t group, uint32_t window = 0) const -> std::vector<std::string>
- The panel names of tab group
groupof windowwindow, groups counted depth first. For tools and tests.
Function documentation
uint32_t GGUI:: GGDockSpace:: Load(std::string_view text,
std::string* problems = nullptr)
Read layouts from text, as Save writes them, and return how many were read.
A block that fails to parse is reported in problems and skipped; with no valid current block, the default layout is applied.