ui

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2021 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventTypeLeftClick = iota
	EventTypeRightClick
	EventPointerMove
	EventPointerEnter
	EventPointerLeave
)

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

	OnLeftClick() func(Event) bool
	OnRightClick() func(Event) bool
	SetOnLeftClick(cb func(Event) bool)
	SetOnRightClick(cb func(Event) bool)
	OnPointerMove() func(Event) bool
	SetOnPointerMove(cb func(Event) bool)
	OnPointerEnter() func(Event) bool
	SetOnPointerEnter(cb func(Event) bool)
	OnPointerLeave() func(Event) bool
	SetOnPointerLeave(cb func(Event) bool)

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

	Context() Context
	Children() []Drawable
}

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) OnLeftClick added in v0.2.3

func (b *Root) OnLeftClick() func(Event) bool

func (*Root) OnPointerEnter added in v0.2.3

func (b *Root) OnPointerEnter() func(Event) bool

func (*Root) OnPointerLeave added in v0.2.3

func (b *Root) OnPointerLeave() func(Event) bool

func (*Root) OnPointerMove added in v0.2.3

func (b *Root) OnPointerMove() func(Event) bool

func (*Root) OnRightClick added in v0.2.3

func (b *Root) OnRightClick() func(Event) bool

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) SetOnLeftClick added in v0.2.3

func (b *Root) SetOnLeftClick(cb func(Event) bool)

func (*Root) SetOnPointerEnter added in v0.2.3

func (b *Root) SetOnPointerEnter(cb func(Event) bool)

func (*Root) SetOnPointerLeave added in v0.2.3

func (b *Root) SetOnPointerLeave(cb func(Event) bool)

func (*Root) SetOnPointerMove added in v0.2.3

func (b *Root) SetOnPointerMove(cb func(Event) bool)

func (*Root) SetOnRightClick added in v0.2.3

func (b *Root) SetOnRightClick(cb func(Event) bool)

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