gui

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2020 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const Inset = 50

Variables

This section is empty.

Functions

This section is empty.

Types

type Area

type Area interface {
	Rect() f32.Rectangle
	Expand(halo int) image.Rectangle
	Size(inset int) image.Point
}

Area is the main abstraction for any object taking up or actively tracking some space on the canvas

type DrawItem

type DrawItem interface {
	Draw(gtx *layout.Context, th *material.Theme) error
}

DrawItem represents an elements that can be drawn on the screen

type InteractiveElement

type InteractiveElement struct {
	Item
	Area
	// contains filtered or unexported fields
}

InteractiveElement is the base implementation of a dynamic element

func NewInteractiveElement

func NewInteractiveElement(rect *f32.Rectangle) *InteractiveElement

NewInteractiveElement creates a new dynamic element

func (*InteractiveElement) Enable

func (item *InteractiveElement) Enable(gtx *layout.Context, th *material.Theme) error

Enable adds the event handler for an interactive element

func (*InteractiveElement) Event

func (item *InteractiveElement) Event(gtx *layout.Context, e *pointer.Event) (f32.Point, bool, error)

Event propagates the scene event to the element

type InteractiveItem

type InteractiveItem interface {
	Event(gtx *layout.Context, e *pointer.Event) (f32.Point, bool, error)
	Enable(gtx *layout.Context, th *material.Theme) error
}

InteractiveItem represents an interactive UI element

type Item

type Item interface {
	ID() uint32
}

Item is the main abstraction for any object living within the canvas

type RawArea

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

RawItem is the base implementation for an Item

func Rect

func Rect(rect *f32.Rectangle) *RawArea

Rect creates a new raw element

func (*RawArea) Expand

func (area *RawArea) Expand(halo int) image.Rectangle

func (*RawArea) Rect

func (area *RawArea) Rect() f32.Rectangle

ID returns the id of the raw element

func (*RawArea) Size

func (area *RawArea) Size(inset int) image.Point

type RawItem

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

RawItem is the base implementation for an Item

func NewRawItem

func NewRawItem() *RawItem

NewRawItem creates a new raw element

func (*RawItem) ID

func (item *RawItem) ID() uint32

ID returns the id of the raw element

type Scene

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

Scene is the main container for the canvas objects

func New

func New() *Scene

func (Scene) Add

func (list Scene) Add(vv ...interface{}) func()

func (*Scene) Run

func (s *Scene) Run()

Run start the gui

func (*Scene) WithDimensions

func (s *Scene) WithDimensions(width, height float32) *Scene

WithDimensions defines the window dimensions

func (*Scene) WithTitle

func (s *Scene) WithTitle(title string) *Scene

WithTitle defines the window title

type View

type View struct {
	*layout.List
	// contains filtered or unexported fields
}

func NewView

func NewView(orientation layout.Axis) *View

func (*View) Add

func (list *View) Add(vv ...interface{}) func()

func (*View) Draw

func (v *View) Draw(gtx *layout.Context, th *material.Theme) error

func (*View) Event

func (v *View) Event(gtx *layout.Context, e *pointer.Event) (redraw bool, err error)

func (*View) WithMaxHeight

func (v *View) WithMaxHeight(height float32) *View

func (*View) WithMaxWidth

func (v *View) WithMaxWidth(width float32) *View

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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