gui

package
v1.9.25 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2021 License: Unlicense Imports: 43 Imported by: 0

Documentation

Overview

Package gui implements the plan 9 from crypto space Gio GUI theme

Index

Constants

View Source
const (
	NW = 1 << iota
	NE
	SW
	SE
)
View Source
const Inf = 1e6

Variables

View Source
var F, E, W, I, D, T logg.LevelPrinter = logg.GetLogPrinterSet(subsystem)
View Source
var Scales = ScaleType{
	"H1":      96.0 / 16.0,
	"H2":      60.0 / 16.0,
	"H3":      48.0 / 16.0,
	"H4":      34.0 / 16.0,
	"H5":      24.0 / 16.0,
	"H6":      20.0 / 16.0,
	"Body1":   1,
	"Body2":   14.0 / 16.0,
	"Caption": 12.0 / 16.0,
}

Scales is the ratios against

TODO: shouldn't that 16.0 be the text size in the theme?

Functions

func CopyContextDimensionsWithMaxAxis added in v0.4.16

func CopyContextDimensionsWithMaxAxis(gtx l.Context, size image.Point, axis l.Axis) l.Context

CopyContextDimensionsWithMaxAxis copies the dimensions out with the max set by an image.Point along the axis

func EmptyFromSize added in v0.4.16

func EmptyFromSize(size image.Point) func(gtx l.Context) l.Dimensions

func EmptyMaxHeight added in v0.4.16

func EmptyMaxHeight() func(gtx l.Context) l.Dimensions

func EmptyMaxWidth added in v0.4.16

func EmptyMaxWidth() func(gtx l.Context) l.Dimensions

func EmptyMinHeight added in v0.4.16

func EmptyMinHeight() func(gtx l.Context) l.Dimensions

func EmptyMinWidth added in v0.4.16

func EmptyMinWidth() func(gtx l.Context) l.Dimensions

func EmptySpace added in v0.4.16

func EmptySpace(x, y int) func(gtx l.Context) l.Dimensions

func Fill added in v0.4.16

func Fill(gtx l.Context, col color.NRGBA) l.Dimensions

Fill is a general fill function that covers the background of the current context space

func GetDimension added in v0.4.16

func GetDimension(gtx l.Context, w l.Widget) (dim l.Dimensions)

func GetInfContext added in v0.4.16

func GetInfContext(gtx l.Context) l.Context

GetInfContext creates a context with infinite max constraints

func HexARGB added in v0.4.16

func HexARGB(s string) (c color.RGBA)

HexARGB converts a 32 bit hex string into a color specification

func HexNRGB added in v0.4.16

func HexNRGB(s string) (c color.NRGBA)

HexNRGB converts a 32 bit hex string into a color specification

func If added in v0.4.16

func If(value bool, t, f l.Widget) l.Widget

Types

type App added in v0.4.16

type App struct {
	*Window

	LogoClickable *Clickable
	ThemeHook     func()

	MenuOpen bool

	SideBarSize *unit.Value

	Size *int

	PreRendering bool
	Break1       float32
	// contains filtered or unexported fields
}

App defines an application with a header, sidebar/menu, right side button bar, changeable body page widget and pop-over layers

func (*App) ActivePage added in v0.4.16

func (a *App) ActivePage(activePage string) *App

func (*App) ActivePageGet added in v0.4.16

func (a *App) ActivePageGet() string

func (*App) ActivePageGetAtomic added in v0.4.16

func (a *App) ActivePageGetAtomic() *uberatomic.String

func (*App) BodyBackground added in v0.4.16

func (a *App) BodyBackground(bodyBackground string) *App

func (*App) BodyBackgroundGet added in v0.4.16

func (a *App) BodyBackgroundGet() string

func (*App) BodyColor added in v0.4.16

func (a *App) BodyColor(bodyColor string) *App

func (*App) BodyColorGet added in v0.4.16

func (a *App) BodyColorGet() string

func (*App) ButtonBar added in v0.4.16

func (a *App) ButtonBar(bar []l.Widget) *App

func (*App) ButtonBarGet added in v0.4.16

func (a *App) ButtonBarGet() (bar []l.Widget)

func (*App) CardBackground added in v0.4.16

func (a *App) CardBackground(cardBackground string) *App

func (*App) CardBackgroundGet added in v0.4.16

func (a *App) CardBackgroundGet() string

func (*App) CardColor added in v0.4.16

func (a *App) CardColor(cardColor string) *App

func (*App) CardColorGet added in v0.4.16

func (a *App) CardColorGet() string

func (*App) DimensionCaption added in v0.4.16

func (a *App) DimensionCaption(gtx l.Context) l.Dimensions

func (*App) Fn added in v0.4.16

func (a *App) Fn() func(gtx l.Context) l.Dimensions

Fn renders the app widget

func (*App) HideSideBar added in v0.4.16

func (a *App) HideSideBar(hideSideBar bool) *App

func (*App) HideSideBarGet added in v0.4.16

func (a *App) HideSideBarGet() bool

func (*App) HideTitleBar added in v0.4.16

func (a *App) HideTitleBar(hideTitleBar bool) *App

func (*App) HideTitleBarGet added in v0.4.16

func (a *App) HideTitleBarGet() bool

func (*App) Layers added in v0.4.16

func (a *App) Layers(widgets []l.Widget) *App

func (*App) LayersGet added in v0.4.16

func (a *App) LayersGet() []l.Widget

func (*App) LogoAndTitle added in v0.4.16

func (a *App) LogoAndTitle(gtx l.Context) l.Dimensions

func (*App) MainDirection added in v1.9.16

func (a *App) MainDirection() l.Direction

func (*App) MainFrame added in v0.4.16

func (a *App) MainFrame(gtx l.Context) l.Dimensions

func (*App) MenuBackground added in v0.4.16

func (a *App) MenuBackground(menuBackground string) *App

func (*App) MenuBackgroundGet added in v0.4.16

func (a *App) MenuBackgroundGet() string

func (*App) MenuButton added in v0.4.16

func (a *App) MenuButton(gtx l.Context) l.Dimensions

func (*App) MenuColor added in v0.4.16

func (a *App) MenuColor(menuColor string) *App

func (*App) MenuColorGet added in v0.4.16

func (a *App) MenuColorGet() string

func (*App) MenuIcon added in v0.4.16

func (a *App) MenuIcon(menuIcon *[]byte) *App

func (*App) MenuIconGet added in v0.4.16

func (a *App) MenuIconGet() *[]byte

func (*App) NoMenuButton added in v0.4.16

func (a *App) NoMenuButton(_ l.Context) l.Dimensions

func (*App) Pages added in v0.4.16

func (a *App) Pages(widgets WidgetMap) *App

func (*App) PagesGet added in v0.4.16

func (a *App) PagesGet() WidgetMap

func (*App) Placeholder added in v1.9.16

func (a *App) Placeholder(title string) func(gtx l.Context) l.Dimensions

func (*App) RenderButtonBar added in v0.4.16

func (a *App) RenderButtonBar(gtx l.Context) l.Dimensions

func (*App) RenderHeader added in v0.4.16

func (a *App) RenderHeader(gtx l.Context) l.Dimensions

func (*App) RenderPage added in v0.4.16

func (a *App) RenderPage(gtx l.Context) l.Dimensions

func (*App) RenderStatusBar added in v0.4.16

func (a *App) RenderStatusBar(gtx l.Context) l.Dimensions

func (*App) Root added in v0.4.16

func (a *App) Root(root *Stack) *App

func (*App) RootGet added in v0.4.16

func (a *App) RootGet() *Stack

