view

package
v0.0.0-...-0e6b51b Latest Latest
Warning

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

Go to latest
Published: May 11, 2020 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddElementConstructor

func AddElementConstructor(name string, constructor IElementConstructor)

func Draw

func Draw(view IView, canvas canvas.Canvas, element IElement)

func Edge

func Edge(e IElement, view IView, key string) (float64, float64, float64, float64)

func Layout

func Layout(view IView, element IElement)

Types

type Drawable

type Drawable interface {
	Draw(view IView, canvas canvas.Canvas)
}

type Element

type Element struct {
	// contains filtered or unexported fields
}

func (*Element) After

func (E *Element) After(e IElement)

func (*Element) Append

func (E *Element) Append(e IElement)

func (*Element) Attributes

func (E *Element) Attributes() map[string]interface{}

func (*Element) Before

func (E *Element) Before(e IElement)

func (*Element) FirstChild

func (E *Element) FirstChild() IElement

func (*Element) Get

func (E *Element) Get(key string) interface{}

func (*Element) Id

func (E *Element) Id() int64

func (*Element) LastChild

func (E *Element) LastChild() IElement

func (*Element) Name

func (E *Element) Name() string

func (*Element) NextSibling

func (E *Element) NextSibling() IElement

func (*Element) Parent

func (E *Element) Parent() IElement

func (*Element) PrevSibling

func (E *Element) PrevSibling() IElement

func (*Element) Remove

func (E *Element) Remove()

func (*Element) Set

func (E *Element) Set(key string, v interface{})

func (*Element) SetId

func (E *Element) SetId(v int64)

func (*Element) SetName

func (E *Element) SetName(v string)

type IElement

type IElement interface {
	Id() int64
	Name() string
	Get(key string) interface{}
	Set(key string, value interface{})
	Attributes() map[string]interface{}
	FirstChild() IElement
	LastChild() IElement
	NextSibling() IElement
	PrevSibling() IElement
	Append(e IElement)
	Before(e IElement)
	After(e IElement)
	Parent() IElement
	Remove()
	// contains filtered or unexported methods
}

func NewElement

func NewElement(id int64, name string) IElement

type IElementConstructor

type IElementConstructor = func(id int64, name string) IElement

type ILayout

type ILayout interface {
	Layout(view IView)
}

type IView

type IView interface {
	CreateElement(name string) IElement
	DeleteElement(id int64)
	GetElement(id int64) IElement
	Set(id int64, key string, value interface{})
	SetSize(width float64, height float64)
	SetUnit(name string, scale float64, base float64)
	Width() float64
	Height() float64
	Calculate(v string, base float64, defaultValue float64) float64
	Layout(id int64)
	Draw(id int64, canvas canvas.Canvas)
	Provider() IViewProvider
}

type IViewElement

type IViewElement interface {
	IElement
	X() float64
	Y() float64
	Width() float64
	Height() float64
	ContentWidth() float64
	ContentHeight() float64
	SetX(v float64)
	SetY(v float64)
	SetWidth(v float64)
	SetHeight(v float64)
	SetContentWidth(v float64)
	SetContentHeight(v float64)
}

type IViewProvider

type IViewProvider interface {
	GetImage(src string) image.Image
	GetFont(v string) font.Face
}

type TextElement

type TextElement struct {
	ViewElement
	// contains filtered or unexported fields
}

func (*TextElement) Draw

func (E *TextElement) Draw(view IView, canvas canvas.Canvas)

func (*TextElement) Layout

func (E *TextElement) Layout(view IView)

type View

type View struct {
	// contains filtered or unexported fields
}

func NewView

func NewView() *View

func (*View) Calculate

func (V *View) Calculate(v string, base float64, defaultValue float64) float64

func (*View) CreateElement

func (V *View) CreateElement(name string) IElement

func (*View) DeleteElement

func (V *View) DeleteElement(id int64)

func (*View) Draw

func (V *View) Draw(id int64, canvas canvas.Canvas)

func (*View) GetElement

func (V *View) GetElement(id int64) IElement

func (*View) Height

func (V *View) Height() float64

func (*View) Layout

func (V *View) Layout(id int64)

func (*View) Provider

func (V *View) Provider() IViewProvider

func (*View) Set

func (V *View) Set(id int64, key string, value interface{})

func (*View) SetProvider

func (V *View) SetProvider(v IViewProvider)

func (*View) SetSize

func (V *View) SetSize(width float64, height float64)

func (*View) SetUnit

func (V *View) SetUnit(name string, scale float64, base float64)

func (*View) Width

func (V *View) Width() float64

type ViewElement

type ViewElement struct {
	Element
	// contains filtered or unexported fields
}

func (*ViewElement) ContentHeight

func (E *ViewElement) ContentHeight() float64

func (*ViewElement) ContentWidth

func (E *ViewElement) ContentWidth() float64

func (*ViewElement) Draw

func (E *ViewElement) Draw(view IView, canvas canvas.Canvas)

func (*ViewElement) Height

func (E *ViewElement) Height() float64

func (*ViewElement) Layout

func (E *ViewElement) Layout(view IView)

func (*ViewElement) SetContentHeight

func (E *ViewElement) SetContentHeight(v float64)

func (*ViewElement) SetContentWidth

func (E *ViewElement) SetContentWidth(v float64)

func (*ViewElement) SetHeight

func (E *ViewElement) SetHeight(v float64)

func (*ViewElement) SetWidth

func (E *ViewElement) SetWidth(v float64)

func (*ViewElement) SetX

func (E *ViewElement) SetX(v float64)

func (*ViewElement) SetY

func (E *ViewElement) SetY(v float64)

func (*ViewElement) Width

func (E *ViewElement) Width() float64

func (*ViewElement) X

func (E *ViewElement) X() float64

func (*ViewElement) Y

func (E *ViewElement) Y() float64

type ViewUnit

type ViewUnit struct {
	Scale float64
	Base  float64
}

Jump to

Keyboard shortcuts

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