Documentation
¶
Overview ¶
Package dock provides a dockable tab and split layout widget.
Index ¶
- type Direction
- type Layout
- func (d *Layout) Add(node, target *Node, position Position) bool
- func (d *Layout) Build(context *guigui.Context, adder *guigui.ChildAdder) error
- func (d *Layout) Contains(node *Node) bool
- func (d *Layout) CursorShape(context *guigui.Context, widgetBounds *guigui.WidgetBounds) (ebiten.CursorShapeType, bool)
- func (d *Layout) Draw(context *guigui.Context, widgetBounds *guigui.WidgetBounds, dst *ebiten.Image)
- func (d *Layout) HandlePointingInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
- func (d *Layout) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, ...)
- func (d *Layout) Remove(node *Node) bool
- func (d *Layout) SetRoot(root *Node)
- func (d *Layout) WriteStateKey(context *guigui.Context, w *guigui.StateKeyWriter)
- 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 Layout ¶
type Layout struct {
guigui.DefaultWidget
// contains filtered or unexported fields
}
Layout arranges dockable panels in a nestable tree of groups (tabs) and splits. Dividers resize; dragging a tab re-docks it, either as another tab (center) or as a new group split onto an edge.
func (*Layout) Add ¶
Add adds node next to target at position. Center adds node's panels as tabs in target's current group. When the layout is empty, target may be nil and node becomes the root. It returns false when node is already present or the target is absent.
func (*Layout) CursorShape ¶
func (d *Layout) CursorShape(context *guigui.Context, widgetBounds *guigui.WidgetBounds) (ebiten.CursorShapeType, bool)
func (*Layout) HandlePointingInput ¶
func (d *Layout) HandlePointingInput(context *guigui.Context, widgetBounds *guigui.WidgetBounds) guigui.HandleInputResult
func (*Layout) Layout ¶
func (d *Layout) Layout(context *guigui.Context, widgetBounds *guigui.WidgetBounds, layouter *guigui.ChildLayouter)
func (*Layout) Remove ¶
Remove removes node's panels from the layout. It returns false when node is absent. The node remains reusable with a later Layout.Add call.
func (*Layout) WriteStateKey ¶
func (d *Layout) WriteStateKey(context *guigui.Context, w *guigui.StateKeyWriter)
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
}
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)