func (*App) SetMainDirection added in v1.9.16

func (a *App) SetMainDirection(direction l.Direction) *App

func (*App) SetThemeHook added in v1.9.23

func (a *App) SetThemeHook(f func()) *App

func (*App) SideBar added in v0.4.16

func (a *App) SideBar(widgets []l.Widget) *App

func (*App) SideBarBackground added in v0.4.16

func (a *App) SideBarBackground(sideBarBackground string) *App

func (*App) SideBarBackgroundGet added in v0.4.16

func (a *App) SideBarBackgroundGet() string

func (*App) SideBarColor added in v0.4.16

func (a *App) SideBarColor(sideBarColor string) *App

func (*App) SideBarColorGet added in v0.4.16

func (a *App) SideBarColorGet() string

func (*App) SideBarGet added in v0.4.16

func (a *App) SideBarGet() []l.Widget

func (*App) StatusBar added in v0.4.16

func (a *App) StatusBar(bar, barR []l.Widget) *App

func (*App) StatusBarBackground added in v0.4.16

func (a *App) StatusBarBackground(statusBarBackground string) *App

func (*App) StatusBarBackgroundGet added in v0.4.16

func (a *App) StatusBarBackgroundGet() string

func (*App) StatusBarColor added in v0.4.16

func (a *App) StatusBarColor(statusBarColor string) *App

func (*App) StatusBarColorGet added in v0.4.16

func (a *App) StatusBarColorGet() string

func (*App) StatusBarGet added in v0.4.16

func (a *App) StatusBarGet() (bar []l.Widget)

func (*App) Title added in v0.4.16

func (a *App) Title(title string) *App

func (*App) TitleBarBackground added in v0.4.16

func (a *App) TitleBarBackground(TitleBarBackground string) *App

func (*App) TitleBarBackgroundGet added in v0.4.16

func (a *App) TitleBarBackgroundGet() string

func (*App) TitleBarColor added in v0.4.16

func (a *App) TitleBarColor(titleBarColor string) *App

func (*App) TitleBarColorGet added in v0.4.16

func (a *App) TitleBarColorGet() string

func (*App) TitleFont added in v0.4.16

func (a *App) TitleFont(font string) *App

func (*App) TitleFontGet added in v0.4.16

func (a *App) TitleFontGet() string

func (*App) TitleGet added in v0.4.16

func (a *App) TitleGet() string

type Bool added in v0.4.16

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

func (*Bool) Changed added in v0.4.16

func (b *Bool) Changed() bool

Changed reports whether value has changed since the last call to Changed

func (*Bool) Fn added in v0.4.16

func (b *Bool) Fn(gtx layout.Context) layout.Dimensions

Fn renders the events of the boolean widget

func (*Bool) GetValue added in v0.4.16

func (b *Bool) GetValue() bool

GetValue gets the boolean value stored in the widget

func (*Bool) History added in v0.4.16

func (b *Bool) History() []press

History returns the history of presses in the buffer

func (*Bool) SetOnChange added in v0.4.16

func (b *Bool) SetOnChange(fn BoolHook) *Bool

SetOnChange sets the callback function to run when the state changes

func (*Bool) Value added in v0.4.16

func (b *Bool) Value(value bool)

Value sets the value of the boolean stored in the widget

type BoolHook added in v0.4.16

type BoolHook func(b bool)

type Border added in v0.4.16

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

Border lays out a widget and draws a border inside it.

func (*Border) Color added in v0.4.16

func (b *Border) Color(color string) *Border

Color sets the color to render the border in

func (*Border) CornerRadius added in v0.4.16

func (b *Border) CornerRadius(rad float32) *Border

CornerRadius sets the radius of the curve on the corners

func (*Border) Corners added in v1.9.16

func (b *Border) Corners(corners int) *Border

Corners sets the corners that are rounded

func (*Border) Embed added in v0.4.16

func (b *Border) Embed(w layout.Widget) *Border

func (*Border) Fn added in v0.4.16

func (b *Border) Fn(gtx layout.Context) layout.Dimensions

Fn renders the border

func (*Border) Width added in v0.4.16

func (b *Border) Width(width float32) *Border

Width sets the width of the border line

type Button added in v0.4.16

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

Button is a material text label icon with options to change all features

func (*Button) Background added in v0.4.16

func (b *Button) Background(background string) *Button

Background sets the background color

func (*Button) Color added in v0.4.16

func (b *Button) Color(color string) *Button

Color sets the text color

func (*Button) CornerRadius added in v0.4.16

func (b *Button) CornerRadius(cornerRadius float32) *Button

CornerRadius sets the corner radius (all measurements are scaled from the base text size)

func (*Button) Fn added in v0.4.16

func (b *Button) Fn(gtx l.Context) l.Dimensions

Fn renders the button

func (*Button) Font added in v0.4.16

func (b *Button) Font(font string) *Button

Font sets the font style

func (*Button) Inset added in v0.4.16

func (b *Button) Inset(scale float32) *Button

Inset sets the inset between the button border and the text

func (*Button) SetCancel added in v0.4.16

func (b *Button) SetCancel(fn func()) *Button

SetCancel sets the callback to run when the user presses down over the button but then moves out of its hitbox before release (click)

func (*Button) SetClick added in v0.4.16

func (b *Button) SetClick(fn func()) *Button

SetClick defines the callback to run on a click (mouse up) event

func (*Button) SetPress added in v0.4.16

func (b *Button) SetPress(fn func()) *Button

func (*Button) Text added in v0.4.16

func (b *Button) Text(text string) *Button

Text sets the text on the button

func (*Button) TextScale added in v0.4.16

func (b *Button) TextScale(scale float32) *Button

TextScale sets the dimensions of the text as a fraction of the base text size

type ButtonLayout added in v0.4.16

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

func (*ButtonLayout) Background added in v0.4.16

func (b *ButtonLayout) Background(color string) *ButtonLayout

Background sets the background color of the button

func (*ButtonLayout) CornerRadius added in v0.4.16

func (b *ButtonLayout) CornerRadius(radius float32) *ButtonLayout

CornerRadius sets the radius of the corners of the button

func (*ButtonLayout) Corners added in v1.9.16

func (b *ButtonLayout) Corners(corners int) *ButtonLayout

Corners sets which corners have the radius of rounding

func (*ButtonLayout) Embed added in v0.4.16

func (b *ButtonLayout) Embed(w l.Widget) *ButtonLayout

Embed a widget in the button

func (*ButtonLayout) Fn added in v0.4.16

func (b *ButtonLayout) Fn(gtx l.Context) l.Dimensions

Fn is the function that draws the button and its child widget

func (*ButtonLayout) SetCancel added in v0.4.16

func (b *ButtonLayout) SetCancel(fn func()) *ButtonLayout

func (*ButtonLayout) SetClick added in v0.4.16

func (b *ButtonLayout) SetClick(fn func()) *ButtonLayout

func (*ButtonLayout) SetPress added in v0.4.16

func (b *ButtonLayout) SetPress(fn func()) *ButtonLayout

type CallbackQueue added in v0.4.16

type CallbackQueue chan func() error

func NewCallbackQueue added in v0.4.16

func NewCallbackQueue(bufSize int) CallbackQueue

type Cell added in v0.4.16

type Cell struct {
	l.Widget

	// priority only has meaning for the header row in defining an order of eliminating elements to fit a width.
	// When trimming size to fit width add from highest to lowest priority and stop when dimensions exceed the target.
	Priority int
	// contains filtered or unexported fields
}

type CellGrid added in v0.4.16

type CellGrid []CellRow

type CellPriorities added in v0.4.16

