Documentation ¶
Overview ¶
Package gui implements the plan 9 from crypto space Gio GUI theme
Index ¶
- Constants
- Variables
- func CopyContextDimensionsWithMaxAxis(gtx l.Context, size image.Point, axis l.Axis) l.Context
- func EmptyFromSize(size image.Point) func(gtx l.Context) l.Dimensions
- func EmptyMaxHeight() func(gtx l.Context) l.Dimensions
- func EmptyMaxWidth() func(gtx l.Context) l.Dimensions
- func EmptyMinHeight() func(gtx l.Context) l.Dimensions
- func EmptyMinWidth() func(gtx l.Context) l.Dimensions
- func EmptySpace(x, y int) func(gtx l.Context) l.Dimensions
- func Fill(gtx l.Context, col color.NRGBA) l.Dimensions
- func GetDimension(gtx l.Context, w l.Widget) (dim l.Dimensions)
- func GetInfContext(gtx l.Context) l.Context
- func HexARGB(s string) (c color.RGBA)
- func HexNRGB(s string) (c color.NRGBA)
- func If(value bool, t, f l.Widget) l.Widget
- type App
- func (a *App) ActivePage(activePage string) *App
- func (a *App) ActivePageGet() string
- func (a *App) ActivePageGetAtomic() *uberatomic.String
- func (a *App) BodyBackground(bodyBackground string) *App
- func (a *App) BodyBackgroundGet() string
- func (a *App) BodyColor(bodyColor string) *App
- func (a *App) BodyColorGet() string
- func (a *App) ButtonBar(bar []l.Widget) *App
- func (a *App) ButtonBarGet() (bar []l.Widget)
- func (a *App) CardBackground(cardBackground string) *App
- func (a *App) CardBackgroundGet() string
- func (a *App) CardColor(cardColor string) *App
- func (a *App) CardColorGet() string
- func (a *App) DimensionCaption(gtx l.Context) l.Dimensions
- func (a *App) Fn() func(gtx l.Context) l.Dimensions
- func (a *App) HideSideBar(hideSideBar bool) *App
- func (a *App) HideSideBarGet() bool
- func (a *App) HideTitleBar(hideTitleBar bool) *App
- func (a *App) HideTitleBarGet() bool
- func (a *App) Layers(widgets []l.Widget) *App
- func (a *App) LayersGet() []l.Widget
- func (a *App) LogoAndTitle(gtx l.Context) l.Dimensions
- func (a *App) MainDirection() l.Direction
- func (a *App) MainFrame(gtx l.Context) l.Dimensions
- func (a *App) MenuBackground(menuBackground string) *App
- func (a *App) MenuBackgroundGet() string
- func (a *App) MenuButton(gtx l.Context) l.Dimensions
- func (a *App) MenuColor(menuColor string) *App
- func (a *App) MenuColorGet() string
- func (a *App) MenuIcon(menuIcon *[]byte) *App
- func (a *App) MenuIconGet() *[]byte
- func (a *App) NoMenuButton(_ l.Context) l.Dimensions
- func (a *App) Pages(widgets WidgetMap) *App
- func (a *App) PagesGet() WidgetMap
- func (a *App) Placeholder(title string) func(gtx l.Context) l.Dimensions
- func (a *App) RenderButtonBar(gtx l.Context) l.Dimensions
- func (a *App) RenderHeader(gtx l.Context) l.Dimensions
- func (a *App) RenderPage(gtx l.Context) l.Dimensions
- func (a *App) RenderStatusBar(gtx l.Context) l.Dimensions
- func (a *App) Root(root *Stack) *App
- func (a *App) RootGet() *Stack
- func (a *App) SetMainDirection(direction l.Direction) *App
- func (a *App) SetThemeHook(f func()) *App
- func (a *App) SideBar(widgets []l.Widget) *App
- func (a *App) SideBarBackground(sideBarBackground string) *App
- func (a *App) SideBarBackgroundGet() string
- func (a *App) SideBarColor(sideBarColor string) *App
- func (a *App) SideBarColorGet() string
- func (a *App) SideBarGet() []l.Widget
- func (a *App) StatusBar(bar, barR []l.Widget) *App
- func (a *App) StatusBarBackground(statusBarBackground string) *App
- func (a *App) StatusBarBackgroundGet() string
- func (a *App) StatusBarColor(statusBarColor string) *App
- func (a *App) StatusBarColorGet() string
- func (a *App) StatusBarGet() (bar []l.Widget)
- func (a *App) Title(title string) *App
- func (a *App) TitleBarBackground(TitleBarBackground string) *App
- func (a *App) TitleBarBackgroundGet() string
- func (a *App) TitleBarColor(titleBarColor string) *App
- func (a *App) TitleBarColorGet() string
- func (a *App) TitleFont(font string) *App
- func (a *App) TitleFontGet() string
- func (a *App) TitleGet() string
- type Bool
- type BoolHook
- type Border
- type Button
- func (b *Button) Background(background string) *Button
- func (b *Button) Color(color string) *Button
- func (b *Button) CornerRadius(cornerRadius float32) *Button
- func (b *Button) Fn(gtx l.Context) l.Dimensions
- func (b *Button) Font(font string) *Button
- func (b *Button) Inset(scale float32) *Button
- func (b *Button) SetCancel(fn func()) *Button
- func (b *Button) SetClick(fn func()) *Button
- func (b *Button) SetPress(fn func()) *Button
- func (b *Button) Text(text string) *Button
- func (b *Button) TextScale(scale float32) *Button
- type ButtonLayout
- func (b *ButtonLayout) Background(color string) *ButtonLayout
- func (b *ButtonLayout) CornerRadius(radius float32) *ButtonLayout
- func (b *ButtonLayout) Corners(corners int) *ButtonLayout
- func (b *ButtonLayout) Embed(w l.Widget) *ButtonLayout
- func (b *ButtonLayout) Fn(gtx l.Context) l.Dimensions
- func (b *ButtonLayout) SetCancel(fn func()) *ButtonLayout
- func (b *ButtonLayout) SetClick(fn func()) *ButtonLayout
- func (b *ButtonLayout) SetPress(fn func()) *ButtonLayout
- type CallbackQueue
- type Cell
- type CellGrid
- type CellPriorities
- type CellPriority
- type CellRow
- type ChangeEvent
- type Checkable
- func (c *Checkable) CheckedStateIcon(ic *[]byte) *Checkable
- func (c *Checkable) Color(color string) *Checkable
- func (c *Checkable) Fn(gtx l.Context, checked bool) l.Dimensions
- func (c *Checkable) Font(font string) *Checkable
- func (c *Checkable) IconColor(color string) *Checkable
- func (c *Checkable) Label(txt string) *Checkable
- func (c *Checkable) Scale(size float32) *Checkable
- func (c *Checkable) TextScale(scale float32) *Checkable
- func (c *Checkable) UncheckedStateIcon(ic *[]byte) *Checkable
- type Checkbox
- func (c *Checkbox) Fn(gtx l.Context) l.Dimensions
- func (c *Checkbox) IconColor(color string) *Checkbox
- func (c *Checkbox) IconScale(scale float32) *Checkbox
- func (c *Checkbox) SetOnChange(fn func(b bool)) *Checkbox
- func (c *Checkbox) Text(label string) *Checkbox
- func (c *Checkbox) TextColor(color string) *Checkbox
- func (c *Checkbox) TextScale(scale float32) *Checkbox
- type Clickable
- func (c *Clickable) Clicked() bool
- func (c *Clickable) Clicks() []click
- func (c *Clickable) Fn(gtx l.Context) l.Dimensions
- func (c *Clickable) History() []press
- func (c *Clickable) SetCancel(fn func()) *Clickable
- func (c *Clickable) SetClick(fn func()) *Clickable
- func (c *Clickable) SetPress(fn func()) *Clickable
- type Collection
- type Colors
- type Column
- type ColumnRow
- type DimensionList
- func (d DimensionList) CoordinateToPosition(coordinate int, axis l.Axis) (position Position)
- func (d DimensionList) GetSizes(position Position, axis l.Axis) (total, before int)
- func (d DimensionList) GetTotal(axis l.Axis) (total int)
- func (d DimensionList) PositionToCoordinate(position Position, axis l.Axis) (coordinate int)
- type Direction
- func (d *Direction) Center() (out *Direction)
- func (d *Direction) E() (out *Direction)
- func (d *Direction) Embed(w l.Widget) *Direction
- func (d *Direction) Fn(c l.Context) l.Dimensions
- func (d *Direction) N() (out *Direction)
- func (d *Direction) NE() (out *Direction)
- func (d *Direction) NW() (out *Direction)
- func (d *Direction) S() (out *Direction)
- func (d *Direction) SE() (out *Direction)
- func (d *Direction) SW() (out *Direction)
- func (d *Direction) W() (out *Direction)
- type Editor
- func (e *Editor) Alignment(alignment text.Alignment) *Editor
- func (e *Editor) CaretCoords() f32.Point
- func (e *Editor) CaretPos() (line, col int)
- func (e *Editor) Delete(runes int)
- func (e *Editor) Events() []EditorEvent
- func (e *Editor) Focus()
- func (e *Editor) Focused() bool
- func (e *Editor) Insert(s string)
- func (e *Editor) Layout(gtx layout.Context, sh text.Shaper, font text.Font, size unit.Value) layout.Dimensions
- func (e *Editor) Len() int
- func (e *Editor) Mask(mask rune) *Editor
- func (e *Editor) Move(distance int)
- func (e *Editor) NumLines() int
- func (e *Editor) PaintCaret(gtx layout.Context)
- func (e *Editor) PaintText(gtx layout.Context)
- func (e *Editor) SetChange(changeFn func(txt string)) *Editor
- func (e *Editor) SetFocus(focusFn func(is bool)) *Editor
- func (e *Editor) SetSubmit(submitFn func(txt string)) *Editor
- func (e *Editor) SetText(s string) *Editor
- func (e *Editor) SingleLine() *Editor
- func (e *Editor) Submit(submit bool) *Editor
- func (e *Editor) Text() string
- type EditorEvent
- type Enum
- type Filler
- type Flex
- func (f *Flex) AlignBaseline() (out *Flex)
- func (f *Flex) AlignEnd() (out *Flex)
- func (f *Flex) AlignMiddle() (out *Flex)
- func (f *Flex) AlignStart() (out *Flex)
- func (f *Flex) Flexed(wgt float32, w l.Widget) (out *Flex)
- func (f *Flex) Fn(c l.Context) l.Dimensions
- func (f *Flex) Rigid(w l.Widget) (out *Flex)
- func (f *Flex) SpaceAround() (out *Flex)
- func (f *Flex) SpaceBetween() (out *Flex)
- func (f *Flex) SpaceEnd() (out *Flex)
- func (f *Flex) SpaceEvenly() (out *Flex)
- func (f *Flex) SpaceSides() (out *Flex)
- func (f *Flex) SpaceStart() (out *Flex)
- func (f *Flex) Vertical() (out *Flex)
- type Float
- type Fonts
- type Icon
- type IconButton
- func (b *IconButton) Background(color string) *IconButton
- func (b *IconButton) ButtonInset(inset float32) *IconButton
- func (b *IconButton) Color(color string) *IconButton
- func (b *IconButton) Corners(corners int) *IconButton
- func (b *IconButton) Fn(gtx l.Context) l.Dimensions
- func (b *IconButton) Icon(ic *Icon) *IconButton
- func (b *IconButton) Scale(scale float32) *IconButton
- func (b *IconButton) SetCancel(fn func()) *IconButton
- func (b *IconButton) SetClick(fn func()) *IconButton
- func (b *IconButton) SetPress(fn func()) *IconButton
- type IconByColor
- type IconBySize
- type IconCache
- type Icons
- type Image
- type IncDec
- func (in *IncDec) Amount(n int) *IncDec
- func (in *IncDec) Background(color string) *IncDec
- func (in *IncDec) ChangeHook(fn func(n int)) *IncDec
- func (in *IncDec) Color(color string) *IncDec
- func (in *IncDec) Fn(gtx l.Context) l.Dimensions
- func (in *IncDec) GetCurrent() int
- func (in *IncDec) Inactive(color string) *IncDec
- func (in *IncDec) Max(max int) *IncDec
- func (in *IncDec) Min(min int) *IncDec
- func (in *IncDec) NDigits(nDigits int) *IncDec
- func (in *IncDec) Scale(n float32) *IncDec
- func (in *IncDec) SetCurrent(current int) *IncDec
- type Indefinite
- type Input
- type Inset
- type IntSlider
- type Label
- func (l *Label) Alignment(alignment text.Alignment) *Label
- func (l *Label) Color(color string) *Label
- func (l *Label) Fn(gtx l.Context) l.Dimensions
- func (l *Label) Font(font string) *Label
- func (l *Label) MaxLines(maxLines int) *Label
- func (l *Label) Text(text string) *Label
- func (l *Label) TextScale(scale float32) *Label
- type List
- func (li *List) Active(color string) *List
- func (li *List) Background(color string) *List
- func (li *List) Baseline() *List
- func (li *List) Color(color string) *List
- func (li *List) DisableScroll(disable bool) *List
- func (li *List) Dragging() bool
- func (li *List) End() *List
- func (li *List) Fn(gtx l.Context) l.Dimensions
- func (li *List) JumpToEnd()
- func (li *List) JumpToStart()
- func (li *List) Layout(gtx l.Context, len int, w ListElement) l.Dimensions
- func (li *List) LeftSide(b bool) (out *List)
- func (li *List) Length(length int) *List
- func (li *List) ListElement(w ListElement) *List
- func (li *List) Middle() *List
- func (li *List) Position() Position
- func (li *List) ScrollToEnd() (out *List)
- func (li *List) ScrollWidth(width int) *List
- func (li *List) SetPosition(position Position)
- func (li *List) Slice(gtx l.Context, widgets ...l.Widget) l.Widget
- func (li *List) Start() *List
- func (li *List) Vertical() (out *List)
- type ListElement
- type Multi
- type Password
- type Pool
- func (p *Pool) FreeBool(b *Bool)
- func (p *Pool) FreeCheckable(b *Checkable)
- func (p *Pool) FreeClickable(b *Clickable)
- func (p *Pool) FreeEditor(b *Editor)
- func (p *Pool) FreeIncDec(b *IncDec)
- func (p *Pool) FreeList(b *List)
- func (p *Pool) GetBool() (out *Bool)
- func (p *Pool) GetCheckable() (out *Checkable)
- func (p *Pool) GetClickable() (out *Clickable)
- func (p *Pool) GetEditor() (out *Editor)
- func (p *Pool) GetIncDec() (out *IncDec)
- func (p *Pool) GetList() (out *List)
- func (p *Pool) Reset()
- type Position
- type ProgressBar
- type RadioButton
- type Responsive
- type Rows
- type ScaleType
- type Slider
- type Stack
- type SubmitEvent
- type Switch
- type Table
- type Text
- type TextInput
- func (ti *TextInput) Color(color string) *TextInput
- func (ti *TextInput) Fn(c l.Context) l.Dimensions
- func (ti *TextInput) Font(font string) *TextInput
- func (ti *TextInput) Hint(hint string) *TextInput
- func (ti *TextInput) HintColor(color string) *TextInput
- func (ti *TextInput) TextScale(scale float32) *TextInput
- type TextTable
- type TextTableBody
- type TextTableHeader
- type TextTableRow
- type Theme
- type WidgetMap
- type WidgetSize
- type Widgets
- type Window
- func (w *Window) App(size *int, activePage *uberatomic.String, invalidate chan struct{}, ...) *App
- func (w *Window) Body1(txt string) (l *Label)
- func (w *Window) Body2(txt string) (l *Label)
- func (w *Window) Bool(value bool) *Bool
- func (w *Window) Border() *Border
- func (w *Window) Button(btn *Clickable) *Button
- func (w *Window) ButtonLayout(button *Clickable) *ButtonLayout
- func (w *Window) Caption(txt string) (l *Label)
- func (w *Window) Card(background string, embed l.Widget) func(gtx l.Context) l.Dimensions
- func (w *Window) CardContent(title, color string, embed l.Widget) func(gtx l.Context) l.Dimensions
- func (w *Window) CardList(list *List, background string, widgets ...l.Widget) func(gtx l.Context) l.Dimensions
- func (w *Window) CheckBox(checkBox *Bool) *Checkbox
- func (w *Window) Checkable() *Checkable
- func (w *Window) Clickable() (c *Clickable)
- func (w *Window) Column(rows Rows, font string, scale float32, color string, background string) *Column
- func (w *Window) Direction() (out *Direction)
- func (w *Window) Editor() *Editor
- func (w *Window) Enum() *Enum
- func (w *Window) Fill(col string, dxn l.Direction, radius float32, corners int, embed l.Widget) *Filler
- func (w *Window) H1(txt string) (l *Label)
- func (w *Window) H2(txt string) (l *Label)
- func (w *Window) H3(txt string) (l *Label)
- func (w *Window) H4(txt string) (l *Label)
- func (w *Window) H5(txt string) (l *Label)
- func (w *Window) H6(txt string) (l *Label)
- func (w *Window) Icon() *Icon
- func (w *Window) IconButton(button *Clickable) *IconButton
- func (w *Window) IncDec() (out *IncDec)
- func (w *Window) Indefinite() *Indefinite
- func (w *Window) Input(txt, hint, borderColorFocused, borderColorUnfocused, backgroundColor string, ...) *Input
- func (w *Window) Inset(pad float32, embed l.Widget) (out *Inset)
- func (w *Window) IntSlider() *IntSlider
- func (w *Window) Label() (l *Label)
- func (w *Window) List() (li *List)
- func (w *Window) Multiline(txt *cli.StringSlice, ...) (m *Multi)
- func (w *Window) NewPool() *Pool
- func (w *Window) Open() (out *Window)
- func (w *Window) Overlay(gtx l.Context)
- func (w *Window) Password(hint string, password *string, ...) *Password
- func (w *Window) PopOverlay()
- func (w *Window) ProgressBar() *ProgressBar
- func (w *Window) PushOverlay(overlay func(gtx l.Context))
- func (w *Window) RadioButton(checkable *Checkable, group *Enum, key, label string) *RadioButton
- func (w *Window) Run(frame func(ctx l.Context) l.Dimensions, overlay func(ctx l.Context), ...) (e error)
- func (w *Window) Scale(s float32) *Window
- func (w *Window) Size(width, height float32) (out *Window)
- func (w *Window) Slider() *Slider
- func (w *Window) Stack() (out *Stack)
- func (w *Window) Switch(swtch *Bool) *Switch
- func (w *Window) Table() *Table
- func (w *Window) Text() *Text
- func (w *Window) TextInput(editor *Editor, hint string) *TextInput
- func (w *Window) Title(title string) (out *Window)
Constants ¶
const ( NW = 1 << iota NE SW SE )
const Inf = 1e6
Variables ¶
var F, E, W, I, D, T logg.LevelPrinter = logg.GetLogPrinterSet(subsystem)
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
CopyContextDimensionsWithMaxAxis copies the dimensions out with the max set by an image.Point along the axis
func EmptyFromSize ¶ added in v0.4.16
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
Fill is a general fill function that covers the background of the current context space
func GetDimension ¶ added in v0.4.16
func GetInfContext ¶ added in v0.4.16
GetInfContext creates a context with infinite max constraints
Types ¶
type App ¶ added in v0.4.16
type App struct { *Window Logo *[]byte 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 (*App) ActivePageGet ¶ added in v0.4.16
func (*App) ActivePageGetAtomic ¶ added in v0.4.16
func (a *App) ActivePageGetAtomic() *uberatomic.String
func (*App) BodyBackground ¶ added in v0.4.16
func (*App) BodyBackgroundGet ¶ added in v0.4.16
func (*App) BodyColorGet ¶ added in v0.4.16
func (*App) ButtonBarGet ¶ added in v0.4.16
func (*App) CardBackground ¶ added in v0.4.16
func (*App) CardBackgroundGet ¶ added in v0.4.16
func (*App) CardColorGet ¶ added in v0.4.16
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 (*App) HideSideBarGet ¶ added in v0.4.16
func (*App) HideTitleBar ¶ added in v0.4.16
func (*App) HideTitleBarGet ¶ added in v0.4.16
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 (*App) MenuBackground ¶ added in v0.4.16
func (*App) MenuBackgroundGet ¶ added in v0.4.16
func (*App) MenuButton ¶ added in v0.4.16
func (a *App) MenuButton(gtx l.Context) l.Dimensions
func (*App) MenuColorGet ¶ added in v0.4.16
func (*App) MenuIconGet ¶ added in v0.4.16
func (*App) NoMenuButton ¶ added in v0.4.16
func (a *App) NoMenuButton(_ l.Context) l.Dimensions
func (*App) Placeholder ¶ added in v1.9.16
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) SetMainDirection ¶ added in v1.9.16
func (*App) SetThemeHook ¶ added in v1.9.23
func (*App) SideBarBackground ¶ added in v0.4.16
func (*App) SideBarBackgroundGet ¶ added in v0.4.16
func (*App) SideBarColor ¶ added in v0.4.16
func (*App) SideBarColorGet ¶ added in v0.4.16
func (*App) SideBarGet ¶ added in v0.4.16
func (*App) StatusBarBackground ¶ added in v0.4.16
func (*App) StatusBarBackgroundGet ¶ added in v0.4.16
func (*App) StatusBarColor ¶ added in v0.4.16
func (*App) StatusBarColorGet ¶ added in v0.4.16
func (*App) StatusBarGet ¶ added in v0.4.16
func (*App) TitleBarBackground ¶ added in v0.4.16
func (*App) TitleBarBackgroundGet ¶ added in v0.4.16
func (*App) TitleBarColor ¶ added in v0.4.16
func (*App) TitleBarColorGet ¶ added in v0.4.16
func (*App) TitleFontGet ¶ added in v0.4.16
type Bool ¶ added in v0.4.16
type Bool struct { *Window // contains filtered or unexported fields }
func (*Bool) Changed ¶ added in v0.4.16
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) 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
SetOnChange sets the callback function to run when the state changes
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) CornerRadius ¶ added in v0.4.16
CornerRadius sets the radius of the curve on the corners
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
Background sets the background color
func (*Button) CornerRadius ¶ added in v0.4.16
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) SetCancel ¶ added in v0.4.16
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
SetClick defines the callback to run on a click (mouse up) event
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 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 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
CheckedStateIcon loads the icon for the checked state
func (*Checkable) Scale ¶ added in v0.4.16
Scale sets the size of the checkbox icon relative to the base font size
func (*Checkable) TextScale ¶ added in v0.4.16
TextScale sets the size of the font relative to the base text size
func (*Checkable) UncheckedStateIcon ¶ added in v0.4.16
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) SetOnChange ¶ added in v0.4.16
SetOnChange sets the callback when a state change event occurs
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
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.
type Collection ¶ added in v0.4.16
type Colors ¶ added in v0.4.16
Colors is a map of names to hex strings specifying colors
func (*Colors) GetNRGBAFromName ¶ added in v0.4.16
GetNRGBAFromName returns the named color from the map
type Column ¶ added in v0.4.16
type Column struct { *Window // contains filtered or unexported fields }
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
func (*Direction) Center ¶ added in v0.4.16
Center sets the relevant direction for the Direction layout
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
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) CaretCoords ¶ added in v0.4.16
CaretCoords returns the coordinates of the caret, relative to the editor itself.
func (*Editor) Delete ¶ added in v0.4.16
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) Insert ¶ added in v0.4.16
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) Move ¶ added in v0.4.16
Move the caret: positive distance moves forward, negative distance moves backward.
func (*Editor) PaintCaret ¶ added in v0.4.16
func (*Editor) SingleLine ¶ added in v0.4.16
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
Changed reports whether Value has changed by user interaction since the last call to Changed.
func (*Enum) SetOnChange ¶ added in v0.4.16
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
type Flex ¶ added in v0.4.16
type Flex struct {
// contains filtered or unexported fields
}
func (*Flex) AlignBaseline ¶ added in v0.4.16
AlignBaseline sets alignment for layout from Baseline
func (*Flex) AlignMiddle ¶ added in v0.4.16
AlignMiddle sets alignment for layout from Middle
func (*Flex) AlignStart ¶ added in v0.4.16
AlignStart sets alignment for layout from Start
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) SpaceAround ¶ added in v0.4.16
SpaceAround sets the corresponding flex spacing parameter
func (*Flex) SpaceBetween ¶ added in v0.4.16
SpaceBetween sets the corresponding flex spacing parameter
func (*Flex) SpaceEvenly ¶ added in v0.4.16
SpaceEvenly sets the corresponding flex spacing parameter
func (*Flex) SpaceSides ¶ added in v0.4.16
SpaceSides sets the corresponding flex spacing parameter
func (*Flex) SpaceStart ¶ added in v0.4.16
SpaceStart sets the corresponding flex spacing parameter
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
Changed reports whether the value has changed since the last call to Changed.
type Icon ¶ added in v0.4.16
type Icon struct { *Window // contains filtered or unexported fields }
func (*Icon) Color ¶ added in v0.4.16
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
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 IconBySize ¶ added in v0.4.16
type IconBySize map[float32]IconByColor
type IconCache ¶ added in v0.4.16
type IconCache map[*[]byte]IconBySize
type Image ¶ added in v0.4.16
type Image struct {
// contains filtered or unexported fields
}
Image is a widget that displays an image.
type IncDec ¶ added in v0.4.16
type IncDec struct { *Window // contains filtered or unexported fields }
func (*IncDec) Background ¶ added in v0.4.16
func (*IncDec) ChangeHook ¶ added in v0.4.16
func (*IncDec) GetCurrent ¶ added in v0.4.16
func (*IncDec) SetCurrent ¶ added in v0.4.16
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 Inset ¶ added in v0.4.16
type Inset struct { *Window // contains filtered or unexported fields }
type IntSlider ¶ added in v0.4.16
type IntSlider struct { *Window // contains filtered or unexported fields }
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
Alignment sets the text alignment, left, right or centered
func (*Label) Fn ¶ added in v0.4.16
func (l *Label) Fn(gtx l.Context) l.Dimensions
Fn renders the label as specified
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) Background ¶ added in v0.4.16
func (*List) DisableScroll ¶ added in v0.4.16
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) 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) ListElement ¶ added in v0.4.16
func (li *List) ListElement(w ListElement) *List
func (*List) ScrollToEnd ¶ added in v0.4.16
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 (*List) SetPosition ¶ added in v0.4.16
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) PopulateWidgets ¶ added in v0.4.16
func (*Multi) UpdateWidgets ¶ added in v0.4.16
type Password ¶ added in v0.4.16
type Password struct { *Window // contains filtered or unexported fields }
func (*Password) GetPassword ¶ added in v0.4.16
type Pool ¶ added in v0.4.16
type Pool struct { *Window // contains filtered or unexported fields }
func (*Pool) FreeCheckable ¶ added in v0.4.16
func (*Pool) FreeClickable ¶ added in v0.4.16
func (*Pool) FreeEditor ¶ added in v0.4.16
func (*Pool) FreeIncDec ¶ added in v0.4.16
func (*Pool) GetCheckable ¶ added in v0.4.16
func (*Pool) GetClickable ¶ added in v0.4.16
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
func (RadioButton) Fn ¶ added in v0.4.16
func (r RadioButton) Fn(gtx layout.Context) layout.Dimensions
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
func (*Responsive) Fn ¶ added in v0.4.16
func (r *Responsive) Fn(gtx l.Context) l.Dimensions
type Slider ¶ added in v0.4.16
type Slider struct { *Window // contains filtered or unexported fields }
func (*Slider) Fn ¶ added in v0.4.16
func (s *Slider) Fn(gtx l.Context) l.Dimensions
Fn renders the slider
type Stack ¶ added in v0.4.16
func (*Stack) Expanded ¶ added in v0.4.16
Expanded lays out a widget with the same max constraints as 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
DisabledColor sets the color to draw for the disabled state
func (*Switch) EnabledColor ¶ added in v0.4.16
EnabledColor sets the color to draw for the enabled state
type Table ¶ added in v0.4.16
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) CellBackground ¶ added in v0.4.16
func (*Table) HeaderBackground ¶ added in v0.4.16
func (*Table) SetReverse ¶ added in v0.4.16
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.
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) Fn ¶ added in v0.4.16
func (ti *TextInput) Fn(c l.Context) l.Dimensions
Fn renders the text input widget
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) Regenerate ¶ added in v0.4.16
Regenerate the text table.
func (*TextTable) SetDefaults ¶ added in v0.4.16
func (*TextTable) SetReverse ¶ added in v0.4.16
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 (*Theme) Responsive ¶ added in v0.4.16
func (th *Theme) Responsive(size int, widgets Widgets) *Responsive
func (*Theme) SliceToWidget ¶ added in v0.4.16
type WidgetSize ¶ added in v0.4.16
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
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 NewWindowP9 ¶ added in v0.4.16
func NewWindowP9(quit chan struct{}) (out *Window)
NewWindowP9 creates a new window
func (*Window) Border ¶ added in v0.4.16
Border creates a border with configurable color, width and corner radius.
func (*Window) Button ¶ added in v0.4.16
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) CardContent ¶ added in v0.4.16
func (*Window) Direction ¶ added in v0.4.16
Direction creates a directional layout that sets its contents to align according to the configured direction (8 cardinal directions and centered)
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) 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
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) 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 (*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) Switch ¶ added in v0.4.16
Switch creates a boolean switch widget (basically a checkbox but looks like a switch)
Source Files ¶
- app.go
- bool.go
- border.go
- buffer.go
- button.go
- buttonlayout.go
- card.go
- checkable.go
- checkbox.go
- clickable.go
- colors.go
- column.go
- dimensionlist.go
- direction.go
- doc.go
- draggable.go
- editor.go
- enum.go
- fill.go
- flex.go
- float.go
- helpers.go
- icon.go
- iconbutton.go
- image.go
- incdec.go
- indefinite.go
- input.go
- inset.go
- intslider.go
- label.go
- list.go
- log.go
- modal.go
- multi.go
- password.go
- pools.go
- pooltypes.go
- progressbar.go
- radiobutton.go
- responsive.go
- slider.go
- stack.go
- switch.go
- table.go
- text.go
- textinput.go
- texttable.go
- theme.go
- window.go