Type ScrollArea

type ScrollArea struct {
	// contains filtered or unexported fields
}

ScrollArea paints the visible scrollbars around a caller-painted clipped viewport. The caller owns offsets and content extents. Scoped wheel routing, pointer capture, inertial scrolling, and scroll scheduling belong to the runtime and are intentionally not simulated here.

Constructors

BeginScrollArea#

func BeginScrollArea(canvas *ui.Canvas, theme ui.Theme, bounds ui.Rect, contentSize ui.Size) ScrollArea

BeginScrollArea declares a source-owned scroll area with explicit content extents. Content smaller than the viewport is expanded to the viewport.

Methods

BeginContent#

func (area *ScrollArea) BeginContent() ScrollAreaGeometry

BeginContent pushes the viewport clip and returns translated content geometry. Call EndContent after painting the caller-owned content.

Disabled#

func (area ScrollArea) Disabled() ScrollArea

Disabled preserves geometry and typed semantics while making both scrollbars inert.

EndContent#

func (area *ScrollArea) EndContent() ScrollAreaGeometry

EndContent closes the viewport clip and paints the visible scrollbars.

Geometry#

func (area ScrollArea) Geometry() ScrollAreaGeometry

Geometry returns clamped viewport, translated content, track, thumb, and corner geometry without painting or changing Canvas state.

HorizontalScrollbar#

func (area ScrollArea) HorizontalScrollbar(id ui.ID, label, value string) ScrollArea

HorizontalScrollbar assigns the stable action ID and accessibility strings for the horizontal thumb. ID zero keeps the visual geometry non-interactive.

Offset#

func (area ScrollArea) Offset(x, y float32) ScrollArea

Offset sets the caller-owned horizontal and vertical scroll offsets.

ScrollForKey#

func (area ScrollArea) ScrollForKey(x, y float32, key ui.Key, step float32) (float32, float32, bool)

ScrollForKey applies the keyboard's scrolling to the caller-owned offsets: Left/Right move horizontally, Up/Down vertically, PageUp/PageDown by a viewport, and Home/End to the start and end vertically. step is the arrow step (32 pixels when non-positive). It returns the new offsets and whether the key belongs to the scroll area.

VerticalScrollbar#

func (area ScrollArea) VerticalScrollbar(id ui.ID, label, value string) ScrollArea

VerticalScrollbar assigns the stable action ID and accessibility strings for the vertical thumb. ID zero keeps the visual geometry non-interactive.

Viewport#

func (area ScrollArea) Viewport(id ui.ID, label string) ScrollArea

Viewport makes the scrollable content a focusable group of id, so the keyboard can reach the area and ScrollForKey can move it. Content controls painted after BeginContent keep their own hits and win the press.