type CellPriorities []CellPriority

func (CellPriorities) Len added in v0.4.16

func (c CellPriorities) Len() int

Len sorts a cell row by priority

func (CellPriorities) Less added in v0.4.16

func (c CellPriorities) Less(i, j int) bool

func (CellPriorities) Swap added in v0.4.16

func (c CellPriorities) Swap(i, j int)

type CellPriority added in v0.4.16

type CellPriority struct {
	Column   int
	Priority int
}

type CellRow added in v0.4.16

type CellRow []Cell

func (CellRow) GetPriority added in v0.4.16

func (c CellRow) GetPriority() (out CellPriorities)

type ChangeEvent added in v0.4.16

type ChangeEvent struct{}

A ChangeEvent is generated for every user change to the text.

type Checkable added in v0.4.16

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

func (*Checkable) CheckedStateIcon added in v0.4.16

func (c *Checkable) CheckedStateIcon(ic *[]byte) *Checkable

CheckedStateIcon loads the icon for the checked state

func (*Checkable) Color added in v0.4.16

func (c *Checkable) Color(color string) *Checkable

Color sets the color of the checkbox label

func (*Checkable) Fn added in v0.4.16

func (c *Checkable) Fn(gtx l.Context, checked bool) l.Dimensions

Fn renders the checkbox widget

func (*Checkable) Font added in v0.4.16

func (c *Checkable) Font(font string) *Checkable

Font sets the font used on the label

func (*Checkable) IconColor added in v0.4.16

func (c *Checkable) IconColor(color string) *Checkable

IconColor sets the color of the icon

func (*Checkable) Label added in v0.4.16

func (c *Checkable) Label(txt string) *Checkable

Label sets the label on the checkbox

func (*Checkable) Scale added in v0.4.16

func (c *Checkable) Scale(size float32) *Checkable

Scale sets the size of the checkbox icon relative to the base font size

func (*Checkable) TextScale added in v0.4.16

func (c *Checkable) TextScale(scale float32) *Checkable

TextScale sets the size of the font relative to the base text size

func (*Checkable) UncheckedStateIcon added in v0.4.16

func (c *Checkable) UncheckedStateIcon(ic *[]byte) *Checkable

UncheckedStateIcon loads the icon for the unchecked state

type Checkbox added in v0.4.16

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

func (*Checkbox) Fn added in v0.4.16

func (c *Checkbox) Fn(gtx l.Context) l.Dimensions

Fn renders the checkbox

func (*Checkbox) IconColor added in v0.4.16

func (c *Checkbox) IconColor(color string) *Checkbox

IconColor sets the color of the icon in the checkbox

func (*Checkbox) IconScale added in v0.4.16

func (c *Checkbox) IconScale(scale float32) *Checkbox

IconScale sets the scaling of the check icon

func (*Checkbox) SetOnChange added in v0.4.16

func (c *Checkbox) SetOnChange(fn func(b bool)) *Checkbox

SetOnChange sets the callback when a state change event occurs

func (*Checkbox) Text added in v0.4.16

func (c *Checkbox) Text(label string) *Checkbox

Text sets the text to be rendered on the checkbox

func (*Checkbox) TextColor added in v0.4.16

func (c *Checkbox) TextColor(color string) *Checkbox

TextColor sets the color of the text label

func (*Checkbox) TextScale added in v0.4.16

func (c *Checkbox) TextScale(scale float32) *Checkbox

TextScale sets the scale relative to the base font size for the text label

type Clickable added in v0.4.16

type Clickable struct {
	*Window

	Events clickEvents
	// contains filtered or unexported fields
}

Clickable represents a clickable area.

func (*Clickable) Clicked added in v0.4.16

func (c *Clickable) Clicked() bool

Clicked reports whether there are pending clicks as would be reported by Clicks. If so, Clicked removes the earliest click.

func (*Clickable) Clicks added in v0.4.16

func (c *Clickable) Clicks() []click

Clicks returns and clear the clicks since the last call to Clicks.

func (*Clickable) Fn added in v0.4.16

func (c *Clickable) Fn(gtx l.Context) l.Dimensions

func (*Clickable) History added in v0.4.16

func (c *Clickable) History() []press

History is the past pointer presses useful for drawing markers. History is retained for a short duration (about a second).

func (*Clickable) SetCancel added in v0.4.16

func (c *Clickable) SetCancel(fn func()) *Clickable

func (*Clickable) SetClick added in v0.4.16

func (c *Clickable) SetClick(fn func()) *Clickable

func (*Clickable) SetPress added in v0.4.16

func (c *Clickable) SetPress(fn func()) *Clickable

type Collection added in v0.4.16

type Collection []text.FontFace

func (Collection) Font added in v0.4.16

func (c Collection) Font(font string) (out text.Font, e error)

type Colors added in v0.4.16

type Colors struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Colors is a map of names to hex strings specifying colors

func (*Colors) GetNRGBAFromName added in v0.4.16

func (c *Colors) GetNRGBAFromName(co string) color.NRGBA

GetNRGBAFromName returns the named color from the map

func (*Colors) SetTheme added in v0.4.16

func (c *Colors) SetTheme(dark bool)

SetTheme to dark or light

type Column added in v0.4.16

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

func (*Column) Fn added in v0.4.16

func (c *Column) Fn(gtx l.Context) l.Dimensions

func (*Column) List added in v0.4.16

func (c *Column) List(gtx l.Context) (max int, out []l.Widget)

type ColumnRow added in v0.4.16

type ColumnRow struct {
	Label string
	W     l.Widget
}

type DimensionList added in v0.4.16

type DimensionList []l.Dimensions

func GetDimensionList added in v0.4.16

func GetDimensionList(gtx l.Context, length int, listElement ListElement) (dims DimensionList)

GetDimensionList returns a dimensionlist based on the given listelement

func (DimensionList) CoordinateToPosition added in v0.4.16

func (d DimensionList) CoordinateToPosition(coordinate int, axis l.Axis) (position Position)

CoordinateToPosition converts an absolute coordinate to a list position

func (DimensionList) GetSizes added in v0.4.16

func (d DimensionList) GetSizes(position Position, axis l.Axis) (total, before int)

func (DimensionList) GetTotal added in v0.4.16

func (d DimensionList) GetTotal(axis l.Axis) (total int)

func (DimensionList) PositionToCoordinate added in v0.4.16

func (d DimensionList) PositionToCoordinate(position Position, axis l.Axis) (coordinate int)

PositionToCoordinate converts a list position to absolute coordinate

type Direction added in v0.4.16

type Direction struct {
	l.Direction
	// contains filtered or unexported fields
}

func (*Direction) Center added in v0.4.16

func (d *Direction) Center() (out *Direction)

Center sets the relevant direction for the Direction layout

func (*Direction) E added in v0.4.16

func (d *Direction) E() (out *Direction)

E sets the relevant direction for the Direction layout

func (*Direction) Embed added in v0.4.16

func (d *Direction) Embed(w l.Widget) *Direction

func (*Direction) Fn added in v0.4.16

func (d *Direction) Fn(c l.Context) l.Dimensions

Fn the given widget given the context and direction

func (*Direction) N added in v0.4.16

func (d *Direction) N() (out *Direction)

N sets the relevant direction for the Direction layout

func (*Direction) NE added in v0.4.16

func (d *Direction) NE() (out *Direction)

NE sets the relevant direction for the Direction layout

func (*Direction) NW added in v0.4.16

func (d *Direction) NW() (out *Direction)

NW sets the relevant direction for the Direction layout

func (*Direction) S added in v0.4.16

