forms

package module
v0.0.0-...-9038b1f Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2020 License: Apache-2.0 Imports: 23 Imported by: 32

README

forms GoDoc

The worldiety go (golang) widget toolkit, a component like description of forms and ui widgets. Partially inspired by SwiftUI. It is based on the Google Material Web Components.

Take a look at the example project at https://github.com/golangee/forms-example.

Roadmap

  • proof of concept
  • scope and context lifecycle handling
  • application frame
  • i18n support
  • routing
  • life cycle management of listeners
  • responsive style definitions
  • layout components
    • vertical stack
    • horizontal stack
    • grid view
  • wrapped material components
    • linear progress
    • checkbox
    • card
    • button
    • dialog
    • drawer
    • list
    • popup menu
    • picker/combobox/spinner
    • snackbar
    • table
    • textarea
    • input field
    • application bar
    • icon button
  • custom components
    • stepper
    • link
    • circular progress

Documentation

Overview

wtk (widget toolkit) defines a model to declare a user interface without being explicit about the underlying technology. Using wtk, widget developers can use the same description to render graphical user interfaces across platforms, like web, mobile or desktop.

Index

Constants

This section is empty.

Variables

View Source
var BuildGitBranch = "unknown"
View Source
var BuildGitCommit = "unknown"
View Source
var BuildHost = "unknown"
View Source
var Colors = map[string]Color{
	"Purple":       Purple,
	"Teal":         Teal,
	"Error":        Error,
	"Red50":        Red50,
	"Pink50":       Pink50,
	"Purple50":     Purple50,
	"DeepPurple50": DeepPurple50,
	"Indigo50":     Indigo50,
	"Blue50":       Blue50,
	"LightBlue":    LightBlue,
	"Cyan50":       Cyan50,
	"Teal50":       Teal50,
	"Green50":      Green50,
	"LightGreen50": LightGreen50,
	"Lime50":       Lime50,
	"Yellow50":     Yellow50,
	"Amber50":      Amber50,
	"Orange50":     Orange50,
	"DeepOrange50": DeepOrange50,
	"Brown50":      Brown50,
	"Gray50":       Gray50,
	"BlueGray50":   BlueGray50,
}
View Source
var DefaultPadding = Pixel(8)
View Source
var GoSyntax = Highlighter{
	// contains filtered or unexported fields
}
View Source
var Green = RGBA(0, 255, 0, 255)

Functions

func Post

func Post(d time.Duration, f func())

func Run

func Run(target View, init func())

func ShowMessage

func ShowMessage(parent View, msg string)

Types

type AbsApplication

type AbsApplication interface {
	SetView(view View)
}

type Alignment

type Alignment string
const Leading Alignment = "leading"
const Trailing Alignment = "trailing"

type Application

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

func NewApplication

func NewApplication(this AbsApplication, expectedVersion string) *Application

func (*Application) Context

func (a *Application) Context() Context

func (*Application) Route

func (a *Application) Route(path string, f func(Query) View) *Application

func (*Application) SetView

func (a *Application) SetView(view View)

func (*Application) Start

func (a *Application) Start()

func (*Application) UnmatchedRoute

func (a *Application) UnmatchedRoute(f func(Query) View) *Application

func (*Application) Window

func (a *Application) Window() *Window

type Button

type Button struct {
	Text string
	// contains filtered or unexported fields
}

func NewButton

func NewButton(text string) *Button

func (*Button) AddClickListener

func (t *Button) AddClickListener(f func(v View)) *Button

AddClickListener registers another click listener

func (*Button) AddIcon

func (t *Button) AddIcon(icon icon.Icon, alignment Alignment) *Button

func (Button) Context

func (b Button) Context() Context

func (Button) Release

func (b Button) Release()

func (Button) Scope

func (b Button) Scope() context.Context

func (*Button) Self

func (t *Button) Self(ref **Button) *Button

Self assigns the receiver to the given reference

func (*Button) SetEnabled

func (t *Button) SetEnabled(b bool) *Button

func (*Button) SetLeadingIcon

func (t *Button) SetLeadingIcon(icon icon.Icon) *Button

func (*Button) SetStyleKind

func (t *Button) SetStyleKind(s ButtonStyleKind) *Button

func (*Button) SetText

func (t *Button) SetText(str string) *Button

func (*Button) Style

func (t *Button) Style(style ...Style) *Button

type ButtonStyleKind

type ButtonStyleKind string
const Default ButtonStyleKind = "mdc-button"
const Dlg ButtonStyleKind = "mdc-dialog__button"
const Outlined ButtonStyleKind = "mdc-button--outlined"
const Raised ButtonStyleKind = "mdc-button--raised"
const Unelevated ButtonStyleKind = "mdc-button--unelevated"

type Card

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

Card represents the material card component, see https://material.io/components/cards.

func NewCard

func NewCard(views ...View) *Card

NewCard creates a new card component.

func (*Card) AddViews

func (t *Card) AddViews(views ...View) *Card

func (*Card) AppendViews

func (t *Card) AppendViews(views ...View) ViewGroup

func (*Card) ClearViews

func (t *Card) ClearViews() ViewGroup

func (Card) Context

func (b Card) Context() Context

func (Card) Release

func (b Card) Release()

func (*Card) RemoveAll

func (t *Card) RemoveAll() *Card

func (Card) Scope

func (b Card) Scope() context.Context

func (*Card) Self

func (t *Card) Self(ref **Card) *Card

Self assigns the receiver to the given reference

func (*Card) Style

func (t *Card) Style(style ...Style) *Card

func (*Card) StyleFor

func (t *Card) StyleFor(criteria MediaCriteria, style ...Style) *Card

StyleFor applies the given styles only if the criteria is met.

type Checkbox

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

func NewCheckbox

func NewCheckbox() *Checkbox

func (*Checkbox) AddChangeListener

func (t *Checkbox) AddChangeListener(f func(v *Checkbox)) *Checkbox

func (*Checkbox) Checked

func (t *Checkbox) Checked() bool

func (Checkbox) Context

func (b Checkbox) Context() Context

func (*Checkbox) Indeterminate

func (t *Checkbox) Indeterminate() bool

func (Checkbox) Release

func (b Checkbox) Release()

func (Checkbox) Scope

func (b Checkbox) Scope() context.Context

func (*Checkbox) Self

func (t *Checkbox) Self(ref **Checkbox) *Checkbox

Self assigns the receiver to the given pointer to reference

