gel

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: Unlicense Imports: 47 Imported by: 0

README

gel

Gio elements

This is a widget toolkit based on the basic set of material widgets built with Gio.

So far, the following additional widgets have been created - scrollbar for the scrolling list, a column and basic table, and a top-bar side-bar status-bar multi-page application framework, and a background process runner to minimise interruptions to the rendering of the interfaces.

There is also a state-widget pool generated with the stuff in poolgen/ that you initialize before starting the render loop that can then be used anywhere to add new clickables, bools, inputs and so on, without having to double up with a pre-specification, they allocate first run and then cache thereafter, maintaining their state.

Gel uses fluent programming techniques to simplify and denoise the visual structure of Gio widget definitions. To take maximum advantage of it, make use of the fact that Go allows breaking lines after dot operators between the chained methods such that each movable section can be pulled up and moved into another position without dealing with a screenful of red underlines in your IDE caused by unpaired brackets.

Future plans include creating a serialization format for events and render op queues and accompanying socket transports to enable remote display and control of user interfaces.

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 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

func CopyContextDimensionsWithMaxAxis(gtx l.Context, axis l.Axis) l.Context

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

func EmptyFromSize

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

func EmptyMaxHeight

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

func EmptyMaxWidth

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

func EmptyMinHeight

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

func EmptyMinWidth

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

func EmptySpace

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

func Fill

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 Fpt

func Fpt(p image.Point) f32.Point

FPt converts an point to a f32.Point.

func GetDimension

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

func GetInfContext

func GetInfContext(gtx l.Context) l.Context

GetInfContext creates a context with infinite max constraints

func HexARGB

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

HexARGB converts a 32 bit hex string into a color specification

func HexNRGB

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

HexNRGB converts a 32 bit hex string into a color specification

func If

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

Types

type App