func (d *Direction) S() (out *Direction)

S sets the relevant direction for the Direction layout

func (*Direction) SE added in v0.4.16

func (d *Direction) SE() (out *Direction)

SE sets the relevant direction for the Direction layout

func (*Direction) SW added in v0.4.16

func (d *Direction) SW() (out *Direction)

SW sets the relevant direction for the Direction layout

func (*Direction) W added in v0.4.16

func (d *Direction) W() (out *Direction)

W sets the relevant direction for the Direction layout

type Editor added in v0.4.16

type Editor struct {
	Caret struct {

		// Line is the caret line position as an index into lines.
		Line int
		// Col is the caret column measured in runes.
		Col int
		// contains filtered or unexported fields
	}
	// contains filtered or unexported fields
}

Editor implements an editable and scrollable text area.

func (*Editor) Alignment added in v0.4.16

func (e *Editor) Alignment(alignment text.Alignment) *Editor

func (*Editor) CaretCoords added in v0.4.16

func (e *Editor) CaretCoords() f32.Point

CaretCoords returns the coordinates of the caret, relative to the editor itself.

func (*Editor) CaretPos added in v0.4.16

func (e *Editor) CaretPos() (line, col int)

CaretPos returns the line & column numbers of the caret.

func (*Editor) Delete added in v0.4.16

func (e *Editor) Delete(runes int)

Delete runes from the caret position. The sign of runes specifies the direction to delete: positive is forward, negative is backward.

func (*Editor) Events added in v0.4.16

func (e *Editor) Events() []EditorEvent

Events returns available editor events.

func (*Editor) Focus added in v0.4.16

func (e *Editor) Focus()

Focus requests the input focus for the _editor.

func (*Editor) Focused added in v0.4.16

func (e *Editor) Focused() bool

Focused returns whether the editor is focused or not.

func (*Editor) Insert added in v0.4.16

func (e *Editor) Insert(s string)

Insert inserts text at the caret, moving the caret forward.

func (*Editor) Layout added in v0.4.16

func (e *Editor) Layout(gtx layout.Context, sh text.Shaper, font text.Font, size unit.Value) layout.Dimensions

Layout lays out the editor.

func (*Editor) Len added in v0.4.16

func (e *Editor) Len() int

Len is the length of the editor contents.

func (*Editor) Mask added in v0.4.16

func (e *Editor) Mask(mask rune) *Editor

func (*Editor) Move added in v0.4.16

func (e *Editor) Move(distance int)

Move the caret: positive distance moves forward, negative distance moves backward.

func (*Editor) NumLines added in v0.4.16

func (e *Editor) NumLines() int

NumLines returns the number of lines in the editor.

func (*Editor) PaintCaret added in v0.4.16

func (e *Editor) PaintCaret(gtx layout.Context)

func (*Editor) PaintText added in v0.4.16

func (e *Editor) PaintText(gtx layout.Context)

func (*Editor) SetChange added in v0.4.16

func (e *Editor) SetChange(changeFn func(txt string)) *Editor

func (*Editor) SetFocus added in v0.4.16

func (e *Editor) SetFocus(focusFn func(is bool)) *Editor

func (*Editor) SetSubmit added in v0.4.16

func (e *Editor) SetSubmit(submitFn func(txt string)) *Editor

func (*Editor) SetText added in v0.4.16

func (e *Editor) SetText(s string) *Editor

SetText replaces the contents of the editor.

func (*Editor) SingleLine added in v0.4.16

func (e *Editor) SingleLine() *Editor

func (*Editor) Submit added in v0.4.16

func (e *Editor) Submit(submit bool) *Editor

func (*Editor) Text added in v0.4.16

func (e *Editor) Text() string

Text returns the contents of the editor.

type EditorEvent added in v0.4.16

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

type Enum added in v0.4.16

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

func (*Enum) Changed added in v0.4.16

func (e *Enum) Changed() bool

Changed reports whether Value has changed by user interaction since the last call to Changed.

func (*Enum) Fn added in v0.4.16

func (e *Enum) Fn(gtx layout.Context, key string) layout.Dimensions

Fn adds the event handler for key.

func (*Enum) SetOnChange added in v0.4.16

func (e *Enum) SetOnChange(hook func(value string)) *Enum

func (*Enum) SetValue added in v0.4.16

func (e *Enum) SetValue(value string) *Enum

func (*Enum) Value added in v0.4.16

func (e *Enum) Value() string

type Filler added in v0.4.16

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

Filler fills the background of a widget with a specified color and corner radius

func (*Filler) Fn added in v0.4.16

func (f *Filler) Fn(gtx l.Context) l.Dimensions

Fn renders the fill with the widget inside

type Flex added in v0.4.16

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

func (*Flex) AlignBaseline added in v0.4.16

func (f *Flex) AlignBaseline() (out *Flex)

AlignBaseline sets alignment for layout from Baseline

func (*Flex) AlignEnd added in v0.4.16

func (f *Flex) AlignEnd() (out *Flex)

AlignEnd sets alignment for layout from End

func (*Flex) AlignMiddle added in v0.4.16

func (f *Flex) AlignMiddle() (out *Flex)

AlignMiddle sets alignment for layout from Middle

func (*Flex) AlignStart added in v0.4.16

func (f *Flex) AlignStart() (out *Flex)

AlignStart sets alignment for layout from Start

func (*Flex) Flexed added in v0.4.16

func (f *Flex) Flexed(wgt float32, w l.Widget) (out *Flex)

Flexed inserts a flexed widget into the flex

func (*Flex) Fn added in v0.4.16

func (f *Flex) Fn(c l.Context) l.Dimensions

Fn runs the ops in the context using the FlexChildren inside it

func (*Flex) Rigid added in v0.4.16

func (f *Flex) Rigid(w l.Widget) (out *Flex)

Rigid inserts a rigid widget into the flex

func (*Flex) SpaceAround added in v0.4.16

func (f *Flex) SpaceAround() (out *Flex)

SpaceAround sets the corresponding flex spacing parameter

func (*Flex) SpaceBetween added in v0.4.16

func (f *Flex) SpaceBetween() (out *Flex)

SpaceBetween sets the corresponding flex spacing parameter

func (*Flex) SpaceEnd added in v0.4.16

func (f *Flex) SpaceEnd() (out *Flex)

SpaceEnd sets the corresponding flex spacing parameter

func (*Flex) SpaceEvenly added in v0.4.16

func (f *Flex) SpaceEvenly() (out *Flex)

SpaceEvenly sets the corresponding flex spacing parameter

func (*Flex) SpaceSides added in v0.4.16

func (f *Flex) SpaceSides() (out *Flex)

SpaceSides sets the corresponding flex spacing parameter

func (*Flex) SpaceStart added in v0.4.16

func (f *Flex) SpaceStart() (out *Flex)

SpaceStart sets the corresponding flex spacing parameter

func (*Flex) Vertical added in v0.4.16

func (f *Flex) Vertical() (out *Flex)

Vertical sets axis to vertical, otherwise it is horizontal

type Float added in v0.4.16

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

Float is for selecting a value in a range.

func (*Float) Changed added in v0.4.16

func (f *Float) Changed() bool

Changed reports whether the value has changed since the last call to Changed.

func (*Float) Fn added in v0.4.16

func (f *Float) Fn(gtx layout.Context, pointerMargin int, min, max float32) layout.Dimensions

Fn processes events.

func (*Float) Pos added in v0.4.16

func (f *Float) Pos() float32

Pos reports the selected position.

func (*Float) SetHook added in v0.4.16

func (f *Float) SetHook(fn func(fl float32)) *Float

