core/docking/painter.go
Functions
func PaintZoneBorder
func (p DefaultPainter) PaintZoneBorder(canvas widget.Canvas, borderRect geometry.Rect, _ Zone) {
if borderRect.IsEmpty() {
return
}
canvas.DrawRect(borderRect, defaultZoneBorderColor)
}
func PaintZoneTabs
PaintZoneTabs renders a minimal tab header bar for a zone.
func (p DefaultPainter) PaintZoneTabs(canvas widget.Canvas, ps ZoneTabsPaintState) {
if ps.TabBarBounds.IsEmpty() {
return
}
hasScheme := ps.ColorScheme != (ZoneColorScheme{})
// Tab bar background.
bg := defaultTabBarBgColor
if hasScheme {
bg = ps.ColorScheme.TabBarBackground
}
canvas.DrawRect(ps.TabBarBounds, bg)
// Draw each tab.
for i := range ps.Tabs {
ts := &ps.Tabs[i]
paintDefaultZoneTab(canvas, ts, hasScheme, ps.ColorScheme)
}
// Draw indicator under active tab.
if ps.ActiveIdx >= 0 && ps.ActiveIdx < len(ps.Tabs) {
active := &ps.Tabs[ps.ActiveIdx]
indicatorBounds := geometry.NewRect(
active.Bounds.Min.X,
active.Bounds.Max.Y-zoneIndicatorHeight,
active.Bounds.Width(),
zoneIndicatorHeight,
)
indicatorColor := defaultZoneIndicatorColor
if hasScheme {
indicatorColor = ps.ColorScheme.ActiveTabBackground
}
canvas.DrawRect(indicatorBounds, indicatorColor)
}
}
Structs
type ZoneTabsPaintState struct
ZoneTabsPaintState provides the current zone tab bar state to the painter.
type ZoneTabsPaintState struct {
// Zone identifies which zone this tab bar belongs to.
Zone Zone
// TabBarBounds is the tab bar area.
TabBarBounds geometry.Rect
// Tabs contains the state of each tab in the zone.
Tabs []ZoneTabState
// ActiveIdx is the index of the currently active tab.
ActiveIdx int
// ColorScheme provides theme-derived colors for painting.
// Zero value means the painter should use its built-in defaults.
ColorScheme ZoneColorScheme
}
type ZoneTabState struct
ZoneTabState provides the state of a single tab within a zone.
type ZoneTabState struct {
// Title is the panel's display text.
Title string
// Bounds is the tab's clickable area within the tab bar.
Bounds geometry.Rect
// Active is true when this tab is the currently selected tab.
Active bool
// Hovered is true when the mouse is over this tab.
Hovered bool
// Closeable is true when this tab shows a close button.
Closeable bool
// CloseButtonBounds is the clickable area for the close button.
// Empty if not closeable.
CloseButtonBounds geometry.Rect
}
type ZoneColorScheme struct
ZoneColorScheme provides theme-derived colors for zone painting.
Zero value means the painter should use its built-in defaults.
type ZoneColorScheme struct {
TabBarBackground widget.Color
ActiveTabText widget.Color
InactiveTabText widget.Color
ActiveTabBackground widget.Color
HoverBackground widget.Color
Border widget.Color
CloseButton widget.Color
}
type DefaultPainter struct
DefaultPainter provides a minimal fallback painter with no design system styling.
It draws simple tab headers and zone borders suitable for testing and prototyping.
type DefaultPainter struct{}
Interfaces
type Painter interface
Painter draws the visual representation of the docking system.
Each design system (Material 3, Fluent, Cupertino) provides its own
Painter implementation to render zone borders and tab headers.
If no Painter is set, the host uses [DefaultPainter].
type Painter interface {
// PaintZoneTabs renders the tab header bar for a zone group.
PaintZoneTabs(canvas widget.Canvas, state ZoneTabsPaintState)
// PaintZoneBorder renders the border between a zone and the center.
PaintZoneBorder(canvas widget.Canvas, borderRect geometry.Rect, zone Zone)
}
PaintZoneBorder renders a simple 1px border between a zone and the center.