type App struct {
	*Window

	LogoClickable *Clickable

	MenuOpen bool

	SideBarSize *unit.Value

	Size *atomic.Int32

	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

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

func (*App) ActivePageGet

func (a *App) ActivePageGet() string

func (*App) ActivePageGetAtomic

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

func (*App) AppTitleText

func (a *App) AppTitleText() string

func (*App) BodyBackground

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

func (*App) BodyBackgroundGet

func (a *App) BodyBackgroundGet() string

func (*App) BodyColor

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

func (*App) BodyColorGet

func (a *App) BodyColorGet() string

func (*App) ButtonBar

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

func (*App) ButtonBarGet

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

func (*App) CardBackground

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

func (*App) CardBackgroundGet

func (a *App) CardBackgroundGet() string

func (*App) CardColor

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

func (*App) CardColorGet

func (a *App) CardColorGet() string

func (*App) DimensionCaption

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

func (*App) Fn

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

Fn renders the node widget

func (a *App) GetLogo() string

func (*App) HideSideBar

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

func (*App) HideSideBarGet

func (a *App) HideSideBarGet() bool

func (*App) HideTitleBar

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

func (*App) HideTitleBarGet

func (a *App) HideTitleBarGet() bool

func (*App) Layers

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

func (*App) LayersGet

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

func (*App) LogoAndTitle

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

func (*App) MainDirection

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

func (*App) MainFrame

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

func (*App) MenuBackground

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

func (*App) MenuBackgroundGet

func (a *App) MenuBackgroundGet() string

func (*App) MenuButton

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

func (*App) MenuColor

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

func (*App) MenuColorGet

func (a *App) MenuColorGet() string

func (*App) MenuIcon

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

func (*App) MenuIconGet

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

func (*App) NoMenuButton

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

func (*App) Pages

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

func (*App) PagesGet

func (a *App) PagesGet() WidgetMap

func (*App) Placeholder

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

func (*App) RenderButtonBar

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

func (*App) RenderHeader

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

func (*App) RenderPage

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

func (*App) RenderStatusBar

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

func (*App) Root

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

func (*App) RootGet

func (a *App) RootGet() *Stack

func (*App) SetAppTitleText

func (a *App) SetAppTitleText(title string) *App
func (a *App) SetLogo(logo *[]byte) *App

func (*App) SetMainDirection

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

func (*App) SideBar

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

func (*App) SideBarBackground

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

func (*App) SideBarBackgroundGet

func (a *App) SideBarBackgroundGet() string

func (*App) SideBarColor

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

func (*App) SideBarColorGet

func (a *App) SideBarColorGet() string

func (*App) SideBarGet

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

func (*App) StatusBar

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

func (*App) StatusBarBackground

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

func (*App) StatusBarBackgroundGet

func (a *App) StatusBarBackgroundGet() string

func (*App) StatusBarColor

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

func (*App) StatusBarColorGet

func (a *App) StatusBarColorGet() string

func (*App) StatusBarGet

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

func (*App) Title

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

func (*App) TitleBarBackground

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

func (*App) TitleBarBackgroundGet

func (a *App) TitleBarBackgroundGet() string

func (*App) TitleBarColor

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

func (*App) TitleBarColorGet

func (a *App) TitleBarColorGet() string

func (*App) TitleFont

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

func (*App) TitleFontGet

func (a *App) TitleFontGet() string

func (*App) TitleGet

func (a *App) TitleGet() string

type Bool

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

func (*Bool) Changed

func (b *Bool) Changed() bool

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

func (*Bool) Fn

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

Fn renders the events of the boolean widget

func (*Bool) GetValue

func (b *Bool) GetValue() bool

GetValue gets the boolean value stored in the widget

func (*Bool) History

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

History returns the history of presses in the buffer

func (*Bool) SetOnChange

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

SetOnChange sets the callback function to run when the state changes

func (*Bool) Value

func (b *Bool) Value(value bool)

Value sets the value of the boolean stored in the widget

type BoolHook

type BoolHook func(b bool)

type Border

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

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

func (*Border) Color

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

Color sets the color to render the border in

func (*Border) CornerRadius

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

CornerRadius sets the radius of the curve on the corners

func (*Border) Embed

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

func (*Border) Fn

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

Fn renders the border

func (*Border) Width

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

Width sets the width of the border line

type Button

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

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

Background sets the background color

func (*Button) Color

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

Color sets the text color

func (*Button) CornerRadius

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

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

func (*Button) Fn

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

Fn renders the button

func (*Button) Font

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

Font sets the font style

func (*Button) Inset

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

Inset sets the inset between the button border and the text

func (*Button) SetCancel

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

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

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

func (*Button) SetPress

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

func (*Button) Text

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

Text sets the text on the button

func (*Button) TextScale

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

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

type ButtonLayout

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

func (*ButtonLayout) Background

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

Background sets the background color of the button

func (*ButtonLayout) CornerRadius

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

CornerRadius sets the radius of the corners of the button

func (*ButtonLayout) Corners

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

Corners sets which corners have the radius of rounding

func (*ButtonLayout) Embed

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

Embed a widget in the button

func (*ButtonLayout) Fn

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

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

func (*ButtonLayout) SetCancel

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

func (*ButtonLayout) SetClick

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

func (*ButtonLayout) SetPress

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

type CallbackQueue

type CallbackQueue chan func() error

func NewCallbackQueue

func NewCallbackQueue(bufSize int) CallbackQueue

type Cell

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

type CellGrid []CellRow

type CellPriorities

type CellPriorities []CellPriority

func (CellPriorities) Len

func (c CellPriorities) Len() int

Len sorts a cell row by priority

func (CellPriorities) Less

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

func (CellPriorities) Swap

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

type CellPriority

type CellPriority struct {
	Column   int
	Priority int
}

type CellRow

type CellRow []Cell

func (CellRow) GetPriority

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

type ChangeEvent

type ChangeEvent struct{}

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

type Checkable

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

func (*Checkable) CheckedStateIcon

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

CheckedStateIcon loads the icon for the checked state

func (*Checkable) Color

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

Color sets the color of the checkbox label

func (*Checkable) Fn

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

Fn renders the checkbox widget

func (*Checkable) Font

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

Font sets the font used on the label

func (*Checkable) IconColor

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

IconColor sets the color of the icon

func (*Checkable) Label

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

Label sets the label on the checkbox

func (*Checkable) Scale

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

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

func (*Checkable) TextScale

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

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

func (*Checkable) UncheckedStateIcon

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

UncheckedStateIcon loads the icon for the unchecked state

type Checkbox

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

func (*Checkbox) Fn

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

Fn renders the checkbox

func (*Checkbox) IconColor

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

IconColor sets the color of the icon in the checkbox

func (*Checkbox) IconScale

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

IconScale sets the scaling of the check icon

func (*Checkbox) SetOnChange

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

SetOnChange sets the callback when a state change event occurs

func (*Checkbox) Text

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

Text sets the text to be rendered on the checkbox

func (*Checkbox) TextColor

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

TextColor sets the color of the text label

func (*Checkbox) TextScale

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

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

type Clickable

type Clickable struct {
	*Window

	Events clickEvents
	// contains filtered or unexported fields
}

Clickable represents a clickable area.

func (*Clickable) Clicked

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

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

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

func (*Clickable) Fn

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

func (*Clickable) History

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

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

func (*Clickable) SetClick

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

func (*Clickable) SetPress

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

type Collection

type Collection []text.FontFace

func (Collection) Font

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

type Colors

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

Colors is a map of names to hex strings specifying colors

func (*Colors) GetNRGBAFromName

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

GetNRGBAFromName returns the named color from the map

func (*Colors) SetDarkTheme

func (c *Colors) SetDarkTheme(dark bool)

SetDarkTheme to dark or light

type Column

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

func (*Column) Fn

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

func (*Column) List

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

type ColumnRow

type ColumnRow struct {
	Label string
	W     l.Widget
}

type DimensionList

type DimensionList []l.Dimensions

func GetDimensionList

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

GetDimensionList returns a dimensionlist based on the given listelement

func (DimensionList) CoordinateToPosition

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

CoordinateToPosition converts an absolute coordinate to a list position

func (DimensionList) GetSizes

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

func (DimensionList) GetTotal

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

func (DimensionList) PositionToCoordinate

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

PositionToCoordinate converts a list position to absolute coordinate

type Direction

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

func (*Direction) Center

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

Center sets the relevant direction for the Direction layout

func (*Direction) E

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

E sets the relevant direction for the Direction layout

func (*Direction) Embed

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

func (*Direction) Fn

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

Fn the given widget given the context and direction

func (*Direction) N

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

N sets the relevant direction for the Direction layout

func (*Direction) NE

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

NE sets the relevant direction for the Direction layout

func (*Direction) NW

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

NW sets the relevant direction for the Direction layout

func (*Direction) S

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

S sets the relevant direction for the Direction layout

func (*Direction) SE

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

SE sets the relevant direction for the Direction layout

func (*Direction) SW

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

SW sets the relevant direction for the Direction layout

func (*Direction) W

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

W sets the relevant direction for the Direction layout

type Editor

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

Editor implements an editable and scrollable text area.

func (*Editor) Alignment

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

func (*Editor) CaretCoords

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

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

func (*Editor) CaretPos

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

CaretPos returns the line & column numbers of the caret.

func (*Editor) ClearSelection

func (e *Editor) ClearSelection()

ClearSelection clears the selection, by setting the selection end equal to the selection start.

func (*Editor) Delete

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.

If there is a selection, it is deleted and counts as a single rune.

func (*Editor) Events

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

Events returns available editor events.

func (*Editor) Focus

func (e *Editor) Focus()

Focus requests the input focus for the _editor.

func (*Editor) Focused

func (e *Editor) Focused() bool

Focused returns whether the editor is focused or not.

func (*Editor) Insert

func (e *Editor) Insert(s string)

Insert inserts text at the caret, moving the caret forward. If there is a selection, Insert overwrites it.

func (*Editor) Layout

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

func (e *Editor) Len() int

Len is the length of the editor contents.

func (*Editor) Mask

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

func (*Editor) MoveCaret

func (e *Editor) MoveCaret(startDelta, endDelta int)

MoveCaret moves the caret (aka selection start) and the selection end relative to their current positions. Positive distances moves forward, negative distances moves backward. Distances are in runes.

func (*Editor) NumLines

func (e *Editor) NumLines() int

NumLines returns the number of lines in the editor.

func (*Editor) PaintCaret

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

func (*Editor) PaintSelection

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

PaintSelection paints the contrasting background for selected text.

func (*Editor) PaintText

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

func (*Editor) SelectedText

func (e *Editor) SelectedText() string

SelectedText returns the currently selected text (if any) from the editor.

func (*Editor) Selection

func (e *Editor) Selection() (start, end int)

Selection returns the start and end of the selection, as offsets into the editor text. start can be > end.

func (*Editor) SelectionLen

func (e *Editor) SelectionLen() int

SelectionLen returns the length of the selection, in bytes; it is equivalent to len(e.SelectedText()).

func (*Editor) SetCaret

func (e *Editor) SetCaret(start, end int)

SetCaret moves the caret to start, and sets the selection end to end. start and end are in bytes, and represent offsets into the editor text. start and end must be at a rune boundary.

func (*Editor) SetChange

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

func (*Editor) SetFocus

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

func (*Editor) SetSubmit

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

func (*Editor) SetText

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

SetText replaces the contents of the editor, clearing any selection first.

func (*Editor) SingleLine

func (e *Editor) SingleLine() *Editor

func (*Editor) Submit

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

func (*Editor) Text

func (e *Editor) Text() string

Text returns the contents of the editor.

type EditorEvent

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

type Enum

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

func (*Enum) Changed

func (e *Enum) Changed() bool

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

func (*Enum) Fn

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

Fn adds the event handler for key.

func (*Enum) SetOnChange

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

func (*Enum) SetValue

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

func (*Enum) Value

func (e *Enum) Value() string

type Filler

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

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

Fn renders the fill with the widget inside

type Fit

type Fit uint8

Fit scales a widget to fit and clip to the constraints.

const (
	// Unscaled does not alter the scale of a widget.
	Unscaled Fit = iota
	// Contain scales widget as large as possible without cropping
	// and it preserves aspect-ratio.
	Contain
	// Cover scales the widget to cover the constraint area and
	// preserves aspect-ratio.
	Cover
	// ScaleDown scales the widget smaller without cropping,
	// when it exceeds the constraint area.
	// It preserves aspect-ratio.
	ScaleDown
	// Stretch stretches the widget to the constraints and does not
	// preserve aspect-ratio.
	Stretch
)

type Flex

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

func (*Flex) AlignBaseline

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

AlignBaseline sets alignment for layout from Baseline

func (*Flex) AlignEnd

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

AlignEnd sets alignment for layout from End

func (*Flex) AlignMiddle

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

AlignMiddle sets alignment for layout from Middle

func (*Flex) AlignStart

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

AlignStart sets alignment for layout from Start

func (*Flex) Flexed

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

Flexed inserts a flexed widget into the flex

func (*Flex) Fn

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

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

func (*Flex) Rigid

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

Rigid inserts a rigid widget into the flex

func (*Flex) SpaceAround

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

SpaceAround sets the corresponding flex spacing parameter

func (*Flex) SpaceBetween

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

SpaceBetween sets the corresponding flex spacing parameter

func (*Flex) SpaceEnd

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

SpaceEnd sets the corresponding flex spacing parameter

func (*Flex) SpaceEvenly

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

SpaceEvenly sets the corresponding flex spacing parameter

func (*Flex) SpaceSides

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

SpaceSides sets the corresponding flex spacing parameter

func (*Flex) SpaceStart

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

SpaceStart sets the corresponding flex spacing parameter

func (*Flex) Vertical

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

Vertical sets axis to vertical, otherwise it is horizontal

type Float

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

Float is for selecting a value in a range.

func (*Float) Changed

func (f *Float) Changed() bool

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

func (*Float) Fn

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

Fn processes events.

func (*Float) Pos

func (f *Float) Pos() float32

Pos reports the selected position.

func (*Float) SetHook

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

func (*Float) SetValue

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

func (*Float) Value

func (f *Float) Value() float32

type Fonts

type Fonts map[string]text.Typeface

type Icon

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

func (*Icon) Color

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

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

Fn renders the icon

func (*Icon) Scale

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

Scale changes the size relative to the base font size

func (*Icon) Size

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

func (*Icon) Src

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

Src sets the icon source to draw from

type IconButton

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

func (*IconButton) Background

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

Background sets the color of the circular background

func (*IconButton) ButtonInset

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

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

Color sets the color of the icon

func (*IconButton) Corners

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

Corners sets the corners that will be circular

func (*IconButton) Fn

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

Fn renders the icon button

func (*IconButton) Icon

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

Icon sets the icon to display

func (*IconButton) Scale

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

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

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

func (*IconButton) SetClick

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

SetClick sets the function to run on click

func (*IconButton) SetPress

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

SetPress sets the function to run on press

type IconByColor

type IconByColor map[color.NRGBA]paint.ImageOp

type IconBySize

type IconBySize map[float32]IconByColor

type IconCache

type IconCache map[*[]byte]IconBySize

type Icons

type Icons map[string]*Icon

type Image

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

Image is a widget that displays an image.

func (Image) Fn

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

func (*Image) Scale

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

func (*Image) Src

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

type IncDec

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

func (*IncDec) Amount

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

func (*IncDec) Background

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

func (*IncDec) ChangeHook

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

func (*IncDec) Color

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

func (*IncDec) Fn

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

func (*IncDec) GetCurrent

func (in *IncDec) GetCurrent() int

func (*IncDec) Inactive

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

func (*IncDec) Max

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

func (*IncDec) Min

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

func (*IncDec) NDigits

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

func (*IncDec) Scale

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

func (*IncDec) SetCurrent

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

type Indefinite

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

func (*Indefinite) Color

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

Color sets the color of the spinner

func (*Indefinite) Fn

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

Fn renders the loader

func (*Indefinite) Scale

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

Scale sets the size of the spinner

type Input

type Input struct {
	*Window

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

func (*Input) Fn

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

Fn renders the input widget

type Inset

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

func (*Inset) Embed

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

Embed sets the widget that will be inside the inset

func (*Inset) Fn

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

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

type IntSlider

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

func (*IntSlider) Fn

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

func (*IntSlider) GetValue

func (i *IntSlider) GetValue() int

func (*IntSlider) Hook

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

func (*IntSlider) Max

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

func (*IntSlider) Min

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

func (*IntSlider) Value

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

type Label

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

Label is text drawn inside an empty box

func (*Label) Alignment

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

Alignment sets the text alignment, left, right or centered

func (*Label) Color

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

Color sets the color of the label font

func (*Label) Fn

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

Fn renders the label as specified

func (*Label) Font

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

Font sets the font out of the available font collection

func (*Label) MaxLines

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

MaxLines sets the maximum number of lines to render

func (*Label) Text

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

Text sets the text to render in the label

func (*Label) TextScale

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

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

type List

type List struct {
	Len int

	// all below are additional fields to implement the scrollbar
	*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

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

Active sets the color of the scrollbar grabber when it is being operated

func (*List) Background

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

Background sets the background color of the scrollbar

func (*List) Baseline

func (li *List) Baseline() *List

Baseline sets the alignment to baseline

func (*List) Color

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

Color sets the primary color of the scrollbar grabber

func (*List) DisableScroll

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

DisableScroll turns off the scrollbar

func (*List) Dragging

func (li *List) Dragging() bool

Dragging reports whether the List is being dragged.

func (*List) End

func (li *List) End() *List

End sets the alignment to end

func (*List) Fn

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

func (li *List) JumpToEnd()

JumpToEnd moves the position to the end

func (*List) JumpToStart

func (li *List) JumpToStart()

JumpToStart moves the position to the start

func (*List) Layout

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

Layout the List.

func (*List) LeftSide

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

LeftSide sets the scroller to be on the opposite side from usual

func (*List) Length

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

Length sets the new length for the list

func (*List) ListElement

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

ListElement defines the function that returns list elements

func (*List) Middle

func (li *List) Middle() *List

Middle sets the alignment to middle

func (*List) Position

func (li *List) Position() Position

Position returns the current position of the scroller

func (*List) ScrollToEnd

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

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

ScrollWidth sets the width of the scrollbar

func (*List) SetPosition

func (li *List) SetPosition(position Position)

SetPosition sets the position of the scroller

func (*List) Slice

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

func (*List) Start

func (li *List) Start() *List

Start sets the alignment to start

func (*List) Vertical

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

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

type ListElement

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

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

type Multi

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

func (*Multi) Fn

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

func (*Multi) PopulateWidgets

func (m *Multi) PopulateWidgets() *Multi

func (*Multi) UpdateWidgets

func (m *Multi) UpdateWidgets() *Multi

func (*Multi) Widgets

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

type Password

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

func (*Password) Blur

func (p *Password) Blur()

func (*Password) Fn

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

func (*Password) Focus

func (p *Password) Focus()

func (*Password) GetPassword

func (p *Password) GetPassword() string

func (*Password) Hide

func (p *Password) Hide()

func (*Password) Show

func (p *Password) Show()

func (*Password) Wipe

func (p *Password) Wipe()

type Pool

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

func (*Pool) FreeBool

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

func (*Pool) FreeCheckable

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

func (*Pool) FreeClickable

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

func (*Pool) FreeEditor

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

func (*Pool) FreeIncDec

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

func (*Pool) FreeList

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

func (*Pool) GetBool

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

func (*Pool) GetCheckable

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

func (*Pool) GetClickable

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

func (*Pool) GetEditor

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

func (*Pool) GetIncDec

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

func (*Pool) GetList

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

func (*Pool) Reset

func (p *Pool) Reset()

type Position

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
	// OffsetLast is the signed distance in pixels from the bottom edge to the
	// bottom edge of the child at index First+Count.
	OffsetLast int
	// Count is the number of visible children.
	Count int
}

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

type ProgressBar

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

func (*ProgressBar) Color

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

Color sets the color to render the bar in

func (*ProgressBar) Fn

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

Fn renders the progress bar as it is currently configured

func (*ProgressBar) SetProgress

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

SetProgress sets the progress of the progress bar

type RadioButton

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

func (RadioButton) Fn

func (r RadioButton) Fn(gtx l.Context) l.Dimensions

Fn updates enum and displays the radio button.

func (*RadioButton) Group

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

Group sets the enum group of the radio button

func (*RadioButton) Key

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

Key sets the key initially active on the radiobutton

type Responsive

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

func (*Responsive) Fn

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

type Rows

type Rows []ColumnRow

type ScaleType

type ScaleType map[string]float32

ScaleType is a map of the set of label txsizes

type SelectEvent

type SelectEvent struct{}

A SelectEvent is generated when the user selects some text, or changes the selection (e.g. with a shift-click), including if they remove the selection. The selected text is not part of the event, on the theory that it could be a relatively expensive operation (for a large editor), most applications won't actually care about it, and those that do can call Editor.SelectedText() (which can be empty).

type Slider

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

func (*Slider) Color

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

Color sets the color to draw the slider in

func (*Slider) Float

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

Float sets the initial value

func (*Slider) Fn

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

Fn renders the slider

func (*Slider) Max

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

Max sets the value at the right hand side

func (*Slider) Min

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

Min sets the value at the left hand side

type Stack

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

func (*Stack) Alignment

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

func (*Stack) Expanded

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

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

Fn runs the ops queue configured in the stack

func (*Stack) Stacked

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

type SubmitEvent struct {
	Text string
}

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

type Switch

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

func (*Switch) DisabledColor

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

DisabledColor sets the color to draw for the disabled state

func (*Switch) EnabledColor

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

EnabledColor sets the color to draw for the enabled state

func (*Switch) Fn

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

Fn updates the switch and displays it.

func (*Switch) SetHook

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

type Table

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

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

func (*Table) CellBackground

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

func (*Table) Fn

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

func (*Table) Header

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

func (*Table) HeaderBackground

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

func (*Table) SetReverse

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

type Text

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

Text is a widget for laying out and drawing text.

func (*Text) Alignment

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

Alignment sets the alignment for the text

func (*Text) Fn

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

func (*Text) MaxLines

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

MaxLines sets the alignment for the text

type TextInput

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

TextInput is a simple text input widget

func (*TextInput) Color

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

Color sets the color to render the text

func (*TextInput) Fn

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

Fn renders the text input widget

func (*TextInput) Font

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

Font sets the font for the text input widget

func (*TextInput) Hint

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

Hint sets the text to show when the box is empty

func (*TextInput) HintColor

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

HintColor sets the color of the hint text

func (*TextInput) SelectionColor

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

SelectionColor sets the color to render the text

func (*TextInput) TextScale

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

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

type TextTable

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

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

func (*TextTable) Regenerate

func (tt *TextTable) Regenerate(fully bool)

Regenerate the text table.

func (*TextTable) SetDefaults

func (tt *TextTable) SetDefaults() *TextTable

func (*TextTable) SetReverse

func (tt *TextTable) SetReverse() *TextTable

type TextTableBody

type TextTableBody []TextTableRow

type TextTableHeader

type TextTableHeader []string

type TextTableRow

type TextTableRow []string

type Theme

type Theme struct {
	TextSize unit.Value
	*Colors

	Dark *binary.Opt

	WidgetPool *Pool
	// contains filtered or unexported fields
}

func NewTheme

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

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

func (*Theme) Flex

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

Flex creates a new flex layout

func (*Theme) Float

func (th *Theme) Float() *Float

func (*Theme) Image

func (th *Theme) Image() *Image

func (*Theme) Responsive

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

func (*Theme) SliceToWidget

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

func (*Theme) VFlex

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

VFlex creates a new vertical flex layout

type WidgetMap

type WidgetMap map[string]l.Widget

type WidgetSize

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

type Widgets []WidgetSize

func (Widgets) Len

func (w Widgets) Len() int

func (Widgets) Less

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

func (Widgets) Swap

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

type Window

type Window struct {
	*Theme
	*app.Window

	Width  *uberatomic.Int32 // stores the width at the beginning of render
	Height *uberatomic.Int32

	Runner CallbackQueue

	ClipboardWriteReqs chan string
	ClipboardReadReqs  chan func(string)
	ClipboardContent   string
	// contains filtered or unexported fields
}

func NewWindow

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

NewWindow creates a new window

func NewWindowP9

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

NewWindowP9 creates a new window

func (*Window) App

func (w *Window) App(
	size *atomic.Int32, activePage *atomic.String,
	Break1 float32,
) *App

func (*Window) Body1

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

Body1 normal body text 1

func (*Window) Body2

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

Body2 normal body text 2

func (*Window) Bool

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

Bool creates a new boolean widget

func (*Window) Border

func (w *Window) Border() *Border

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

func (*Window) Button

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

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

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

func (*Window) Caption

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

Caption caption text

func (*Window) Card

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

func (*Window) CardContent

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

func (*Window) CardList

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

func (*Window) CheckBox

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

CheckBox creates a checkbox with a text label

func (*Window) Checkable

func (w *Window) Checkable() *Checkable

Checkable creates a checkbox type widget

func (*Window) Clickable

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

func (*Window) Column

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

func (*Window) Direction

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

func (w *Window) Editor() *Editor

func (*Window) Enum

func (w *Window) Enum() *Enum

func (*Window) Fill

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

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

H1 header 1

func (*Window) H2

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

H2 header 2

func (*Window) H3

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

H3 header 3

func (*Window) H4

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

H4 header 4

func (*Window) H5

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

H5 header 5

func (*Window) H6

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

H6 header 6

func (*Window) Icon

func (w *Window) Icon() *Icon

Icon returns a new Icon from iconVG data.

func (*Window) IconButton

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

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

IncDec is a simple increment/decrement for a number setting

func (*Window) Indefinite

func (w *Window) Indefinite() *Indefinite

Indefinite creates an indefinite loading animation icon

func (*Window) Input

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

func (*Window) Inset

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

Inset creates a padded empty space around a widget

func (*Window) IntSlider

func (w *Window) IntSlider() *IntSlider

func (*Window) Label

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

Label creates a label that prints a block of text

func (*Window) List

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

List returns a new scrollable List widget

func (*Window) Multiline

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

func (*Window) NewPool

func (w *Window) NewPool() *Pool

func (*Window) Open

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

Open sets the window options and initialise the node.window

func (*Window) Overlay

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

func (*Window) Password

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

func (*Window) PopOverlay

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

func (*Window) ProgressBar

func (w *Window) ProgressBar() *ProgressBar

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

func (*Window) PushOverlay

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

func (*Window) RadioButton

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

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

func (*Window) Scale

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

Scale sets the scale factor for rendering

func (*Window) Size

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

Size sets the dimensions of the window

func (*Window) Slider

func (w *Window) Slider() *Slider

Slider is for selecting a value in a range.

func (*Window) Stack

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

Stack starts a chain of widgets to compose into a stack

func (*Window) Switch

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

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

func (*Window) Table

func (w *Window) Table() *Table

func (*Window) Text

func (w *Window) Text() *Text

func (*Window) TextInput

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

TextInput creates a simple text input widget

func (*Window) Title

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

Title sets the title of the window

func (*Window) WrapList

func (w *Window) WrapList() *WrapList

WrapList creates a new WrapList

type WrapList

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

WrapList is a generalised layout for creating lists from widgets lined up in one axis and wrapped into lines across a given axis. It can be used for an icon view, for a text console cell grid, for laying out selectable text.

func (*WrapList) Axis

func (w *WrapList) Axis(axis l.Axis) *WrapList

Axis sets the axis that will be scrollable

func (*WrapList) Direction

func (w *WrapList) Direction(dir text.Direction) *WrapList

Direction sets the direction across the axis, for vertical, text.Forwards means left to right, text.Backwards means right to left, and for horizontal, text.Forwards means top to bottom, text.Backwards means bottom to top

func (*WrapList) Fn

func (w *WrapList) Fn(gtx l.Context) l.Dimensions

Fn renders the WrapList in the current context todo: this needs to be cached and have a hook in the WrapList.Widgets method to trigger generation

func (*WrapList) Widgets

func (w *WrapList) Widgets(widgets []l.Widget) *WrapList

Widgets loads a set of widgets into the WrapList

Directories

Path Synopsis
cmd
gio
app
Package app provides a platform-independent interface to operating system functionality for running graphical user interfaces.
Package app provides a platform-independent interface to operating system functionality for running graphical user interfaces.
app/internal/log
Package points standard output, standard error and the standard library package log to the platform logger.
Package points standard output, standard error and the standard library package log to the platform logger.
app/internal/wm
package wm implements platform specific windows and GPU contexts.
package wm implements platform specific windows and GPU contexts.
app/internal/xkb
Package xkb implements a Go interface for the X Keyboard Extension library.
Package xkb implements a Go interface for the X Keyboard Extension library.
app/permission
Package permission includes sub-packages that should be imported by a Gio program or by one of its dependencies to indicate that specific operating-system permissions are required.
Package permission includes sub-packages that should be imported by a Gio program or by one of its dependencies to indicate that specific operating-system permissions are required.
app/permission/bluetooth
Package bluetooth implements permissions to access Bluetooth and Bluetooth Low Energy hardware, including the ability to discover and pair devices.
Package bluetooth implements permissions to access Bluetooth and Bluetooth Low Energy hardware, including the ability to discover and pair devices.
app/permission/camera
Package camera implements permissions to access camera hardware.
Package camera implements permissions to access camera hardware.
app/permission/networkstate
Package networkstate implements permissions to access network connectivity information.
Package networkstate implements permissions to access network connectivity information.
app/permission/storage
Package storage implements read and write storage permissions on mobile devices.
Package storage implements read and write storage permissions on mobile devices.
cmd/gogio
The gogio tool builds and packages Gio programs for Android, iOS/tvOS and WebAssembly.
The gogio tool builds and packages Gio programs for Android, iOS/tvOS and WebAssembly.
f32
Package f32 is a float32 implementation of package image's Point and Rectangle.
Package f32 is a float32 implementation of package image's Point and Rectangle.
font/gofont
Package gofont exports the Go fonts as a text.Collection.
Package gofont exports the Go fonts as a text.Collection.
font/opentype
Package opentype implements text layout and shaping for OpenType files.
Package opentype implements text layout and shaping for OpenType files.
gesture
Package gesture implements common pointer gestures.
Package gesture implements common pointer gestures.
gpu
Package gpu implements the rendering of Gio drawing operations.
Package gpu implements the rendering of Gio drawing operations.
gpu/headless
Package headless implements headless windows for rendering an operation list to an image.
Package headless implements headless windows for rendering an operation list to an image.
gpu/internal/rendertest
Package rendertest is intended for testing of drawing ops only.
Package rendertest is intended for testing of drawing ops only.
internal/byteslice
Package byteslice provides byte slice views of other Go values such as slices and structs.
Package byteslice provides byte slice views of other Go values such as slices and structs.
internal/cocoainit
Package cocoainit initializes support for multithreaded programs in Cocoa.
Package cocoainit initializes support for multithreaded programs in Cocoa.
internal/scene
Package scene encodes and decodes graphics commands in the format used by the compute renderer.
Package scene encodes and decodes graphics commands in the format used by the compute renderer.
internal/stroke
Package stroke implements conversion of strokes to filled outlines.
Package stroke implements conversion of strokes to filled outlines.
io/event
Package event contains the types for event handling.
Package event contains the types for event handling.
io/key
Package key implements key and text events and operations.
Package key implements key and text events and operations.
io/pointer
Package pointer implements pointer events and operations.
Package pointer implements pointer events and operations.
io/profile
Package profiles provides access to rendering profiles.
Package profiles provides access to rendering profiles.
io/router
Package router implements Router, a event.Queue implementation that that disambiguates and routes events to handlers declared in operation lists.
Package router implements Router, a event.Queue implementation that that disambiguates and routes events to handlers declared in operation lists.
io/system
Package system contains events usually handled at the top-level program level.
Package system contains events usually handled at the top-level program level.
layout
Package layout implements layouts common to GUI programs.
Package layout implements layouts common to GUI programs.
op
Package op implements operations for updating a user interface.
Package op implements operations for updating a user interface.
op/clip
Package clip provides operations for clipping paint operations.
Package clip provides operations for clipping paint operations.
op/paint
Package paint provides drawing operations for 2D graphics.
Package paint provides drawing operations for 2D graphics.
unit
Package unit implements device independent units and values.
Package unit implements device independent units and values.
widget
Package widget implements state tracking and event handling of common user interface controls.
Package widget implements state tracking and event handling of common user interface controls.
widget/material
Package material implements the Material design.
Package material implements the Material design.

Jump to

Keyboard shortcuts

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