func (*Checkbox) SetChecked

func (t *Checkbox) SetChecked(b bool) *Checkbox

func (*Checkbox) SetEnabled

func (t *Checkbox) SetEnabled(b bool) *Checkbox

func (*Checkbox) SetIndeterminate

func (t *Checkbox) SetIndeterminate(b bool) *Checkbox

func (*Checkbox) SetText

func (t *Checkbox) SetText(s string) *Checkbox

func (*Checkbox) Style

func (t *Checkbox) Style(style ...Style) *Checkbox

type CircularProgress

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

func NewCircularProgress

func NewCircularProgress() *CircularProgress

func (CircularProgress) Context

func (b CircularProgress) Context() Context

func (CircularProgress) Release

func (b CircularProgress) Release()

func (CircularProgress) Scope

func (b CircularProgress) Scope() context.Context

func (*CircularProgress) Self

Self assigns the receiver to the given pointer to reference

func (*CircularProgress) Style

func (t *CircularProgress) Style(style ...Style) *CircularProgress

type Code

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

func NewCode

func NewCode(hl Highlighter, str string) *Code

func (Code) Context

func (b Code) Context() Context

func (Code) Release

func (b Code) Release()

func (Code) Scope

func (b Code) Scope() context.Context

func (*Code) Self

func (t *Code) Self(ref **Code) *Code

Self assigns the receiver to the given pointer to reference

func (*Code) Set

func (t *Code) Set(str string) *Code

func (*Code) Style

func (t *Code) Style(style ...Style) *Code

type Color

type Color uint32
const (
	Purple       Color = 0x6200EEFF
	Teal         Color = 0x03DAC5FF
	Error        Color = 0xB00020FF
	Red50        Color = 0xF44336FF
	Pink50       Color = 0xE91E63FF
	Purple50     Color = 0x9C27B0FF
	DeepPurple50 Color = 0x673AB7FF
	Indigo50     Color = 0x3F51B5FF
	Blue50       Color = 0x2196F3FF
	LightBlue    Color = 0x03A9F4FF
	Cyan50       Color = 0x00BCD4FF
	Teal50       Color = 0x009688FF
	Green50      Color = 0x4CAF50FF
	LightGreen50 Color = 0x8BC34AFF
	Lime50       Color = 0xCDDC39FF
	Yellow50     Color = 0xFFEB3BFF
	Amber50      Color = 0xFFC107FF
	Orange50     Color = 0xFF9800FF
	DeepOrange50 Color = 0xFF5722FF
	Brown50      Color = 0x795548FF
	Gray50       Color = 0x9e9e9eFF
	BlueGray50   Color = 0x607D8BFF
)

func ParseColor

func ParseColor(text string) Color

ParseColor currently can only evaluate codes like #6200ee??

func RGB

func RGB(r, g, b byte) Color

func RGBA

func RGBA(r, g, b, a byte) Color

func (Color) Alpha

func (c Color) Alpha() byte

func (Color) Blue

func (c Color) Blue() byte

func (Color) Green

func (c Color) Green() byte

func (Color) Red

func (c Color) Red() byte

func (Color) SetAlpha

func (c Color) SetAlpha(a byte) Color

func (Color) String

func (c Color) String() string

type Context

type Context interface {
	Navigate(path string, params ...NamedParameter)
	Routes() []Route
	// Languages returns the user preferred languages. It is never empty and returns "und" if not known.
	Languages() []string

	// Invalidate tries to reload the affected view as efficient as possible. However it may likely just reload
	// the entire current url
	Invalidate()
	// contains filtered or unexported methods
}

func NewContext

func NewContext(router *Router) Context

type Dialog

type Dialog struct {
	Value string
	// contains filtered or unexported fields
}

func NewDialog

func NewDialog() *Dialog

func (*Dialog) AddAction

func (t *Dialog) AddAction(caption string, onClick func(dlg *Dialog)) *Dialog

func (*Dialog) Close

func (t *Dialog) Close()

func (Dialog) Context

func (b Dialog) Context() Context

func (Dialog) Release

func (b Dialog) Release()

func (Dialog) Scope

func (b Dialog) Scope() context.Context

func (*Dialog) Self

func (t *Dialog) Self(ref **Dialog) *Dialog

Self assigns the receiver to the given pointer to reference

func (*Dialog) SetBody

func (t *Dialog) SetBody(v View) *Dialog

func (*Dialog) SetTitle

func (t *Dialog) SetTitle(s string) *Dialog

func (*Dialog) Show

func (t *Dialog) Show(parent View)

func (*Dialog) Style

func (t *Dialog) Style(style ...Style) *Dialog

type DisplayType

type DisplayType string
const DisplayNone DisplayType = "none"
const DisplayVisible DisplayType = "unset"

type Drawer

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

func NewDrawer

func NewDrawer(bar *TopAppBar, header View, menu *List, content View) *Drawer

func (Drawer) Context

func (b Drawer) Context() Context

func (*Drawer) Release

func (t *Drawer) Release()

func (Drawer) Scope

func (b Drawer) Scope() context.Context

func (*Drawer) Self

func (t *Drawer) Self(ref **Drawer) *Drawer

Self assigns the receiver to the given pointer to reference

func (*Drawer) Style

func (t *Drawer) Style(style ...Style) *Drawer

type ErrorView

type ErrorView struct {
	*VStack
	// contains filtered or unexported fields
}

func NewErrorView

func NewErrorView(err error) *ErrorView

func (ErrorView) Context

func (b ErrorView) Context() Context

func (ErrorView) Release

func (b ErrorView) Release()

func (ErrorView) Scope

func (b ErrorView) Scope() context.Context

type FontStyle

type FontStyle string
const Body FontStyle = "mdc-typography--body1"
const Body2 FontStyle = "mdc-typography--body2"
const Btn FontStyle = "mdc-typography--button"
const Caption FontStyle = "mdc-typography--caption"
const DrawerSubTitle FontStyle = "mdc-drawer__subtitle"
const DrawerTitle FontStyle = "mdc-drawer__title"
const Headline1 FontStyle = "mdc-typography--headline1"
const Headline2 FontStyle = "mdc-typography--headline2"
const Headline3 FontStyle = "mdc-typography--headline3"
const Headline4 FontStyle = "mdc-typography--headline4"
const Headline5 FontStyle = "mdc-typography--headline5"
const Headline6 FontStyle = "mdc-typography--headline6"
const Overline FontStyle = "mdc-typography--overline"
const Subtitle1 FontStyle = "mdc-typography--subtitle1"
const Subtitle2 FontStyle = "mdc-typography--subtitle1"

