ui

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeLeftClick = iota
	EventTypeRightClick
)

Variables

This section is empty.

Functions

func ParseColor

func ParseColor(s string) (color.Color, error)

func Print

func Print(d Drawable, prop string)

func StartCommand

func StartCommand(cmd string)

Types

type Context

type Context map[string]interface{}

func (Context) Has

func (c Context) Has(k string) bool

func (Context) MustColor

func (c Context) MustColor(n string) color.Color

func (Context) MustFloat

func (c Context) MustFloat(n string) float64

func (Context) MustInt

func (c Context) MustInt(n string) int

func (Context) MustString

func (c Context) MustString(n string) string

func (Context) New

func (c Context) New(vals Context) Context

type Drawable

type Drawable interface {
	Init() error
	SetContext(ctx Context)

	Width() int
	OnWidthChange(func(int))

	Height() int
	OnHeightChange(func(int))

	Visible() bool
	SetVisible(v bool)
	OnVisibleChange(func(bool))

	SendEvent(Event) bool

	Draw(x, y int, im draw.Image)
	Notify()

	Context() Context
}

type Event

type Event struct {
	Type EventType
	At   image.Point
}

type EventType

type EventType int

type ParentDrawable

type ParentDrawable interface {
	Drawable

	Add(Drawable)
	Children() []Drawable
	ChildContext(index int) Context
}

type Root

type Root struct {
	Inner Drawable
	// contains filtered or unexported fields
}

func NewRoot

func NewRoot(ctx Context, onNotify func()) *Root

func (*Root) Add

func (r *Root) Add(Drawable)

func (*Root) ChildContext

func (r *Root) ChildContext(int) Context

func (*Root) Children

func (r *Root) Children() []Drawable

func (*Root) Context

func (r *Root) Context() Context

func (*Root) Draw

func (r *Root) Draw(x, y int, im draw.Image)

func (*Root) Height

func (r *Root) Height() int

func (*Root) Image

func (r *Root) Image() *image.RGBA

func (*Root) Init

func (r *Root) Init() error

func (*Root) Notify

func (r *Root) Notify()

func (*Root) OnHeightChange

func (r *Root) OnHeightChange(func(int))

func (*Root) OnVisibleChange

func (r *Root) OnVisibleChange(func(bool))

func (*Root) OnWidthChange

func (r *Root) OnWidthChange(func(int))

func (*Root) Paint

func (r *Root) Paint()

func (*Root) SendEvent

func (r *Root) SendEvent(ev Event) bool

func (*Root) SetContext

func (r *Root) SetContext(Context)

func (*Root) SetVisible

func (r *Root) SetVisible(bool)

func (*Root) Visible

func (r *Root) Visible() bool

func (*Root) Width

func (r *Root) Width() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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