Documentation
¶
Overview ¶
Package docked arranges widgets in dockable panels.
Group, LockedGroup, and Split build a tree of tabbed panels. NewRoot shows that tree and lets the user drag panels to redock them. Root can save and restore the arrangement as JSON. PaneView is a separate vertical stack of collapsible panes.
Index ¶
- type Direction
- type Node
- type Pane
- type PaneView
- func (pv *PaneView) AddPane(pane *Pane)
- func (pv *PaneView) Build(context *guigui.Context, adder *guigui.ChildAdder) error
- func (pv *PaneView) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, ...)
- func (pv *PaneView) Len() int
- func (pv *PaneView) Measure(context *guigui.Context, constraints guigui.Constraints) image.Point
- func (pv *PaneView) RemovePane(index int) *Pane
- func (pv *PaneView) WriteStateKey(context *guigui.Context, w *guigui.StateKeyWriter)
- type Panel
- type Position
- type Root
- func (r *Root) Add(node, target *Node, position Position) bool
- func (r *Root) ApplyJSON(data []byte) error
- func (r *Root) Build(context *guigui.Context, adder *guigui.ChildAdder) error
- func (r *Root) Contains(node *Node) bool
- func (r *Root) ContentAt(p image.Point) guigui.Widget
- func (r *Root) CursorShape(context *guigui.Context, widgetBounds *guigui.WidgetBounds) (ebiten.CursorShapeType, bool)
- func (r *Root) Draw(context *guigui.Context, widgetBounds *guigui.WidgetBounds, dst *ebiten.Image)
- func (r *Root) HandlePointingInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
- func (r *Root) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, ...)
- func (r *Root) MarshalJSON() ([]byte, error)
- func (r *Root) Remove(node *Node) bool
- func (r *Root) ReplaceTree(node *Node)
- func (r *Root) SelectedContent(node *Node) guigui.Widget
- func (r *Root) SetEdgeBar(position Position, nodes ...*Node)
- func (r *Root) SetOnPanelClosed(f func(*Node))
- func (r *Root) WriteStateKey(context *guigui.Context, w *guigui.StateKeyWriter)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Node ¶
type Node struct {
ID string
// contains filtered or unexported fields
}
func Group ¶
Group creates a named leaf node containing panels. ID must be stable across application runs when the node participates in layout serialization.
func LockedGroup ¶
LockedGroup creates a named leaf node like Group, but one whose panels can never be dragged out, removed, or covered by another node's panels tabbed in via a drag. Use it for content that must always stay visible, such as a fixed viewport docked among otherwise rearrangeable panels. Other nodes can still be docked to its Left, Right, Top, or Bottom.
type Pane ¶
type Pane struct {
Title string
Content guigui.Widget
Expanded bool
MinBodySize int
MaxBodySize int
}
Pane is a data-only descriptor for a single collapsible panel within a PaneView. It is not a widget — the PaneView owns the rendering and input.
type PaneView ¶
type PaneView struct {
guigui.DefaultWidget
// contains filtered or unexported fields
}
PaneView is a vertical stack of collapsible panes with headers, similar to dockview's PaneView. Each pane has a header that is always visible; clicking it toggles the body content.
func (*PaneView) Layout ¶
func (pv *PaneView) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)
func (*PaneView) RemovePane ¶
func (*PaneView) WriteStateKey ¶
func (pv *PaneView) WriteStateKey(context *guigui.Context, w *guigui.StateKeyWriter)
type Panel ¶
Panel is a unit of dockable content. Title labels the panel's tab, and Content is the widget shown while the panel is the active tab of its group.
type Root ¶
type Root struct {
guigui.DefaultWidget
// contains filtered or unexported fields
}
Root is a docking layout. Register every leaf with NewRoot, including leaves that start hidden, then add the root to the widget tree.
func (*Root) ApplyJSON ¶
ApplyJSON validates and applies a layout snapshot atomically. Every node ID in the JSON must be registered with this Root; absent registered nodes remain absent from the restored layout.
func (*Root) CursorShape ¶
func (r *Root) CursorShape(context *guigui.Context, widgetBounds *guigui.WidgetBounds) (ebiten.CursorShapeType, bool)
func (*Root) HandlePointingInput ¶
func (r *Root) HandlePointingInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
func (*Root) Layout ¶
func (r *Root) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)
func (*Root) MarshalJSON ¶
func (*Root) ReplaceTree ¶
ReplaceTree swaps the docking tree. Used to enter play mode (emulator only) or restore a debug layout without recreating registered nodes. Edge bars are cleared; call Root.SetEdgeBar afterwards if needed.
func (*Root) SetEdgeBar ¶
SetEdgeBar docks nodes as a sticky tab strip on the Left or Right edge. Nodes already in the tree are moved onto the bar. Other Position values are ignored. Nil nodes are skipped.
func (*Root) SetOnPanelClosed ¶
func (*Root) WriteStateKey ¶
func (r *Root) WriteStateKey(context *guigui.Context, w *guigui.StateKeyWriter)