type Frame

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

func NewFrame

func NewFrame() *Frame

func (*Frame) AppendViews

func (t *Frame) AppendViews(views ...View) ViewGroup

func (*Frame) ClearViews

func (t *Frame) ClearViews() ViewGroup

func (Frame) Context

func (b Frame) Context() Context

func (Frame) Release

func (b Frame) Release()

func (*Frame) RemoveAll

func (t *Frame) RemoveAll() *Frame

func (Frame) Scope

func (b Frame) Scope() context.Context

func (*Frame) Self

func (t *Frame) Self(ref **Frame) *Frame

Self assigns the receiver to the given pointer to reference

func (*Frame) SetView

func (t *Frame) SetView(v View) *Frame

func (*Frame) Style

func (t *Frame) Style(style ...Style) *Frame

type Grid

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

A Grid offers a grid-based layout, where you define the area of children with rows and columns.

func NewGrid

func NewGrid() *Grid

NewGrid allocates a new view group, ready to insert views.

func (*Grid) AddView

func (t *Grid) AddView(view View, opt GridLayoutParams) *Grid

func (*Grid) AddViews

func (t *Grid) AddViews(views ...View) *Grid

AddViews adds all views.

func (*Grid) AppendViews

func (t *Grid) AppendViews(views ...View) ViewGroup

AppendViews adds all views.

func (*Grid) ClearViews

func (t *Grid) ClearViews() ViewGroup

ClearViews removes all views.

func (Grid) Context

func (b Grid) Context() Context

func (Grid) Release

func (b Grid) Release()

func (*Grid) RemoveAll

func (t *Grid) RemoveAll() *Grid

RemoveAll removes all views.

func (Grid) Scope

func (b Grid) Scope() context.Context

func (*Grid) Self

func (t *Grid) Self(ref **Grid) *Grid

Self assigns the receiver to the given reference

func (*Grid) SetAreas

func (t *Grid) SetAreas(areas [][]string) *Grid

SetAreas defines the grid layout "visually" in a two dimensional string array. Example:

SetAreas([][]string{
 {"header", "header", "header"},
 {"menu", "main", "main"},
 {"menu", "footer", "footer"},
})

Use the Area

func (*Grid) SetColumnGap

func (t *Grid) SetColumnGap(scalar Scalar) *Grid

SetColumnGap defines the column margin between children.

func (*Grid) SetColumnWidths

func (t *Grid) SetColumnWidths(scalars ...Scalar) *Grid

SetColumnWidths defines two things: firstly how many columns at all and secondly how they are calculated. You can also use the *Auto*-scalar.

func (*Grid) SetGap

func (t *Grid) SetGap(scalar Scalar) *Grid

SetGap defines the margin between all children.

func (*Grid) SetHorizontalAlign

func (t *Grid) SetHorizontalAlign(alignment GridAlign) *Grid

SetHorizontalAlign determines how columns are distributed inside the grid container

func (*Grid) SetRowGap

func (t *Grid) SetRowGap(scalar Scalar) *Grid

SetRowGap defines the row margin between children.

func (*Grid) SetRowHeights

func (t *Grid) SetRowHeights(scalars ...Scalar) *Grid

SetRowHeights defines two things: firstly how many rows at all and secondly how they are calculated. You can also use the *Auto*-scalar.

func (*Grid) SetVerticalAlign

func (t *Grid) SetVerticalAlign(alignment GridAlign) *Grid

SetVerticalAlign determines how rows are distributed inside the grid container

func (*Grid) Style

func (t *Grid) Style(style ...Style) *Grid

Style applies generic style attributes.

func (*Grid) StyleFor

func (t *Grid) StyleFor(criteria MediaCriteria, style ...Style) *Grid

StyleFor applies the given styles only if the criteria is met.

type GridAlign

type GridAlign string

GridAlign

const (
	// SpaceEvenly distributes cells evenly in height (vertically) or width (horizontally).
	SpaceEvenly GridAlign = "space-evenly"

	// SpaceBetween distributes the free space equally *between* each item in height (vertically) or
	// (horizontally)
	SpaceBetween GridAlign = "space-between"

	// SpaceAround distributes the free space equally *around* each item in height (vertically) or
	// width (horizontally)
	SpaceAround GridAlign = "space-around"

	// Center aligns cells in the center of the grid container, affects rows (vertically) or
	// columns (horizontally)
	Center GridAlign = "center"

	// Start aligns the cells at the left (horizontally) or top (vertically).
	Start GridAlign = "start"

	// End aligns the cells at the right (horizontally) or bottom (vertically).
	End GridAlign = "end"
)

type GridLayoutParams

type GridLayoutParams struct {
	Area string
}

GridLayoutParams define how a view spans inside the grid container.

type Group

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

func NewGroup

func NewGroup(views ...View) *Group

func (*Group) AddViews

func (t *Group) AddViews(views ...View) *Group

func (*Group) AppendViews

func (t *Group) AppendViews(views ...View) ViewGroup

func (*Group) ClearViews

func (t *Group) ClearViews() ViewGroup

func (Group) Context

func (b Group) Context() Context

func (Group) Release

func (b Group) Release()

func (*Group) RemoveAll

func (t *Group) RemoveAll() *Group

func (Group) Scope

func (b Group) Scope() context.Context

func (*Group) Self

func (t *Group) Self(ref **Group) *Group

Self assigns the receiver to the given reference

func (*Group) Style

func (t *Group) Style(style ...Style) *Group

Style applies generic style attributes.

func (*Group) StyleFor

func (t *Group) StyleFor(criteria MediaCriteria, style ...Style) *Group

StyleFor applies the given styles only if the criteria is met.

type HStack

type HStack struct {
	*Grid
}

HStack is a horizontal grid with just a single row.

func NewHStack

func NewHStack(views ...View) *HStack

NewHStack creates a new horizontal view stack.

func (*HStack) AddViews

func (t *HStack) AddViews(views ...View) *HStack

func (*HStack) AppendViews

func (t *HStack) AppendViews(views ...View) ViewGroup

func (*HStack) ClearViews

func (t *HStack) ClearViews() ViewGroup

func (HStack) Context

func (b HStack) Context() Context

func (HStack) Release

func (b HStack) Release()

func (*HStack) RemoveAll

