avyos.dev/pkg/graphics/widget
package widget
Overview
No package-level documentation is provided.
| Export Group | Count |
|---|---|
| Constants | 0 |
| Variables | 0 |
| Functions | 0 |
| Types | 3 |
Types
BaseWidget
type BaseWidget struct {
// contains filtered or unexported fields
}BaseWidget provides common functionality for widgets.
Functions
NewBaseWidget
func NewBaseWidget() BaseWidgetNewBaseWidget creates a new base widget.
Methods
Bounds
func (w *BaseWidget) Bounds() image.RectangleBounds returns the widget's bounds.
IsDirty
func (w *BaseWidget) IsDirty() boolIsDirty returns true if the widget needs to be redrawn.
IsFocused
func (w *BaseWidget) IsFocused() boolIsFocused returns true if the widget has focus.
IsVisible
func (w *BaseWidget) IsVisible() boolIsVisible returns true if the widget is visible.
MarkClean
func (w *BaseWidget) MarkClean()MarkClean marks the widget as not needing a redraw.
MarkDirty
func (w *BaseWidget) MarkDirty()MarkDirty marks the widget as needing a redraw.
MinSize
func (w *BaseWidget) MinSize() image.PointMinSize returns the minimum size the widget needs.
SelfDirty
func (w *BaseWidget) SelfDirty() boolSelfDirty returns true if the widget itself needs a redraw. Containers can use this to distinguish their own dirty state from children.
SetBounds
func (w *BaseWidget) SetBounds(r image.Rectangle)SetBounds sets the widget's bounds.
SetFocused
func (w *BaseWidget) SetFocused(focused bool)SetFocused sets the focus state of the widget.
SetMinSize
func (w *BaseWidget) SetMinSize(size image.Point)SetMinSize sets the minimum size for the widget.
SetVisible
func (w *BaseWidget) SetVisible(visible bool)SetVisible sets the visibility of the widget.
TextAlign
type TextAlign intTextAlign represents text alignment.
Constants
AlignLeft, AlignCenter, AlignRight
const (
AlignLeft TextAlign = iota
AlignCenter
AlignRight
)Widget
type Widget interface {
Draw(buf *core.Buffer)
Bounds() image.Rectangle
SetBounds(r image.Rectangle)
MinSize() image.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.