Documentation
¶
Overview ¶
Package splitpane provides SplitPane: two panes side by side (or one above the other) with a divider between them the user drags to share the space - a sidebar and an editor, an editor and a terminal.
Index ¶
- type Axis
- type SplitPane
- func (s *SplitPane) Axis(a Axis) *SplitPane
- func (s *SplitPane) Content(first, second func() elements.Element) *SplitPane
- func (s *SplitPane) DividerColor(c properties.Color) *SplitPane
- func (s *SplitPane) Dragging() bool
- func (s *SplitPane) FirstSize(dp float32) *SplitPane
- func (s *SplitPane) Layout(gtx layout.Context) layout.Dimensions
- func (s *SplitPane) MinSizes(first, second float32) *SplitPane
- func (s *SplitPane) OnResize(fn func(ratio, firstDp float32)) *SplitPane
- func (s *SplitPane) Ratio(r float32) *SplitPane
- func (s *SplitPane) Share() float32
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SplitPane ¶
type SplitPane struct {
// contains filtered or unexported fields
}
SplitPane is two panes with a divider between them. Create it once with New and lay it out every frame; it fills the space it's given.
By default the first pane takes Ratio of the space, and keeps that share as the space changes; FirstSize instead keeps the first pane's size in dp (a sidebar), the second taking the rest. Dragging the divider resizes; a double-click on it puts back the size it started with. The divider takes keyboard focus with Tab, and the arrow keys move it.
func New ¶
New returns a split pane showing first and second, each built every frame, the first taking half the space.
func (*SplitPane) Axis ¶
Axis sets how the panes are placed: Horizontal (side by side, the default) or Vertical. It returns s for chaining.
func (*SplitPane) DividerColor ¶
func (s *SplitPane) DividerColor(c properties.Color) *SplitPane
DividerColor sets the divider line's color; theme.border by default. It returns s for chaining.
func (*SplitPane) FirstSize ¶
FirstSize keeps the first pane dp wide (or tall), as a sidebar keeps its width when the window is resized; dragging changes it. It returns s for chaining.
func (*SplitPane) Layout ¶
func (s *SplitPane) Layout(gtx layout.Context) layout.Dimensions
Layout lays out the panes and the divider.
func (*SplitPane) MinSizes ¶
MinSizes sets how small, in dp, each pane may be dragged; 48dp by default. It returns s for chaining.
func (*SplitPane) OnResize ¶
OnResize sets a handler for the user moving the divider, with the first pane's share of the space and its size in dp: to remember them. It returns s for chaining.