func (t *HStack) RemoveAll() *HStack

func (HStack) Scope

func (b HStack) Scope() context.Context

func (*HStack) Self

func (t *HStack) Self(ref **HStack) *HStack

Self assigns the receiver to the given reference

func (*HStack) Style

func (t *HStack) Style(style ...Style) *HStack

Style applies generic style attributes.

func (*HStack) StyleFor

func (t *HStack) StyleFor(criteria MediaCriteria, style ...Style) *HStack

StyleFor applies the given styles only if the criteria is met.

type Handle

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

func (Handle) Valid

func (f Handle) Valid() bool

type Highlighter

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

type Icon

type Icon struct {
	Value icon.Icon
	// contains filtered or unexported fields
}

func NewIcon

func NewIcon(str icon.Icon) *Icon

func (Icon) Context

func (b Icon) Context() Context

func (Icon) Release

func (b Icon) Release()

func (Icon) Scope

func (b Icon) Scope() context.Context

func (*Icon) Self

func (t *Icon) Self(ref **Icon) *Icon

Self assigns the receiver to the given pointer to reference

func (*Icon) Set

func (t *Icon) Set(str icon.Icon) *Icon

func (*Icon) Style

func (t *Icon) Style(style ...Style) *Icon

type IconButton

type IconButton struct {
	Value icon.Icon
	// contains filtered or unexported fields
}

An IconButton is a rounded button with an icon or a single character on it

func NewIconButton

func NewIconButton(str icon.Icon) *IconButton

NewIconButton creates a new icon

func (*IconButton) AddClickListener

func (t *IconButton) AddClickListener(f func(v View)) *IconButton

AddClickListener registers another click listener

func (IconButton) Context

func (b IconButton) Context() Context

func (IconButton) Release

func (b IconButton) Release()

func (IconButton) Scope

func (b IconButton) Scope() context.Context

func (*IconButton) Self

func (t *IconButton) Self(ref **IconButton) *IconButton

Self assigns the receiver to the given pointer to reference

func (*IconButton) Set

func (t *IconButton) Set(str icon.Icon) *IconButton

Set updates the material icon

func (*IconButton) SetChar

func (t *IconButton) SetChar(r rune) *IconButton

SetChar violates the material spec and allows to set a unicode character codepoint instead of an icon

func (*IconButton) Style

func (t *IconButton) Style(style ...Style) *IconButton

Style applies generic style attributes.

type IconItem

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

func NewIconItem

func NewIconItem(ico icon.Icon, label string, action func(v View)) *IconItem

type InputType

type InputType string
const Date InputType = "date"
const DateTime InputType = "datetime"
const DateTimeLocal InputType = "datetime-local"
const EMail InputType = "email"
const Month InputType = "month"
const Number InputType = "number"
const Password InputType = "password"
const Range InputType = "range"
const Search InputType = "search"
const Tel InputType = "tel"
const Time InputType = "time"
const Txt InputType = "text"
const URL InputType = "url"
const Week InputType = "week"

type LinearProgress

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

func NewLinearProgress

func NewLinearProgress() *LinearProgress

func (LinearProgress) Context

func (b LinearProgress) Context() Context

func (LinearProgress) Release

func (b LinearProgress) Release()

func (LinearProgress) Scope

func (b LinearProgress) Scope() context.Context

func (*LinearProgress) Self

Self assigns the receiver to the given pointer to reference

func (*LinearProgress) SetIndeterminate

func (t *LinearProgress) SetIndeterminate(b bool) *LinearProgress

func (*LinearProgress) SetProgress

func (t *LinearProgress) SetProgress(f float64) *LinearProgress

func (*LinearProgress) SetSecondaryProgress

func (t *LinearProgress) SetSecondaryProgress(f float64) *LinearProgress

func (*LinearProgress) Style

func (t *LinearProgress) Style(style ...Style) *LinearProgress
type Link struct {
	// contains filtered or unexported fields
}
func NewLink(caption string, href string) *Link

func (Link) Context

func (b Link) Context() Context

func (Link) Release

func (b Link) Release()

func (Link) Scope

func (b Link) Scope() context.Context

func (*Link) Self

func (t *Link) Self(ref **Link) *Link

Self assigns the receiver to the given pointer to reference

func (*Link) SetCaption

func (t *Link) SetCaption(str string) *Link

func (*Link) SetRef

func (t *Link) SetRef(r string) *Link

func (*Link) SetTarget

func (t *Link) SetTarget(target LinkTarget) *Link

func (*Link) Style

func (t *Link) Style(style ...Style) *Link

type LinkTarget

type LinkTarget string
const TargetBlank LinkTarget = "_blank"
const TargetParent LinkTarget = "_parent"
const TargetSelf LinkTarget = "_self"
const TargetTop LinkTarget = "_top"

type List

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

func NewList

func NewList() *List

func NewSelectionList

func NewSelectionList() *List

func (*List) AddItems

func (t *List) AddItems(items ...LstItem) *List

func (*List) AddSelectListener

func (t *List) AddSelectListener(action func(idx int)) *List

func (List) Context

func (b List) Context() Context

func (List) Release

func (b List) Release()

func (List) Scope

func (b List) Scope() context.Context

func (*List) SelectedIndex

func (t *List) SelectedIndex() int

func (*List) Self

func (t *List) Self(ref **List) *List

Self assigns the receiver to the given pointer to reference

func (*List) SetSelectedIndex

func (t *List) SetSelectedIndex(idx int) *List

func (*List) Style

func (t *List) Style(style ...Style) *List

type ListHeader

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

func NewListHeader

func NewListHeader(caption string) *ListHeader

func (ListHeader) Context

func (b ListHeader) Context() Context

func (ListHeader) Release

func (b ListHeader) Release()

func (ListHeader) Scope

func (b ListHeader) Scope() context.Context

func (*ListHeader) SetText

func (t *ListHeader) SetText(s string) *ListHeader

type ListItem

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

func NewListItem

func NewListItem(text string) *ListItem

func NewListTwoLineItem

func NewListTwoLineItem(primary string, secondary string) *ListItem

func (*ListItem) AddClickListener

func (t *ListItem) AddClickListener(action func(v View)) *ListItem

func (ListItem) Context

func (b ListItem) Context() Context

func (ListItem) Release

func (b ListItem) Release()

func (ListItem) Scope

func (b ListItem) Scope() context.Context

func (*ListItem) SetLeadingView

