Documentation ¶
Index ¶
- Variables
- type Attribute
- type AttributeList
- type Base
- func (c *Base) AppendChild(component Component)
- func (c *Base) Bounds() Bounds
- func (c *Base) Children() ComponentList
- func (c *Base) ChildrenStr() (out string)
- func (c *Base) ClearFlags()
- func (c *Base) Draw()
- func (c *Base) FindChildIndex(component Component) int
- func (c *Base) InsertChild(component Component, index int) error
- func (c *Base) Parent() Component
- func (c *Base) PrependChild(component Component)
- func (c *Base) RemoveChild(component Component) error
- func (c *Base) RemoveChildByIndex(i int) error
- func (c *Base) Root() Component
- func (c *Base) SetBounds(bounds Bounds)
- func (c *Base) SetRedraw()
- func (c *Base) ShouldDraw() bool
- type Bounds
- type Component
- type ComponentList
- type ComponentProvider
- type Drawable
- type Position
- type Size
- type Text
Constants ¶
This section is empty.
Variables ¶
var ( ErrIndexOutOfBounds = errors.New("index out of bounds") ErrComponentNotFound = errors.New("component not found in list") )
Component handling errors
Functions ¶
This section is empty.
Types ¶
type Attribute ¶
type Attribute string
Attribute is a single componment attribute
type AttributeList ¶
AttributeList is a list of attributes for a component, divided by key
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
Base is the common parent of all components
func (*Base) AppendChild ¶
AppendChild adds a component at the end of the list
func (*Base) Children ¶
func (c *Base) Children() ComponentList
Children returns the list of all children components
func (*Base) ChildrenStr ¶
ChildrenStr calls String() on each children and indents the results
func (*Base) ClearFlags ¶
func (c *Base) ClearFlags()
func (*Base) FindChildIndex ¶
FindChildIndex finds a component's index in the list
func (*Base) InsertChild ¶
InsertChild inserts a component in one index of the list, moving all other components forward
func (*Base) PrependChild ¶
PrependChild inserts a component at the beginning of the list
func (*Base) RemoveChild ¶
RemoveChild removes a component from the list
func (*Base) RemoveChildByIndex ¶
RemoveChildByIndex removes the ith component from the list
func (*Base) ShouldDraw ¶
type Bounds ¶
func BoundsFromRect ¶
type Component ¶
type Component interface { Draw() ShouldDraw() bool Bounds() Bounds SetBounds(Bounds) Parent() Component Children() ComponentList Root() Component AppendChild(Component) InsertChild(Component, int) error PrependChild(Component) RemoveChild(Component) error FindChildIndex(Component) int RemoveChildByIndex(int) error // contains filtered or unexported methods }
Component is a renderable UI component that can optionally hold children
type ComponentList ¶
type ComponentList []Component
ComponentList is a modifiable, ordered list of components
type ComponentProvider ¶
type ComponentProvider func(AttributeList) (Component, error)
ComponentProvider is a function that takes a list of attributes and creates a component with the attributes applied
type Text ¶
type Text struct { Base // contains filtered or unexported fields }
Text is a common parent of all text-based components
func (*Text) ClearFlags ¶
func (c *Text) ClearFlags()