widget

package
v0.0.0-...-ba0b20d Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 27, 2026 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseWidget

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

BaseWidget provides common functionality for widgets.

func NewBaseWidget

func NewBaseWidget() BaseWidget

NewBaseWidget creates a new base widget.

func (*BaseWidget) Bounds

func (w *BaseWidget) Bounds() core.Rect

Bounds returns the widget's bounds.

func (*BaseWidget) IsDirty

func (w *BaseWidget) IsDirty() bool

IsDirty returns true if the widget needs to be redrawn.

func (*BaseWidget) IsFocused

func (w *BaseWidget) IsFocused() bool

IsFocused returns true if the widget has focus.

func (*BaseWidget) IsVisible

func (w *BaseWidget) IsVisible() bool

IsVisible returns true if the widget is visible.

func (*BaseWidget) MarkClean

func (w *BaseWidget) MarkClean()

MarkClean marks the widget as not needing a redraw.

func (*BaseWidget) MarkDirty

func (w *BaseWidget) MarkDirty()

MarkDirty marks the widget as needing a redraw.

func (*BaseWidget) MinSize

func (w *BaseWidget) MinSize() core.Point

MinSize returns the minimum size the widget needs.

func (*BaseWidget) SelfDirty

func (w *BaseWidget) SelfDirty() bool

SelfDirty returns true if the widget itself needs a redraw. Containers can use this to distinguish their own dirty state from children.

func (*BaseWidget) SetBounds

func (w *BaseWidget) SetBounds(r core.Rect)

SetBounds sets the widget's bounds.

func (*BaseWidget) SetFocused

func (w *BaseWidget) SetFocused(focused bool)

SetFocused sets the focus state of the widget.

func (*BaseWidget) SetMinSize

func (w *BaseWidget) SetMinSize(size core.Point)

SetMinSize sets the minimum size for the widget.

func (*BaseWidget) SetVisible

func (w *BaseWidget) SetVisible(visible bool)

SetVisible sets the visibility of the widget.

type TextAlign

type TextAlign int

TextAlign represents text alignment.

const (
	AlignLeft TextAlign = iota
	AlignCenter
	AlignRight
)

type Widget

type Widget interface {
	Draw(buf *core.Buffer)
	Bounds() core.Rect
	SetBounds(r core.Rect)
	MinSize() core.Point
	HandleEvent(ev input.Event) bool
	SetFocused(focused bool)
	IsFocused() bool
	IsDirty() bool
	MarkClean()
	SetVisible(visible bool)
	IsVisible() bool
}

Widget is the interface that all widgets must implement.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL