core/splitview/painter.go

Functions Structs Interfaces

Functions

func PaintDivider

PaintDivider renders a minimal divider with a center handle.

func (p DefaultPainter) PaintDivider(canvas widget.Canvas, ps PaintState) {
	if ps.DividerRect.IsEmpty() {
		return
	}

	// Draw divider background.
	bgColor := resolveDividerColor(ps)
	canvas.DrawRect(ps.DividerRect, bgColor)

	// Draw center handle indicator (a small line/dot in the middle).
	handleColor := defaultHandleColor
	hasScheme := ps.ColorScheme != (DividerColorScheme{})
	if hasScheme {
		handleColor = ps.ColorScheme.Handle
	}

	paintHandle(canvas, ps.DividerRect, ps.Orientation, handleColor)
}

Structs

type PaintState struct

PaintState provides the current divider state to the painter.

type PaintState struct {
	// DividerRect is the bounding rectangle of the divider area.
	DividerRect	geometry.Rect

	// Orientation is the split orientation (Horizontal or Vertical).
	Orientation	Orientation

	// Hovered indicates that the mouse is over the divider.
	Hovered	bool

	// Dragging indicates that the divider is currently being dragged.
	Dragging	bool

	// Collapsed indicates that the first panel is collapsed.
	Collapsed	bool

	// ColorScheme provides theme-derived colors for divider painting.
	// Zero value means the painter should use its built-in defaults.
	ColorScheme	DividerColorScheme
}

type DividerColorScheme struct

DividerColorScheme provides theme-derived colors for divider painting.

Zero value means the painter should use its built-in defaults.

type DividerColorScheme struct {
	Divider		widget.Color	// divider background
	DividerHover	widget.Color	// divider background when hovered
	DividerDrag	widget.Color	// divider background when dragging
	Handle		widget.Color	// center handle indicator
}

type DefaultPainter struct

DefaultPainter provides a minimal fallback painter with no design system styling.

It draws a simple divider line with a center handle indicator.

type DefaultPainter struct{}

Interfaces

type Painter interface

Painter draws the visual representation of the split view divider.

Each design system (Material 3, Fluent, Cupertino) provides its own

Painter implementation to render the divider in its visual style.

 

If no Painter is set, the split view uses [DefaultPainter].

type Painter interface {
	PaintDivider(canvas widget.Canvas, state PaintState)
}