view

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2017 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EntersStage

func EntersStage(from, to, s Stage) bool

EntersStage returns true if from<s and to>=s.

func ExitsStage

func ExitsStage(from, to, s Stage) bool

ExitsStage returns true if from>=s and to<s.

Types

type Context

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

Context specifies the supporting context for building a View.

func (*Context) NewEmbed

func (ctx *Context) NewEmbed(key string) Embed

NewEmbed generates a new Embed for a given key. NewEmbed is a convenience around NewEmbed(ctx.NewId(key)).

func (*Context) NewId

func (ctx *Context) NewId(key string) matcha.Id

NewId generates a new identifier for a given key.

func (*Context) Path

func (ctx *Context) Path() []matcha.Id

func (*Context) Prev

func (ctx *Context) Prev(key string) View

Prev returns the view returned by the last call to Build with the given key.

func (*Context) PrevModel

func (ctx *Context) PrevModel() *Model

PrevModel returns the last result of View.Build().

func (*Context) WithPrefix

func (ctx *Context) WithPrefix(key string) *Context

WithPrefix returns a new Context. Calls to this Prev and NewId on this context will be prepended with key.

type Embed

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

Embed is a convenience struct that provides a default implementation of View. It also wraps a comm.Relay.

func NewEmbed

func NewEmbed(id matcha.Id) Embed

NewEmbed creates a new Embed with the given Id.

func (*Embed) Build

func (e *Embed) Build(ctx *Context) Model

Build is an empty implementation of View's Build method.

func (*Embed) Id

func (e *Embed) Id() matcha.Id

Id returns the id passed into NewEmbed

func (*Embed) Lifecycle

func (e *Embed) Lifecycle(from, to Stage)

Lifecycle is an empty implementation of View's Lifecycle method.

func (*Embed) Notify

func (e *Embed) Notify(f func()) comm.Id

Notify calls Notify(id) on the underlying comm.Relay.

func (*Embed) Signal

func (e *Embed) Signal()

Update calls Signal() on the underlying comm.Relay.

func (*Embed) Subscribe

func (e *Embed) Subscribe(n comm.Notifier)

Subscribe calls Subscribe(n) on the underlying comm.Relay.

func (*Embed) Unnotify

func (e *Embed) Unnotify(id comm.Id)

Unnotify calls Unnotify(id) on the underlying comm.Relay.

func (*Embed) Unsubscribe

func (e *Embed) Unsubscribe(n comm.Notifier)

Unsubscribe calls Unsubscribe(n) on the underlying comm.Relay.

type Model

type Model struct {
	Children []View
	Layouter layout.Layouter
	Painter  paint.Painter
	Options  []Option

	NativeViewName  string
	NativeViewState proto.Message
	NativeValues    map[string]proto.Message
	NativeFuncs     map[string]interface{}
}

Model describes the view and its children.

type Option

type Option interface {
	OptionsKey() string
}

type Root

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

func NewRoot

func NewRoot(v View) *Root

NewRoot initializes a Root with screen s.

func (*Root) Call

func (r *Root) Call(funcId string, viewId int64, args []reflect.Value) []reflect.Value

func (*Root) Id

func (r *Root) Id() int64

Id returns the unique identifier for r.

func (*Root) SetSize

func (r *Root) SetSize(p layout.Point)

SetSize sets the size of r.

func (*Root) Size

func (r *Root) Size() layout.Point

Size returns the size of r.

func (*Root) Stop

func (r *Root) Stop()

func (*Root) ViewId

func (r *Root) ViewId() matcha.Id

type Stage

type Stage int
const (
	// StageDead marks views that are not attached to the view hierarchy.
	StageDead Stage = iota
	// StageMounted marks views that are in the view hierarchy but not visible.
	StageMounted
	// StageVisible marks views that are in the view hierarchy and visible.
	StageVisible
)

type View

type View interface {
	Build(*Context) Model
	Lifecycle(from, to Stage)
	Id() matcha.Id
	comm.Notifier
}

func WithOptions

func WithOptions(v View, opts []Option) View

WithOptions wraps the view v, and adds the given options to its Model.Options.

func WithPainter

func WithPainter(v View, p paint.Painter) View

WithPainter wraps the view v, and replaces its Model.Painter with p.

Directories

Path Synopsis
Package alert implements basic alerts.
Package alert implements basic alerts.
Package basicview implements an empty view.
Package basicview implements an empty view.
Package button implements a native button view.
Package button implements a native button view.
Package button implements a view that can display an image.
Package button implements a view that can display an image.
Package button implements a native progress view.
Package button implements a native progress view.
Package button implements a native scroll view.
Package button implements a native scroll view.
Package segmentview implements a native segmented control.
Package segmentview implements a native segmented control.
Package segmentview implements a native slider.
Package segmentview implements a native slider.
Package switchview implements a native switch.
Package switchview implements a native switch.
Package urlimageview implements a view which loads and displays an image.
Package urlimageview implements a view which loads and displays an image.

Jump to

Keyboard shortcuts

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