Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cache ¶
type Cache[T Renderable] struct { // contains filtered or unexported fields }
Cache define a Renderable wrapper that adds caching to it. At the moment only layout.Layout is cached as terminal screen is cleared on every render.
func NewCache ¶
func NewCache[T Renderable](renderable T) Cache[T]
NewCache returns a new Cache that wraps the given Renderable.
type ComposedRenderable ¶
type ComposedRenderable struct { VoidRenderable LayoutLayout draw.Drawer }
ComposedRenderable define a Renderable composed of a VoidRenderable, a layout.Layout and a draw.Drawer.
func NewComposedRenderable ¶
func NewComposedRenderable(layout layout.Layout, drawer draw.Drawer) *ComposedRenderable
func (*ComposedRenderable) Draw ¶
func (cr *ComposedRenderable) Draw(surface draw.Surface)
Draw implements Renderable.
func (*ComposedRenderable) Layout ¶
func (cr *ComposedRenderable) Layout(co layout.Constraint) geometry.Size
Layout implements Renderable.
func (*ComposedRenderable) Renderable ¶
func (cr *ComposedRenderable) Renderable() Renderable
Renderable implements render.RenderableAccessor.
type LayoutLayout ¶
type Renderable ¶
type Renderable interface { layout.Layout draw.Drawer // IsDirty return whether renderable needs to be rendered. IsDirty() bool // MarkDirty marks the renderable as dirty. It a tree of renderable, // implementation may also mark all ancestor of a node as dirty. MarkDirty() }
Renderable define any object that can be rendered.
type RenderableAccessor ¶
type RenderableAccessor interface {
Renderable() Renderable
}
RenderableAccessor define any object owning a Renderable.
type VoidRenderable ¶
type VoidRenderable struct {
// contains filtered or unexported fields
}
VoidRenderable define a minimal renderable with a size of zero. It handles efficiently dirty state management and is ideal for embedding into more complex renderable.
func NewVoidRenderable ¶
func NewVoidRenderable(target events.Target) VoidRenderable
NewVoidRenderable returns a new VoidRenderable.
func (*VoidRenderable) Draw ¶
func (vr *VoidRenderable) Draw(draw.Surface)
Draw implements Renderable. VoidRenderable doesn't draw anything but change it's internal state to clean (not dirty).
func (*VoidRenderable) IsDirty ¶
func (vr *VoidRenderable) IsDirty() bool
IsDirty implements Renderable.
func (*VoidRenderable) Layout ¶
func (*VoidRenderable) Layout(layout.Constraint) geometry.Size
Layout implements Renderable. VoidRenderable always return a size of 0.
func (*VoidRenderable) MarkDirty ¶
func (vr *VoidRenderable) MarkDirty()
MarkDirty implements Renderable.
func (*VoidRenderable) Renderable ¶
func (vr *VoidRenderable) Renderable() Renderable
Renderable implements RenderableAccessor.