func (t *ListItem) SetLeadingView(v View) *ListItem

func (*ListItem) SetSelected

func (t *ListItem) SetSelected(b bool) *ListItem

func (*ListItem) SetTrailingView

func (t *ListItem) SetTrailingView(v View) *ListItem

type ListSeparator

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

func NewListSeparator

func NewListSeparator() *ListSeparator

func (ListSeparator) Context

func (b ListSeparator) Context() Context

func (ListSeparator) Release

func (b ListSeparator) Release()

func (ListSeparator) Scope

func (b ListSeparator) Scope() context.Context

type Listener

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

func (Listener) Release

func (l Listener) Release()

type LstItem

type LstItem interface {
	View
	// contains filtered or unexported methods
}

type MediaCriteria

type MediaCriteria string

MediaCriteria describes rules to match against various screen properties.

func MatchAll

func MatchAll(criterias ...MediaCriteria) MediaCriteria

MatchAll concats all given criterias into a big and statement

func MatchLandscape

func MatchLandscape() MediaCriteria

MatchLandscape matches for a screen where the width is longer than the height

func MatchMaxHeight

func MatchMaxHeight(scalar Scalar) MediaCriteria

MatchMaxWidth returns a criteria for a max height

func MatchMaxWidth

func MatchMaxWidth(scalar Scalar) MediaCriteria

MatchMaxWidth returns a criteria for a max width

func MatchMinHeight

func MatchMinHeight(scalar Scalar) MediaCriteria

MatchMinHeight returns a criteria for a min height

func MatchMinWidth

func MatchMinWidth(scalar Scalar) MediaCriteria

MatchMinWidth returns a criteria for a min width

func MatchOne

func MatchOne(criterias ...MediaCriteria) MediaCriteria

MatchOne concats all given criterias into a big or statement

func MatchPortrait

func MatchPortrait() MediaCriteria

MatchPortrait matches for a screen where the height is longer than the width

type MediaMatcher

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

MediaMatcher registers multiple matching and a non-matching callback a number of criterias to the view. If the view is destroyed, the callbacks are unregistered.

func NewMediaMatcher

func NewMediaMatcher(scope View, noMatch func(view View)) *MediaMatcher

func (*MediaMatcher) Add

func (m *MediaMatcher) Add(criteria MediaCriteria, onMatch func(view View))

Add appends another criteria to evaluate. The given callback is invoked, if it matches the criteria. Only the first registered and matching criteria is invoked.

func (*MediaMatcher) Check

func (m *MediaMatcher) Check()

Check evaluates all registered criterias and applies the first matching callback. It only invokes a callback if it has not been active. The noMatch callback is only called, if no active criteria match has been found. It will be called internally automatically, if some environment conditions like the screen size has changed. It is safe to be invoked on a nil pointer.

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

func NewMenu

func NewMenu() *Menu

func ShowMenu

func ShowMenu(anchor View, items ...*MenuItem) *Menu

ShowMenu is a shortcut for NewMenu().ReleaseOnClose()...Show()

func (t *Menu) AddItem(item *MenuItem) *Menu
func (b Menu) Context() Context
func (t *Menu) Release()
func (t *Menu) ReleaseOnClose() *Menu
func (b Menu) Scope() context.Context
func (t *Menu) Self(ref **Menu) *Menu

Self assigns the receiver to the given pointer to reference

func (t *Menu) Show(anchor View)
func (t *Menu) Style(style ...Style) *Menu
type MenuItem struct {
	// contains filtered or unexported fields
}

func NewMenuDivider

func NewMenuDivider() *MenuItem

func NewMenuItem

func NewMenuItem(caption string, action func(menu *MenuItem)) *MenuItem
func (m *MenuItem) Menu() *Menu
func (m *MenuItem) Release()
func (m *MenuItem) SetCaption(caption string) *MenuItem
func (m *MenuItem) SetEnabled(b bool) *MenuItem
func (m *MenuItem) SetSelectListener(f func(menu *MenuItem)) *MenuItem

type Model

type Model struct {
	Value interface{}
	// contains filtered or unexported fields
}

func (*Model) AddListener

func (p *Model) AddListener(cb ModelChanged) Handle

func (*Model) Notify

func (p *Model) Notify()

func (*Model) RemoveListener

func (p *Model) RemoveListener(f Handle)

type ModelChanged

type ModelChanged func(value interface{})

type NamedParameter

type NamedParameter struct {
	Key   string
	Value string
}

func IntParam

func IntParam(key string, val int) NamedParameter

func StrParam

func StrParam(key string, val string) NamedParameter

type OverflowType

type OverflowType string
const OverflowAuto OverflowType = "auto"
const OverflowHidden OverflowType = "hidden"
const OverflowScroll OverflowType = "scroll"

type Picker

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

Picker is also known as Combobox, Dropdown or Spinner.

func NewPicker

func NewPicker(options ...string) *Picker

NewPicker creates a new Combobox/Dropdown/Spinner component.

func (*Picker) BindText

func (t *Picker) BindText(s *string) *Picker

BindText is a shortcut for TextProperty().Bind() and returning self. If used together with #SetSelected() the order matters. When populated from/to a model, you likely want to first select a default (by index) and then bind to the model, which reads the value from the given pointer. However if that is invalid, it does nothing, otherwise selects the right index by name.

func (Picker) Context

func (b Picker) Context() Context

func (*Picker) Release

func (t *Picker) Release()

func (Picker) Scope

func (b Picker) Scope() context.Context

func (*Picker) Selected

func (t *Picker) Selected() int

func (*Picker) Self

func (t *Picker) Self(ref **Picker) *Picker

Self assigns the receiver to the given pointer to reference

func (*Picker) SetEnabled

func (t *Picker) SetEnabled(b bool) *Picker

func (*Picker) SetHelper

func (t *Picker) SetHelper(str string) *Picker

func (*Picker) SetInvalid

func (t *Picker) SetInvalid(b bool) *Picker

func (*Picker) SetLabel

func (t *Picker) SetLabel(str string) *Picker

func (*Picker) SetOptions

func (t *Picker) SetOptions(options ...string) *Picker

func (*Picker) SetSelectListener

func (t *Picker) SetSelectListener(f func(v *Picker)) *Picker

func (*Picker) SetSelected

func (t *Picker) SetSelected(idx int) *Picker

func (*Picker) SetText

func (t *Picker) SetText(str string) *Picker

SetText tries to find the text in "options" and selects the index, if possible. Otherwise does nothing.