func (*Float) SetValue added in v0.4.16

func (f *Float) SetValue(value float32) *Float

func (*Float) Value added in v0.4.16

func (f *Float) Value() float32

type Fonts added in v0.4.16

type Fonts map[string]text.Typeface

type Icon added in v0.4.16

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

func (*Icon) Color added in v0.4.16

func (i *Icon) Color(color string) *Icon

Color sets the color of the icon image. It must be called before creating the image

func (*Icon) Fn added in v0.4.16

func (i *Icon) Fn(gtx l.Context) l.Dimensions

Fn renders the icon

func (*Icon) Scale added in v0.4.16

func (i *Icon) Scale(scale float32) *Icon

Scale changes the size relative to the base font size

func (*Icon) Size added in v0.4.16

func (i *Icon) Size(size unit.Value) *Icon

func (*Icon) Src added in v0.4.16

func (i *Icon) Src(data *[]byte) *Icon

Src sets the icon source to draw from

type IconButton added in v0.4.16

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

func (*IconButton) Background added in v0.4.16

func (b *IconButton) Background(color string) *IconButton

Background sets the color of the circular background

func (*IconButton) ButtonInset added in v0.4.16

func (b *IconButton) ButtonInset(inset float32) *IconButton

ButtonInset sets the size of inset that goes in between the button background and the icon

func (*IconButton) Color added in v0.4.16

func (b *IconButton) Color(color string) *IconButton

Color sets the color of the icon

func (*IconButton) Corners added in v1.9.16

func (b *IconButton) Corners(corners int) *IconButton

Corners sets the corners that will be circular

func (*IconButton) Fn added in v0.4.16

func (b *IconButton) Fn(gtx l.Context) l.Dimensions

Fn renders the icon button

func (*IconButton) Icon added in v0.4.16

func (b *IconButton) Icon(ic *Icon) *IconButton

Icon sets the icon to display

func (*IconButton) Scale added in v0.4.16

func (b *IconButton) Scale(scale float32) *IconButton

Scale changes the size of the icon as a ratio of the base font size

func (*IconButton) SetCancel added in v0.4.16

func (b *IconButton) SetCancel(fn func()) *IconButton

SetCancel sets the function to run on cancel (click but release outside)

func (*IconButton) SetClick added in v0.4.16

func (b *IconButton) SetClick(fn func()) *IconButton

SetClick sets the function to run on click

func (*IconButton) SetPress added in v0.4.16

func (b *IconButton) SetPress(fn func()) *IconButton

SetPress sets the function to run on press

type IconByColor added in v0.4.16

type IconByColor map[color.NRGBA]paint.ImageOp

type IconBySize added in v0.4.16

type IconBySize map[float32]IconByColor

type IconCache added in v0.4.16

type IconCache map[*[]byte]IconBySize

type Icons added in v0.4.16

type Icons map[string]*Icon

type Image added in v0.4.16

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

Image is a widget that displays an image.

func (Image) Fn added in v0.4.16

func (i Image) Fn(gtx layout.Context) layout.Dimensions

func (*Image) Scale added in v0.4.16

func (i *Image) Scale(scale float32) *Image

func (*Image) Src added in v0.4.16

func (i *Image) Src(img paint.ImageOp) *Image

type IncDec added in v0.4.16

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

func (*IncDec) Amount added in v0.4.16

func (in *IncDec) Amount(n int) *IncDec

func (*IncDec) Background added in v0.4.16

func (in *IncDec) Background(color string) *IncDec

func (*IncDec) ChangeHook added in v0.4.16

func (in *IncDec) ChangeHook(fn func(n int)) *IncDec

func (*IncDec) Color added in v0.4.16

func (in *IncDec) Color(color string) *IncDec

func (*IncDec) Fn added in v0.4.16

func (in *IncDec) Fn(gtx l.Context) l.Dimensions

func (*IncDec) GetCurrent added in v0.4.16

func (in *IncDec) GetCurrent() int

func (*IncDec) Inactive added in v0.4.16

func (in *IncDec) Inactive(color string) *IncDec

func (*IncDec) Max added in v0.4.16

func (in *IncDec) Max(max int) *IncDec

func (*IncDec) Min added in v0.4.16

func (in *IncDec) Min(min int) *IncDec

func (*IncDec) NDigits added in v0.4.16

func (in *IncDec) NDigits(nDigits int) *IncDec

func (*IncDec) Scale added in v0.4.16

func (in *IncDec) Scale(n float32) *IncDec

func (*IncDec) SetCurrent added in v0.4.16

func (in *IncDec) SetCurrent(current int) *IncDec

type Indefinite added in v0.4.16

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

func (*Indefinite) Color added in v0.4.16

func (lo *Indefinite) Color(color string) *Indefinite

Color sets the color of the spinner

func (*Indefinite) Fn added in v0.4.16

func (lo *Indefinite) Fn(gtx l.Context) l.Dimensions

Fn renders the loader

func (*Indefinite) Scale added in v0.4.16

func (lo *Indefinite) Scale(scale float32) *Indefinite

Scale sets the size of the spinner

type Input added in v0.4.16

type Input struct {
	*Window

	GetText      func() string
	SetText      func(string)
	SetPasteFunc func() bool
	// contains filtered or unexported fields
}

func (*Input) Fn added in v0.4.16

func (in *Input) Fn(gtx l.Context) l.Dimensions

Fn renders the input widget

type Inset added in v0.4.16

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

func (*Inset) Embed added in v0.4.16

func (in *Inset) Embed(w l.Widget) *Inset

Embed sets the widget that will be inside the inset

func (*Inset) Fn added in v0.4.16

func (in *Inset) Fn(c l.Context) l.Dimensions

Fn lays out the given widget with the configured context and padding

type IntSlider added in v0.4.16

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

func (*IntSlider) Fn added in v0.4.16

func (i *IntSlider) Fn(gtx l.Context) l.Dimensions

func (*IntSlider) GetValue added in v0.4.16

func (i *IntSlider) GetValue() int

func (*IntSlider) Hook added in v0.4.16

func (i *IntSlider) Hook(fn func(v int)) *IntSlider

func (*IntSlider) Max added in v0.4.16

func (i *IntSlider) Max(max float32) *IntSlider

func (*IntSlider) Min added in v0.4.16

func (i *IntSlider) Min(min float32) *IntSlider

func (*IntSlider) Value added in v0.4.16

func (i *IntSlider) Value(value int) *IntSlider

type Label added in v0.4.16

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

Label is text drawn inside an empty box

func (*Label) Alignment added in v0.4.16

func (l *Label) Alignment(alignment text.Alignment) *Label

Alignment sets the text alignment, left, right or centered

func (*Label) Color added in v0.4.16

func (l *Label) Color(color string) *Label

Color sets the color of the label font

func (*Label) Fn added in v0.4.16

func (l *Label) Fn(gtx l.Context) l.Dimensions

Fn renders the label as specified

func (*Label) Font added in v0.4.16

func (l *Label) Font(font string) *Label

Font sets the font out of the available font collection

func (*Label) MaxLines added in v0.4.16

func (l *Label) MaxLines(maxLines int) *Label

MaxLines sets the maximum number of lines to render

func (*Label) Text added in v0.4.16

func (l *Label) Text(text string) *Label

Text sets the text to render in the label

func (*Label) TextScale added in v0.4.16

func (l *Label) TextScale(scale float32) *Label

TextScale sets the size of the text relative to the base font size

type List added in v0.4.16

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

List displays a subsection of a potentially infinitely large underlying list. List accepts user input to scroll the subsection.

func (*List) Active added in v0.4.16

