common

package
v0.0.0-...-a5d0d41 Latest Latest
Warning

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

Go to latest
Published: Aug 8, 2023 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BoolError

func BoolError(message string, want, got bool) string

func IntError

func IntError(message string, want, got int) string

func PositionError

func PositionError(message string, want, got image.Point) string

func SizeError

func SizeError(message string, want, got Size) string

func StringError

func StringError(message, want, got string) string

Types

type BlockLayout

type BlockLayout struct{}

BlockLayout This layout does not manipulate any positions or sizes and just forwards the next child components for the layout phase

func (BlockLayout) ProcessLayout

func (l BlockLayout) ProcessLayout(comp Component) []*Component

type Component

type Component interface {
	Core() *Core
	Mount()
	Update()
	Destroy()
}

type ComponentEngine

type ComponentEngine struct{}

func (ComponentEngine) RecalculatePositions

func (e ComponentEngine) RecalculatePositions(rootComponent Component)

func (ComponentEngine) UpdateComponentTree

func (e ComponentEngine) UpdateComponentTree(rootComponent Component)

type Core

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

func NewCore

func NewCore() Core

func (*Core) AddChild

func (core *Core) AddChild(factory Factory) Component

func (*Core) ApplyColorProperty

func (core *Core) ApplyColorProperty(name string, color color.RGBA)

func (*Core) ApplyPixelProperty

func (core *Core) ApplyPixelProperty(name string, px int)

func (*Core) ApplyProperty

func (core *Core) ApplyProperty(prop theme.Property)

func (*Core) ApplyPropertyValue

func (core *Core) ApplyPropertyValue(name string, value string)

func (*Core) ApplyStyle

func (core *Core) ApplyStyle(name string)

func (*Core) CausesFrameRedraw

func (core *Core) CausesFrameRedraw() bool

func (*Core) Children

func (core *Core) Children() []*Component

func (*Core) DisplayType

func (core *Core) DisplayType() LayoutOptions

func (*Core) Events

func (core *Core) Events() *event.Queue

func (*Core) ForceFrameRedraw

func (core *Core) ForceFrameRedraw()

func (*Core) GetColorProperty

func (core *Core) GetColorProperty(name string, fallbackColor color.RGBA) color.RGBA

func (*Core) GetPixelProperty

func (core *Core) GetPixelProperty(name string) int

func (*Core) GetSize

func (core *Core) GetSize() Size

func (*Core) GetZ

func (core *Core) GetZ() int

func (*Core) IsVisible

func (core *Core) IsVisible() bool

func (*Core) Move

func (core *Core) Move(point image.Point)

func (*Core) MoveXY

func (core *Core) MoveXY(x int, y int)

func (*Core) OnRender

func (core *Core) OnRender(renderer func(bounds image.Rectangle, screen *ebiten.Image))

func (*Core) OnStyleChange

func (core *Core) OnStyleChange(listener StyleListener)

func (*Core) Position

func (core *Core) Position() image.Point

func (*Core) RemoveChild

func (core *Core) RemoveChild(child *Component)

func (*Core) Render

func (core *Core) Render(bounds image.Rectangle, screen *ebiten.Image)

func (*Core) ResolveFrameRedraw

func (core *Core) ResolveFrameRedraw()

func (*Core) SetDisplayType

func (core *Core) SetDisplayType(op LayoutOptions)

func (*Core) SetPosition

func (core *Core) SetPosition(point image.Point)

func (*Core) SetPositionXY

func (core *Core) SetPositionXY(x int, y int)

func (*Core) SetSize

func (core *Core) SetSize(size Size)

func (*Core) SetVisible

func (core *Core) SetVisible(visible bool)

func (*Core) SetZ

func (core *Core) SetZ(z int)

func (*Core) Style

func (core *Core) Style() *map[string]theme.Property

type Factory

type Factory func(core Core) Component

type FlexDirection

type FlexDirection string
const (
	FlexRow    FlexDirection = "row"
	FlexColumn FlexDirection = "column"
)

type FlexLayout

type FlexLayout struct {
	JustifyContent FlexPosition
	AlignItems     FlexPosition
	Direction      FlexDirection
	Gap            int
}

FlexLayout This layout can position based on horizontal and vertical layout

func Flex

func Flex() FlexLayout

func FlexCentered

func FlexCentered() FlexLayout

func (FlexLayout) Align

func (l FlexLayout) Align(pos FlexPosition) FlexLayout

func (FlexLayout) Justify

func (l FlexLayout) Justify(pos FlexPosition) FlexLayout

func (FlexLayout) ProcessLayout

func (l FlexLayout) ProcessLayout(comp Component) []*Component

func (FlexLayout) UseDirection

func (l FlexLayout) UseDirection(dir FlexDirection) FlexLayout

func (FlexLayout) UseGap

func (l FlexLayout) UseGap(gap int) FlexLayout

type FlexPosition

type FlexPosition string
const (
	FlexStart  FlexPosition = "flex-start"
	FlexCenter FlexPosition = "center"
	FlexEnd    FlexPosition = "flex-end"
)

type GridLayout

type GridLayout struct {
	Columns int
	Gap     int
}

func (GridLayout) ProcessLayout

func (g GridLayout) ProcessLayout(comp Component) []*Component

func (GridLayout) UseColumns

func (g GridLayout) UseColumns(cols int) GridLayout

func (GridLayout) UseGap

func (g GridLayout) UseGap(gap int) GridLayout

type LayoutOptions

type LayoutOptions interface {
	ProcessLayout(comp Component) []*Component
}

func NewBlockLayout

func NewBlockLayout() LayoutOptions

func NewGridLayout

func NewGridLayout() LayoutOptions

type Size

type Size struct {
	Width  int
	Height int
}

func SizeFromBounds

func SizeFromBounds(rect image.Rectangle) Size

func (Size) ToPoint

func (s Size) ToPoint() image.Point

type State

type State[T any] struct {
	Initial T
	// contains filtered or unexported fields
}

func NewState

func NewState[T any](val T) State[T]

func (*State[T]) Get

func (state *State[T]) Get() T

func (*State[T]) OnChange

func (state *State[T]) OnChange(listener func(new T))

OnChange allows to listen to state changes of the current state object

func (*State[T]) Revert

func (state *State[T]) Revert()

Revert resets the current state back to the initial state

func (*State[T]) SetState

func (state *State[T]) SetState(val T)

SetState set the current state

type StyleListener

type StyleListener func(property theme.Property)

Jump to

Keyboard shortcuts

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