func (*Picker) Style

func (t *Picker) Style(style ...Style) *Picker

func (*Picker) Text

func (t *Picker) Text() string

Text returns the current selected option text. If nothing is selected returns the empty string.

func (*Picker) TextProperty

func (t *Picker) TextProperty() property.String

TextProperty returns a text property to or get the text.

type PositionType

type PositionType string
const PositionAbsolute PositionType = "absolute"
const PositionFixed PositionType = "fixed"
const PositionInitial PositionType = "initial"
const PositionRelative PositionType = "relative"

type Query

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

func (Query) Int

func (p Query) Int(key string) int

func (Query) Path

func (p Query) Path() string

func (Query) Str

func (p Query) Str(key string) string

type Resource

type Resource interface {
	Release() // Release clean up references and the resource must not be used afterwards anymore.
}

A Resource release method should be called for any resource, as soon as it is not required anymore to avoid memory leaks. Afterwards the Resource must not be used anymore. Even though we have a GC, we cannot rely on it, because the Resource may have registrations beyond our process, which requires holding global callback references, so that the outer system can call us. An example for this are go functions wrapped as callbacks in the wasm tier made available for the javascript DOM, like event handlers. Also cgo or rpc mechanism are possible.

func NewListener

func NewListener(f interface{}, onRelease func()) Resource

type Route

type Route struct {
	Path        string
	Constructor func(q Query)
}

type Router

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

func NewRouter

func NewRouter() *Router

func (*Router) AddRoute

func (r *Router) AddRoute(path string, f func(Query)) *Router

func (*Router) Invalidate

func (r *Router) Invalidate() error

func (*Router) Navigate

func (r *Router) Navigate(u *url.URL)

func (*Router) Release

func (r *Router) Release()

func (*Router) Reload

func (r *Router) Reload(force bool)

func (*Router) Routes

func (r *Router) Routes() []Route

func (*Router) SetUnhandledRouteAction

func (r *Router) SetUnhandledRouteAction(f func(Query)) *Router

func (*Router) Start

func (r *Router) Start()

type Scalar

type Scalar string

func Auto

func Auto() Scalar

Auto may have different meanings, depending on the used context.

Grid
  - if possible, take mostly the required space (fit-content), however
  - if not reasonable (like others have fixed sizes or everything is auto), stretch to availabel space

func Contain

func Contain() Scalar

Contain is only valid for the background-size attribute

func Cover

func Cover() Scalar

Cover is only valid for the background-size attribute

func Fraction

func Fraction(f int) Scalar

Fraction is used for Grid containers to define how a fraction of the remaining available space is distributed.

func Percent

func Percent(i int) Scalar

func PercentViewPortHeight

func PercentViewPortHeight(i int) Scalar

func PercentViewPortWidth

func PercentViewPortWidth(i int) Scalar

func Pixel

func Pixel(i int) Scalar

Pixel is in a kind of DIP, density independent pixel. So your value is scaled with the display density to something reasonable.

type Snackbar

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

func NewSnackbar

func NewSnackbar(text string, actionLabel string) *Snackbar

func (*Snackbar) Close

func (t *Snackbar) Close() *Snackbar

func (Snackbar) Context

func (b Snackbar) Context() Context

func (*Snackbar) Release

func (t *Snackbar) Release()

func (Snackbar) Scope

func (b Snackbar) Scope() context.Context

func (*Snackbar) Self

func (t *Snackbar) Self(ref **Snackbar) *Snackbar

Self assigns the receiver to the given pointer to reference

func (*Snackbar) SetAction

func (t *Snackbar) SetAction(action func(v View)) *Snackbar

func (*Snackbar) SetActionLabel

func (t *Snackbar) SetActionLabel(str string) *Snackbar

func (*Snackbar) SetText

func (t *Snackbar) SetText(str string) *Snackbar

func (*Snackbar) SetTimeout

func (t *Snackbar) SetTimeout(d time.Duration) *Snackbar

SetTimeout value must be between 4000 and 10000 (or -1 to disable the timeout completely) or an error will be thrown. Defaults is 5 seconds.

func (*Snackbar) Show

func (t *Snackbar) Show(v View) *Snackbar

func (*Snackbar) Style

func (t *Snackbar) Style(style ...Style) *Snackbar

type Spacer

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

deprecated

func NewSpacer

func NewSpacer() *Spacer

func (Spacer) Context

func (b Spacer) Context() Context

func (Spacer) Release

func (b Spacer) Release()

func (Spacer) Scope

func (b Spacer) Scope() context.Context

func (*Spacer) Self

func (t *Spacer) Self(ref **Spacer) *Spacer

Self assigns the receiver to the given pointer to reference

func (*Spacer) Style

func (t *Spacer) Style(style ...Style) *Spacer

type Style

type Style interface {
	// contains filtered or unexported methods
}

A Style modifies different kinds of visualization of a View.

func BackgroundColor

func BackgroundColor(color Color) Style

func BorderRadius

func BorderRadius(scalar Scalar) Style

BorderRadius sets all 4 edges to the same radius

func Display

func Display(displayType DisplayType) Style

func Font

func Font(name FontStyle) Style

func FontWeight

func FontWeight(weight TypeWeight) Style

func ForegroundColor

func ForegroundColor(color Color) Style

func Height

func Height(scalar Scalar) Style

func Margin

func Margin() Style

func MarginBottom

func MarginBottom(scalar Scalar) Style

func MarginLeft

func MarginLeft(scalar Scalar) Style

func MarginRight

func MarginRight(scalar Scalar) Style

func MarginTop

func MarginTop(scalar Scalar) Style

func MaxWidth

func MaxWidth(scalar Scalar) Style

func MinWidth

func MinWidth(scalar Scalar) Style

func Overflow

func Overflow(overflow OverflowType) Style

func PadBottom

func PadBottom(scalar Scalar) Style

func PadLeft

func PadLeft(scalar Scalar) Style

func PadRight

func PadRight(scalar Scalar) Style

func PadTop

func PadTop(scalar Scalar) Style

func Padding

func Padding() Style

func Position

func Position(position PositionType) Style

func Repel

func Repel() Style

func Width

func Width(scalar Scalar) Style

type Tab

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

func NewTab

func NewTab(label string, body View) *Tab

func NewTabWithIcon

func NewTabWithIcon(ico icon.Icon, label string, body View) *Tab

func NewTabWithStackedIcon