func (li *List) Active(color string) *List

func (*List) Background added in v0.4.16

func (li *List) Background(color string) *List

func (*List) Baseline added in v0.4.16

func (li *List) Baseline() *List

func (*List) Color added in v0.4.16

func (li *List) Color(color string) *List

func (*List) DisableScroll added in v0.4.16

func (li *List) DisableScroll(disable bool) *List

func (*List) Dragging added in v0.4.16

func (li *List) Dragging() bool

Dragging reports whether the List is being dragged.

func (*List) End added in v0.4.16

func (li *List) End() *List

func (*List) Fn added in v0.4.16

func (li *List) Fn(gtx l.Context) l.Dimensions

Fn runs the layout in the configured context. The ListElement function returns the widget at the given index

func (*List) JumpToEnd added in v0.4.16

func (li *List) JumpToEnd()

func (*List) JumpToStart added in v0.4.16

func (li *List) JumpToStart()

func (*List) Layout added in v0.4.16

func (li *List) Layout(gtx l.Context, len int, w ListElement) l.Dimensions

Layout the List.

func (*List) LeftSide added in v0.4.16

func (li *List) LeftSide(b bool) (out *List)

func (*List) Length added in v0.4.16

func (li *List) Length(length int) *List

func (*List) ListElement added in v0.4.16

func (li *List) ListElement(w ListElement) *List

func (*List) Middle added in v0.4.16

func (li *List) Middle() *List

func (*List) Position added in v0.4.16

func (li *List) Position() Position

func (*List) ScrollToEnd added in v0.4.16

func (li *List) ScrollToEnd() (out *List)

ScrollToEnd sets the List to add new items to the end and push older ones up/left and initial render has scroll to the end (or bottom) of the List

func (*List) ScrollWidth added in v0.4.16

func (li *List) ScrollWidth(width int) *List

func (*List) SetPosition added in v0.4.16

func (li *List) SetPosition(position Position)

func (*List) Slice added in v0.4.16

func (li *List) Slice(gtx l.Context, widgets ...l.Widget) l.Widget

func (*List) Start added in v0.4.16

func (li *List) Start() *List

func (*List) Vertical added in v0.4.16

func (li *List) Vertical() (out *List)

Vertical sets the axis to vertical (default implicit is horizontal)

type ListElement added in v0.4.16

type ListElement func(gtx l.Context, index int) l.Dimensions

ListElement is a function that computes the dimensions of a list element.

type Multi added in v0.4.16

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

func (*Multi) Fn added in v0.4.16

func (m *Multi) Fn(gtx l.Context) l.Dimensions

func (*Multi) PopulateWidgets added in v0.4.16

func (m *Multi) PopulateWidgets() *Multi

func (*Multi) UpdateWidgets added in v0.4.16

func (m *Multi) UpdateWidgets() *Multi

func (*Multi) Widgets added in v0.4.16

func (m *Multi) Widgets() (widgets []l.Widget)

type Password added in v0.4.16

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

func (*Password) Blur added in v0.4.16

func (p *Password) Blur()

func (*Password) Fn added in v0.4.16

func (p *Password) Fn(gtx l.Context) l.Dimensions

func (*Password) Focus added in v0.4.16

func (p *Password) Focus()

func (*Password) GetPassword added in v0.4.16

func (p *Password) GetPassword() string

func (*Password) Hide added in v0.4.16

func (p *Password) Hide()

func (*Password) Show added in v0.4.16

func (p *Password) Show()

func (*Password) Wipe added in v0.4.16

func (p *Password) Wipe()

type Pool added in v0.4.16

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

func (*Pool) FreeBool added in v0.4.16

func (p *Pool) FreeBool(b *Bool)

func (*Pool) FreeCheckable added in v0.4.16

func (p *Pool) FreeCheckable(b *Checkable)

func (*Pool) FreeClickable added in v0.4.16

func (p *Pool) FreeClickable(b *Clickable)

func (*Pool) FreeEditor added in v0.4.16

func (p *Pool) FreeEditor(b *Editor)

func (*Pool) FreeIncDec added in v0.4.16

func (p *Pool) FreeIncDec(b *IncDec)

func (*Pool) FreeList added in v0.4.16

func (p *Pool) FreeList(b *List)

func (*Pool) GetBool added in v0.4.16

func (p *Pool) GetBool() (out *Bool)

func (*Pool) GetCheckable added in v0.4.16

func (p *Pool) GetCheckable() (out *Checkable)

func (*Pool) GetClickable added in v0.4.16

func (p *Pool) GetClickable() (out *Clickable)

func (*Pool) GetEditor added in v0.4.16

func (p *Pool) GetEditor() (out *Editor)

func (*Pool) GetIncDec added in v0.4.16

func (p *Pool) GetIncDec() (out *IncDec)

func (*Pool) GetList added in v0.4.16

func (p *Pool) GetList() (out *List)

func (*Pool) Reset added in v0.4.16

func (p *Pool) Reset()

type Position added in v0.4.16

type Position struct {
	// BeforeEnd tracks whether the List position is before the very end. We use "before end" instead of "at end" so
	// that the zero value of a Position struct is useful.
	//
	// When laying out a list, if ScrollToEnd is true and BeforeEnd is false, then First and Offset are ignored, and the
	// list is drawn with the last item at the bottom. If ScrollToEnd is false then BeforeEnd is ignored.
	BeforeEnd bool
	// First is the index of the first visible child.
	First int
	// Offset is the distance in pixels from the top edge to the child at index First.
	Offset int
}

Position is a List scroll offset represented as an offset from the top edge of a child element.

type ProgressBar added in v0.4.16

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

func (*ProgressBar) Color added in v0.4.16

func (p *ProgressBar) Color(c string) *ProgressBar

Color sets the color to render the bar in

func (*ProgressBar) Fn added in v0.4.16

func (p *ProgressBar) Fn(gtx l.Context) l.Dimensions

Fn renders the progress bar as it is currently configured

func (*ProgressBar) SetProgress added in v0.4.16

func (p *ProgressBar) SetProgress(progress int) *ProgressBar

SetProgress sets the progress of the progress bar

type RadioButton added in v0.4.16

type RadioButton struct {
	*Checkable
	*Window
	// contains filtered or unexported fields
}

func (RadioButton) Fn added in v0.4.16

Fn updates enum and displays the radio button.

func (*RadioButton) Group added in v0.4.16

func (r *RadioButton) Group(group *Enum) *RadioButton

Group sets the enum group of the radio button

func (*RadioButton) Key added in v0.4.16

func (r *RadioButton) Key(key string) *RadioButton

Key sets the key initially active on the radiobutton

type Responsive added in v0.4.16

type Responsive struct {
	*Theme
	Widgets
	// contains filtered or unexported fields
}

func (*Responsive) Fn added in v0.4.16

func (r *Responsive) Fn(gtx l.Context) l.Dimensions

type Rows added in v0.4.16

type Rows []ColumnRow

type ScaleType added in v0.4.16

type ScaleType map[string]float32

ScaleType is a map of the set of label txsizes

type Slider added in v0.4.16

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

func (*Slider) Color added in v0.4.16

func (s *Slider) Color(color string) *Slider

Color sets the color to draw the slider in

func (*Slider) Float added in v0.4.16

func (s *Slider) Float(f *Float) *Slider

Float sets the initial value

func (*Slider) Fn added in v0.4.16

func (s *Slider) Fn(gtx l.Context) l.Dimensions

Fn renders the slider

func (*Slider) Max added in v0.4.16

func (s *Slider) Max(max float32) *Slider

Max sets the value at the right hand side

func (*Slider) Min added in v0.4.16

func (s *Slider) Min(min float32) *Slider

Min sets the value at the left hand side

type Stack added in v0.4.16

type Stack struct {
	*l.Stack
	// contains filtered or unexported fields
}

func (*Stack) Alignment added in v0.4.16

func (s *Stack) Alignment(alignment l.Direction) *Stack

func (*Stack) Expanded added in v0.4.16

func (s *Stack) Expanded(w l.Widget) (out *Stack)

Expanded lays out a widget with the same max constraints as the stack

func (*Stack) Fn added in v0.4.16

func (s *Stack) Fn(c l.Context) l.Dimensions

Fn runs the ops queue configured in the stack

func (*Stack) Stacked added in v0.4.16

func (s *Stack) Stacked(w l.Widget) (out *Stack)

Stacked appends a widget to the stack, the stack's dimensions will be computed from the largest widget in the stack

type SubmitEvent added in v0.4.16

type SubmitEvent struct {
	Text string
}

A SubmitEvent is generated when submit is set and a carriage return key is pressed.

type Switch added in v0.4.16

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

func (*Switch) DisabledColor added in v0.4.16

func (s *Switch) DisabledColor(color string) *Switch

DisabledColor sets the color to draw for the disabled state

func (*Switch) EnabledColor added in v0.4.16

func (s *Switch) EnabledColor(color string) *Switch

EnabledColor sets the color to draw for the enabled state

func (*Switch) Fn added in v0.4.16

func (s *Switch) Fn(gtx l.Context) l.Dimensions

Fn updates the switch and displays it.

func (*Switch) SetHook added in v0.4.16

func (s *Switch) SetHook(fn func(b bool)) *Switch

type Table added in v0.4.16

type Table struct {
	*Window

	Y, X []int
	// contains filtered or unexported fields
}

Table is a super simple table widget that finds the dimensions of all cells, sets all to max of each axis, and then scales the remaining space evenly

func (*Table) Body added in v0.4.16

func (t *Table) Body(g CellGrid) *Table

func (*Table) CellBackground added in v0.4.16

func (t *Table) CellBackground(color string) *Table

func (*Table) Fn added in v0.4.16

func (t *Table) Fn(gtx l.Context) l.Dimensions

func (*Table) Header added in v0.4.16

func (t *Table) Header(h CellRow) *Table

func (*Table) HeaderBackground added in v0.4.16

func (t *Table) HeaderBackground(color string) *Table

func (*Table) SetReverse added in v0.4.16

func (t *Table) SetReverse(color string) *Table

type Text added in v0.4.16

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

Text is a widget for laying out and drawing text.

func (*Text) Alignment added in v0.4.16

func (t *Text) Alignment(alignment text.Alignment) *Text

Alignment sets the alignment for the text

func (*Text) Fn added in v0.4.16

func (t *Text) Fn(gtx layout.Context, s text.Shaper, font text.Font, size unit.Value, txt string) layout.Dimensions

func (*Text) MaxLines added in v0.4.16

func (t *Text) MaxLines(maxLines int) *Text

MaxLines sets the alignment for the text

type TextInput added in v0.4.16

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

TextInput is a simple text input widget

func (*TextInput) Color added in v0.4.16

func (ti *TextInput) Color(color string) *TextInput

Color sets the color to render the text

func (*TextInput) Fn added in v0.4.16

func (ti *TextInput) Fn(c l.Context) l.Dimensions

Fn renders the text input widget

func (*TextInput) Font added in v0.4.16

func (ti *TextInput) Font(font string) *TextInput

Font sets the font for the text input widget

func (*TextInput) Hint added in v0.4.16

func (ti *TextInput) Hint(hint string) *TextInput

Hint sets the text to show when the box is empty

func (*TextInput) HintColor added in v0.4.16

func (ti *TextInput) HintColor(color string) *TextInput

HintColor sets the color of the hint text

func (*TextInput) TextScale added in v0.4.16

func (ti *TextInput) TextScale(scale float32) *TextInput

TextScale sets the size of the text relative to the base font size

type TextTable added in v0.4.16

type TextTable struct {
	*Window
	Header           TextTableHeader
	Body             TextTableBody
	HeaderColor      string
	HeaderDarkTheme  bool
	HeaderBackground string
	HeaderFont       string
	HeaderFontScale  float32
	CellColor        string
	CellBackground   string
	CellFont         string
	CellFontScale    float32
	CellInset        float32
	List             *List
	Table            *Table
}

TextTable is a widget that renders a scrolling list of rows of data labeled by a header. Note that for the reasons of expedience and performance this widget assumes a growing but immutable list of rows of items. If this is used on data that is not immutable, nilling the body will cause it to be wholly regenerated, updating older content than the longest length the list has reached.

func (*TextTable) Fn added in v0.4.16

func (tt *TextTable) Fn(gtx l.Context) l.Dimensions

func (*TextTable) Regenerate added in v0.4.16

func (tt *TextTable) Regenerate(fully bool)

Regenerate the text table.

func (*TextTable) SetDefaults added in v0.4.16

func (tt *TextTable) SetDefaults() *TextTable

func (*TextTable) SetReverse added in v0.4.16

func (tt *TextTable) SetReverse() *TextTable

type TextTableBody added in v0.4.16

type TextTableBody []TextTableRow

type TextTableHeader added in v0.4.16

type TextTableHeader []string

type TextTableRow added in v0.4.16

type TextTableRow []string

type Theme added in v0.4.16

type Theme struct {
	TextSize unit.Value
	*Colors

	Dark *bool

	WidgetPool *Pool
	// contains filtered or unexported fields
}

func NewTheme added in v0.4.16

func NewTheme(fontCollection []text.FontFace, quit qu.C) (th *Theme)

NewTheme creates a new theme to use for rendering a user interface

func (*Theme) Flex added in v0.4.16

func (th *Theme) Flex() (out *Flex)

Flex creates a new flex layout

func (*Theme) Float added in v0.4.16

func (th *Theme) Float() *Float

func (*Theme) Image added in v0.4.16

func (th *Theme) Image() *Image

func (*Theme) Responsive added in v0.4.16

func (th *Theme) Responsive(size int, widgets Widgets) *Responsive

func (*Theme) SliceToWidget added in v0.4.16

func (th *Theme) SliceToWidget(w []l.Widget, axis l.Axis) l.Widget

func (*Theme) VFlex added in v0.4.16

func (th *Theme) VFlex() (out *Flex)

VFlex creates a new vertical flex layout

type WidgetMap added in v0.4.16

type WidgetMap map[string]l.Widget

type WidgetSize added in v0.4.16

type WidgetSize struct {
	Size   float32
	Widget l.Widget
}

WidgetSize is a widget with a specification of the minimum size to select it for viewing. Note that the widgets you put in here should be wrapped in func(l.Context) l.Dimensions otherwise any parameters retrieved from the controlling state variable will be from initialization and not at execution of the widget in the render process

type Widgets added in v0.4.16

type Widgets []WidgetSize

func (Widgets) Len added in v0.4.16

func (w Widgets) Len() int

func (Widgets) Less added in v0.4.16

func (w Widgets) Less(i, j int) bool

func (Widgets) Swap added in v0.4.16

func (w Widgets) Swap(i, j int)

type Window added in v0.4.16

type Window struct {
	*Theme
	*app.Window

	Width  int // stores the width at the beginning of render
	Height int

	Runner CallbackQueue
	// contains filtered or unexported fields
}

func NewWindow added in v0.4.16

func NewWindow(th *Theme) (out *Window)

NewWindow creates a new window