func NewTabWithStackedIcon(ico icon.Icon, label string, body View) *Tab

type TabView

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

func NewTabView

func NewTabView() *TabView

func (TabView) Context

func (b TabView) Context() Context

func (*TabView) Release

func (t *TabView) Release()

func (TabView) Scope

func (b TabView) Scope() context.Context

func (*TabView) Self

func (t *TabView) Self(ref **TabView) *TabView

Self assigns the receiver to the given pointer to reference

func (*TabView) SetActive

func (t *TabView) SetActive(idx int) *TabView

func (*TabView) SetScrollable

func (t *TabView) SetScrollable(b bool) *TabView

func (*TabView) SetTabs

func (t *TabView) SetTabs(tabs ...*Tab) *TabView

func (*TabView) Style

func (t *TabView) Style(style ...Style) *TabView

type Table

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

func NewTable

func NewTable() *Table

func (*Table) AddRow

func (t *Table) AddRow(columns ...View) *Table

func (*Table) Align

func (t *Table) Align(colIdx int, align Alignment) *Table

func (Table) Context

func (b Table) Context() Context

func (Table) Release

func (b Table) Release()

func (*Table) RowSelection

func (t *Table) RowSelection() bool

func (Table) Scope

func (b Table) Scope() context.Context

func (*Table) Selected

func (t *Table) Selected() []int

Selected returns the zero based indices of row which are selected

func (*Table) Self

func (t *Table) Self(ref **Table) *Table

Self assigns the receiver to the given pointer to reference

func (*Table) SetHeader

func (t *Table) SetHeader(columns ...View) *Table

func (*Table) SetRowClickListener

func (t *Table) SetRowClickListener(f func(v View, rowIdx int)) *Table

SetRowClickListener registers a row click listener, which has nothing to do with the row selection.

func (*Table) SetRowSelection

func (t *Table) SetRowSelection(b bool) *Table

func (*Table) SetSelected

func (t *Table) SetSelected(rows ...int) *Table

func (*Table) SetSelectionChangeListener

func (t *Table) SetSelectionChangeListener(f func(t *Table)) *Table

func (*Table) Style

func (t *Table) Style(style ...Style) *Table

type Text

type Text struct {
	Value string
	// contains filtered or unexported fields
}

func NewText

func NewText(str string) *Text

func (Text) Context

func (b Text) Context() Context

func (Text) Release

func (b Text) Release()

func (Text) Scope

func (b Text) Scope() context.Context

func (*Text) Self

func (t *Text) Self(ref **Text) *Text

Self assigns the receiver to the given pointer to reference

func (*Text) Set

func (t *Text) Set(str string) *Text

func (*Text) Style

func (t *Text) Style(style ...Style) *Text

type TextArea

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

func NewTextArea

func NewTextArea() *TextArea

func (TextArea) Context

func (b TextArea) Context() Context

func (*TextArea) InputStyle

func (t *TextArea) InputStyle(styles ...Style) *TextArea

Styles changes the

func (TextArea) Release

func (b TextArea) Release()

func (TextArea) Scope

func (b TextArea) Scope() context.Context

func (*TextArea) Self

func (t *TextArea) Self(ref **TextArea) *TextArea

Self assigns the receiver to the given reference

func (*TextArea) SetEnabled

func (t *TextArea) SetEnabled(b bool) *TextArea

func (*TextArea) SetHelper

func (t *TextArea) SetHelper(str string) *TextArea

func (*TextArea) SetInvalid

func (t *TextArea) SetInvalid(b bool) *TextArea

func (*TextArea) SetLabel

func (t *TextArea) SetLabel(str string) *TextArea

func (*TextArea) SetMaxLength

func (t *TextArea) SetMaxLength(chars int) *TextArea

func (*TextArea) SetRequired

func (t *TextArea) SetRequired(b bool) *TextArea

func (*TextArea) SetText

func (t *TextArea) SetText(str string) *TextArea

func (*TextArea) Style

func (t *TextArea) Style(style ...Style) *TextArea

Styles changes the container

type TextField

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

func NewTextField

func NewTextField() *TextField

func (*TextField) AddClickListener

func (t *TextField) AddClickListener(f func(v View)) *TextField

AddClickListener registers another click listener

func (*TextField) AddFocusChangeListener

func (t *TextField) AddFocusChangeListener(f func(v View, hasFocus bool)) *TextField

AddFocusOutListener registers another key listener

func (*TextField) AddKeyDownListener

func (t *TextField) AddKeyDownListener(f func(v View, keyCode int)) *TextField

AddKeyDownListener registers another key listener

func (*TextField) AddKeyUpListener

func (t *TextField) AddKeyUpListener(f func(v View, keyCode int)) *TextField

AddKeyUpListener registers another key listener

func (*TextField) AddLeadingIconClickListener

func (t *TextField) AddLeadingIconClickListener(f func(v View)) *TextField

func (*TextField) AddTrailingIconClickListener

func (t *TextField) AddTrailingIconClickListener(f func(v View)) *TextField

func (*TextField) BindInt

func (t *TextField) BindInt(s *int) *TextField

BindInt is a shortcut for IntProperty().Bind() and returning self. Initially the value is read from the pointers position and the component is populated. Afterwards only the value at the pointer location is updated by the component.

Text values which cannot be parsed as integers, are ignored.

func (*TextField) BindText

func (t *TextField) BindText(s *string) *TextField

BindText is a shortcut for TextProperty().Bind() and returning self. Initially the value is read from the pointers position and the component is populated. Afterwards only the value at the pointer location is updated by the component.

func (TextField) Context

func (b TextField) Context() Context

func (*TextField) IntProperty

func (t *TextField) IntProperty() property.Int

IntProperty returns an int property to set or get the text with integer to string conversions.

func (*TextField) Release

func (t *TextField) Release()

func (TextField) Scope

func (b TextField) Scope() context.Context

func (*TextField) Self

func (t *TextField) Self(ref **TextField) *TextField

Self assigns the receiver to the given reference

func (*TextField) SetEnabled

func (t *TextField) SetEnabled(b bool) *TextField

func (*TextField) SetHelper

func (t *TextField) SetHelper(str string) *TextField

func (*TextField) SetHelperPersistent

func (t *TextField) SetHelperPersistent(b bool) *TextField

func (*TextField) SetInputType

func (t *TextField) SetInputType(in InputType) *TextField

func (*TextField) SetInvalid

func (t *TextField) SetInvalid(b bool) *TextField

func (*TextField) SetLabel

func (t *TextField) SetLabel(str string) *TextField

func (*TextField) SetLeadingIcon

func (t *TextField) SetLeadingIcon(ico icon.Icon) *TextField

func (*TextField) SetMaxLength

func (t *TextField) SetMaxLength(chars int) *TextField

func (*TextField) SetRange

func (t *TextField) SetRange(min, max int) *TextField

func (*TextField) SetRequired

func (t *TextField) SetRequired(b bool) *TextField

func (*TextField) SetText

func (t *TextField) SetText(str string) *TextField

SetText updates the text

func (*TextField) SetTrailingIcon

func (t *TextField) SetTrailingIcon(ico icon.Icon) *TextField

func (*TextField) Style

func (t *TextField) Style(style ...Style) *TextField

Styles changes the container

func (*TextField) Text

func (t *TextField) Text() string

Text returns the current text

func (*TextField) TextProperty

func (t *TextField) TextProperty() property.String

TextProperty returns a text property to set or get the text.

type ThemeController

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

func Theme

func Theme() ThemeController

func (ThemeController) Color

func (t ThemeController) Color() Color

Color returns the current primary theme background color

func (ThemeController) ForegroundColor

func (t ThemeController) ForegroundColor() Color

ForegroundColor returns the current primary theme foreground color

func (ThemeController) SetColor

func (t ThemeController) SetColor(color Color)

Color sets the current primary theme background color

func (ThemeController) SetForegroundColor

func (t ThemeController) SetForegroundColor(color Color)

SetForegroundColor sets the current primary theme foreground color

type TopAppBar

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

func NewTopAppBar

func NewTopAppBar() *TopAppBar

func (*TopAppBar) AddActions

func (t *TopAppBar) AddActions(items ...*IconItem) *TopAppBar

func (TopAppBar) Context

func (b TopAppBar) Context() Context

func (TopAppBar) Release

func (b TopAppBar) Release()

func (TopAppBar) Scope

func (b TopAppBar) Scope() context.Context

func (*TopAppBar) Self

func (t *TopAppBar) Self(ref **TopAppBar) *TopAppBar

Self assigns the receiver to the given pointer to reference

func (*TopAppBar) SetNavigation

func (t *TopAppBar) SetNavigation(i icon.Icon, action func(view View)) *TopAppBar

func (*TopAppBar) SetTitle

func (t *TopAppBar) SetTitle(str string) *TopAppBar

func (*TopAppBar) Style

func (t *TopAppBar) Style(style ...Style) *TopAppBar

type TypeWeight

type TypeWeight string
const WeightBolder TypeWeight = "500"
const WeightLighter TypeWeight = "lighter"
const WeightNormal TypeWeight = "normal"

type VStack

type VStack struct {
	*Grid
}

VStack is actually a vertical grid, with just a single column.

func NewVStack

func NewVStack(views ...View) *VStack

NewVStack creates a new vertical stack

func (*VStack) AddViews

func (t *VStack) AddViews(views ...View) *VStack

func (*VStack) AppendViews

func (t *VStack) AppendViews(views ...View) ViewGroup

func (*VStack) ClearViews

func (t *VStack) ClearViews() ViewGroup

func (VStack) Context

func (b VStack) Context() Context

func (VStack) Release

func (b VStack) Release()

func (*VStack) RemoveAll

func (t *VStack) RemoveAll() *VStack

func (VStack) Scope

func (b VStack) Scope() context.Context

func (*VStack) Self

func (t *VStack) Self(ref **VStack) *VStack

Self assigns the receiver to the given reference

func (*VStack) Style

func (t *VStack) Style(style ...Style) *VStack

Style applies generic style attributes.

func (*VStack) StyleFor

func (t *VStack) StyleFor(criteria MediaCriteria, style ...Style) *VStack

StyleFor applies the given styles only if the criteria is met.

type View

type View interface {
	Resource
	Context() Context       // Context of View, usually taken from the top-most root, where parent is nil
	Scope() context.Context // Scope of the view, which is cancelled as soon as the view is destroyed.
	// contains filtered or unexported methods
}

A View is a absComponent on screen. It may not be visible, if it has not been attached yet. It is usually created through a constructor method (New<View>) and is a pointer to a struct, which itself may contain more components. It is not safe to be used concurrently and must only be modified by the UI thread.

type ViewGroup

type ViewGroup interface {
	View
	ClearViews() ViewGroup
	AppendViews(views ...View) ViewGroup
}

ViewGroup is a generic interface which all view groups should support. Sadly go does not allow covariant return types in interfaces, so we have to define another signature set. See also https://github.com/golang/go/issues/30602.

type Watch

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

func NewWatch

func NewWatch(expected string) *Watch

func (*Watch) AddListener

func (a *Watch) AddListener(f func(found string, expected string)) Resource

func (*Watch) Check

func (a *Watch) Check()

func (*Watch) SetInterval

func (a *Watch) SetInterval(d time.Duration)

func (*Watch) Start

func (a *Watch) Start()

func (*Watch) Stop

func (a *Watch) Stop()

type Window

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

func GetWindow

func GetWindow(view View) *Window

GetWindow tries to return the window from the given view tree. The window is usually the view root. If the view is not attached, returns nil.

func (*Window) AddView

func (w *Window) AddView(v View) *Window

func (*Window) AddViews

func (w *Window) AddViews(views ...View) *Window

func (*Window) AppendViews

func (w *Window) AppendViews(views ...View) ViewGroup

func (*Window) ClearViews

func (w *Window) ClearViews() ViewGroup

func (*Window) Context

func (w *Window) Context() Context

func (*Window) Release

func (w *Window) Release()

func (*Window) RemoveAll

func (w *Window) RemoveAll() *Window

func (*Window) RemoveView

func (w *Window) RemoveView(v View)

func (*Window) Scope

func (w *Window) Scope() context.Context

because releasing a window has no effect, this returned scope cannot be cancelled.

func (*Window) SetBackground

func (w *Window) SetBackground(url string) *Window

SetBackground sets the window background image buffer. The image is scaled using cover and centered inside.

Directories

Path Synopsis
event contains the wtk specific event types
event contains the wtk specific event types
views contains a more modular package structure, where each component has its own package.
views contains a more modular package structure, where each component has its own package.
hstepper
hstepper contains a horizontal stepper component.
hstepper contains a horizontal stepper component.

Jump to

Keyboard shortcuts

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