func NewWindowP9 added in v0.4.16

func NewWindowP9(quit chan struct{}) (out *Window)

NewWindowP9 creates a new window

func (*Window) App added in v0.4.16

func (w *Window) App(size *int, activePage *uberatomic.String, invalidate chan struct{}, Break1 float32) *App

func (*Window) Body1 added in v0.4.16

func (w *Window) Body1(txt string) (l *Label)

Body1 normal body text 1

func (*Window) Body2 added in v0.4.16

func (w *Window) Body2(txt string) (l *Label)

Body2 normal body text 2

func (*Window) Bool added in v0.4.16

func (w *Window) Bool(value bool) *Bool

Bool creates a new boolean widget

func (*Window) Border added in v0.4.16

func (w *Window) Border() *Border

Border creates a border with configurable color, width and corner radius.

func (*Window) Button added in v0.4.16

func (w *Window) Button(btn *Clickable) *Button

Button is a regular material text button where all the dimensions, colors, corners and font can be changed

func (*Window) ButtonLayout added in v0.4.16

func (w *Window) ButtonLayout(button *Clickable) *ButtonLayout

ButtonLayout creates a button with a background and another widget over top

func (*Window) Caption added in v0.4.16

func (w *Window) Caption(txt string) (l *Label)

Caption caption text

func (*Window) Card added in v0.4.16

func (w *Window) Card(background string, embed l.Widget,
) func(gtx l.Context) l.Dimensions

func (*Window) CardContent added in v0.4.16

func (w *Window) CardContent(title, color string, embed l.Widget) func(gtx l.Context) l.Dimensions

func (*Window) CardList added in v0.4.16

func (w *Window) CardList(list *List, background string,
	widgets ...l.Widget) func(gtx l.Context) l.Dimensions

func (*Window) CheckBox added in v0.4.16

func (w *Window) CheckBox(checkBox *Bool) *Checkbox

CheckBox creates a checkbox with a text label

func (*Window) Checkable added in v0.4.16

func (w *Window) Checkable() *Checkable

Checkable creates a checkbox type widget

func (*Window) Clickable added in v0.4.16

func (w *Window) Clickable() (c *Clickable)

func (*Window) Column added in v0.4.16

func (w *Window) Column(rows Rows, font string, scale float32, color string,
	background string) *Column

func (*Window) Direction added in v0.4.16

func (w *Window) Direction() (out *Direction)

Direction creates a directional layout that sets its contents to align according to the configured direction (8 cardinal directions and centered)

func (*Window) Editor added in v0.4.16

func (w *Window) Editor() *Editor

func (*Window) Enum added in v0.4.16

func (w *Window) Enum() *Enum

func (*Window) Fill added in v0.4.16

func (w *Window) Fill(col string, dxn l.Direction, radius float32, corners int, embed l.Widget) *Filler

Fill fills underneath a widget you can put over top of it, dxn sets which direction to place a smaller object, cardinal axes and center

func (*Window) H1 added in v0.4.16

func (w *Window) H1(txt string) (l *Label)

H1 header 1

func (*Window) H2 added in v0.4.16

func (w *Window) H2(txt string) (l *Label)

H2 header 2

func (*Window) H3 added in v0.4.16

func (w *Window) H3(txt string) (l *Label)

H3 header 3

func (*Window) H4 added in v0.4.16

func (w *Window) H4(txt string) (l *Label)

H4 header 4

func (*Window) H5 added in v0.4.16

func (w *Window) H5(txt string) (l *Label)

H5 header 5

func (*Window) H6 added in v0.4.16

func (w *Window) H6(txt string) (l *Label)

H6 header 6

func (*Window) Icon added in v0.4.16

func (w *Window) Icon() *Icon

Icon returns a new Icon from iconVG data.

func (*Window) IconButton added in v0.4.16

func (w *Window) IconButton(button *Clickable) *IconButton

IconButton creates an icon with a circular *optional non-round corners* background and an icon placed in the centre

func (*Window) IncDec added in v0.4.16

func (w *Window) IncDec() (out *IncDec)

IncDec is a simple increment/decrement for a number setting

func (*Window) Indefinite added in v0.4.16

func (w *Window) Indefinite() *Indefinite

Indefinite creates an indefinite loading animation icon

func (*Window) Input added in v0.4.16

func (w *Window) Input(
	txt, hint, borderColorFocused, borderColorUnfocused, backgroundColor string,
	submit, change func(txt string),
) *Input

func (*Window) Inset added in v0.4.16

func (w *Window) Inset(pad float32, embed l.Widget) (out *Inset)

Inset creates a padded empty space around a widget

func (*Window) IntSlider added in v0.4.16

func (w *Window) IntSlider() *IntSlider

func (*Window) Label added in v0.4.16

func (w *Window) Label() (l *Label)

Label creates a label that prints a block of text

func (*Window) List added in v0.4.16

func (w *Window) List() (li *List)

List returns a new scrollable List widget

func (*Window) Multiline added in v0.4.16

func (w *Window) Multiline(
	txt *cli.StringSlice,
	borderColorFocused, borderColorUnfocused, backgroundColor string,
	size float32,
	handle func(txt []string),
) (m *Multi)

func (*Window) NewPool added in v0.4.16

func (w *Window) NewPool() *Pool

func (*Window) Open added in v0.4.16

func (w *Window) Open() (out *Window)

Open sets the window options and initialise the app.window

func (*Window) Overlay added in v0.4.16

func (w *Window) Overlay(gtx l.Context)

func (*Window) Password added in v0.4.16

func (w *Window) Password(
	hint string, password *string, borderColorFocused,
	borderColorUnfocused, backgroundColor string, handle func(pass string),
) *Password

func (*Window) PopOverlay added in v0.4.16

func (w *Window) PopOverlay()

func (*Window) ProgressBar added in v0.4.16

func (w *Window) ProgressBar() *ProgressBar

ProgressBar renders a horizontal bar with an indication of completion of a process

func (*Window) PushOverlay added in v0.4.16

func (w *Window) PushOverlay(overlay func(gtx l.Context))

func (*Window) RadioButton added in v0.4.16

func (w *Window) RadioButton(checkable *Checkable, group *Enum, key,
	label string) *RadioButton

RadioButton returns a RadioButton with a label. The key specifies the value for the Enum.

func (*Window) Run added in v0.4.16

func (w *Window) Run(
	frame func(ctx l.Context) l.Dimensions,
	overlay func(ctx l.Context), destroy func(), quit qu.C,
) (e error)

func (*Window) Scale added in v0.4.16

func (w *Window) Scale(s float32) *Window

Scale sets the scale factor for rendering

func (*Window) Size added in v0.4.16

func (w *Window) Size(width, height float32) (out *Window)

Size sets the dimensions of the window

func (*Window) Slider added in v0.4.16

func (w *Window) Slider() *Slider

Slider is for selecting a value in a range.

func (*Window) Stack added in v0.4.16

func (w *Window) Stack() (out *Stack)

Stack starts a chain of widgets to compose into a stack

func (*Window) Switch added in v0.4.16

func (w *Window) Switch(swtch *Bool) *Switch

Switch creates a boolean switch widget (basically a checkbox but looks like a switch)

func (*Window) Table added in v0.4.16

func (w *Window) Table() *Table

func (*Window) Text added in v0.4.16

func (w *Window) Text() *Text

func (*Window) TextInput added in v0.4.16

func (w *Window) TextInput(editor *Editor, hint string) *TextInput

TextInput creates a simple text input widget

func (*Window) Title added in v0.4.16

func (w *Window) Title(title string) (out *Window)

Title sets the title of the window

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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