Documentation ¶
Overview ¶
Package p9 implements the plan 9 from crypto space theme
Index ¶
- Constants
- Variables
- func Check(err error) bool
- func CopyContextDimensionsWithMaxAxis(gtx l.Context, size image.Point, axis l.Axis) l.Context
- func Debug(a ...interface{})
- func Debugc(fn func() string)
- func Debugf(format string, a ...interface{})
- func Debugs(a interface{})
- 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 Error(a ...interface{})
- func Errorc(fn func() string)
- func Errorf(format string, a ...interface{})
- func Errors(a interface{})
- func Fatal(a ...interface{})
- func Fatalc(fn func() string)
- func Fatalf(format string, a ...interface{})
- func Fatals(a interface{})
- 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
- func Info(a ...interface{})
- func Infoc(fn func() string)
- func Infof(format string, a ...interface{})
- func Infos(a interface{})
- func Trace(a ...interface{})
- func Tracec(fn func() string)
- func Tracef(format string, a ...interface{})
- func Traces(a interface{})
- func Warn(a ...interface{})
- func Warnc(fn func() string)
- func Warnf(format string, a ...interface{})
- func Warns(a interface{})
- type App
- func (a *App) ActivePage(activePage string) *App
- func (a *App) ActivePageGet() string
- func (a *App) ActivePageGetAtomic() *uberatomic.String
- func (a *App) AddOverlay(overlay func(gtx l.Context)) *App
- 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) 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(gtx l.Context) l.Dimensions
- func (a *App) Overlay() func(gtx l.Context)
- func (a *App) Pages(widgets WidgetMap) *App
- func (a *App) PagesGet() WidgetMap
- 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) 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 []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) ThemeHook(f func()) *App
- 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) 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 ContextWidget
- 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(gtx l.Context, 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) Color(color string) *IconButton
- func (b *IconButton) Fn(gtx l.Context) l.Dimensions
- func (b *IconButton) Icon(ic *Icon) *IconButton
- func (b *IconButton) Inset(inset float32) *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 (e *TextInput) Color(color string) *TextInput
- func (e *TextInput) Fn(c l.Context) l.Dimensions
- func (e *TextInput) Font(font string) *TextInput
- func (e *TextInput) Hint(hint string) *TextInput
- func (e *TextInput) HintColor(color string) *TextInput
- func (e *TextInput) TextScale(scale float32) *TextInput
- type TextTable
- type TextTableBody
- type TextTableHeader
- type TextTableRow
- type Theme
- func (th *Theme) App(size *int, activePage *uberatomic.String, invalidate chan struct{}) *App
- func (th *Theme) Body1(txt string) (l *Label)
- func (th *Theme) Body2(txt string) (l *Label)
- func (th *Theme) Bool(value bool) *Bool
- func (th *Theme) Border() *Border
- func (th *Theme) Button(btn *Clickable) *Button
- func (th *Theme) ButtonLayout(button *Clickable) *ButtonLayout
- func (th *Theme) Caption(txt string) (l *Label)
- func (th *Theme) Card(background string, w l.Widget) func(gtx l.Context) l.Dimensions
- func (th *Theme) CardContent(title, color string, w l.Widget) func(gtx l.Context) l.Dimensions
- func (th *Theme) CardList(list *List, background string, widgets ...l.Widget) func(gtx l.Context) l.Dimensions
- func (th *Theme) CheckBox(checkBox *Bool) *Checkbox
- func (th *Theme) Checkable() *Checkable
- func (th *Theme) Clickable() (c *Clickable)
- func (th *Theme) Column(rows Rows, font string, scale float32, color string, background string) *Column
- func (th *Theme) Direction() (out *Direction)
- func (th *Theme) Editor() *Editor
- func (th *Theme) Enum() *Enum
- func (th *Theme) Fill(col string, w l.Widget, dxn l.Direction) *Filler
- func (th *Theme) Flex() (out *Flex)
- func (th *Theme) Float() *Float
- func (th *Theme) GetFont(font string) *text.Font
- func (th *Theme) H1(txt string) (l *Label)
- func (th *Theme) H2(txt string) (l *Label)
- func (th *Theme) H3(txt string) (l *Label)
- func (th *Theme) H4(txt string) (l *Label)
- func (th *Theme) H5(txt string) (l *Label)
- func (th *Theme) H6(txt string) (l *Label)
- func (th *Theme) Icon() *Icon
- func (th *Theme) IconButton(button *Clickable) *IconButton
- func (th *Theme) Image() *Image
- func (th *Theme) IncDec() (out *IncDec)
- func (th *Theme) Indefinite() *Indefinite
- func (th *Theme) Input(txt, hint, borderColorFocused, borderColorUnfocused, backgroundColor string, ...) *Input
- func (th *Theme) Inset(pad float32, w l.Widget) (out *Inset)
- func (th *Theme) IntSlider() *IntSlider
- func (th *Theme) Label() (l *Label)
- func (th *Theme) List() (li *List)
- func (th *Theme) Multiline(txt *cli.StringSlice, ...) (m *Multi)
- func (th *Theme) NewPool() *Pool
- func (th *Theme) Password(hint string, password *string, ...) *Password
- func (th *Theme) ProgressBar() *ProgressBar
- func (th *Theme) RadioButton(checkable *Checkable, group *Enum, key, label string) *RadioButton
- func (th *Theme) Responsive(size int, widgets Widgets) *Responsive
- func (th *Theme) SliceToWidget(w []l.Widget, axis l.Axis) l.Widget
- func (th *Theme) Slider() *Slider
- func (th *Theme) Stack() (out *Stack)
- func (th *Theme) Switch(swtch *Bool) *Switch
- func (th *Theme) Table() *Table
- func (th *Theme) Text() *Text
- func (th *Theme) TextInput(editor *Editor, hint string) *TextInput
- func (th *Theme) VFlex() (out *Flex)
- type WidgetMap
- type WidgetSize
- type Widgets
Constants ¶
const Inf = 1e6
Variables ¶
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,
}
)
Functions ¶
func CopyContextDimensionsWithMaxAxis ¶
CopyContextDimensionsWithMaxAxis copies the dimensions out with the max set by an image.Point along the axis
func EmptyFromSize ¶
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 GetDimension ¶
func GetInfContext ¶
GetInfContext creates a context with infinite max constraints
Types ¶
type App ¶
type App struct { MenuOpen bool SideBarSize unit.Value Size *int // 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 (*App) ActivePageGet ¶
func (*App) ActivePageGetAtomic ¶
func (a *App) ActivePageGetAtomic() *uberatomic.String
func (*App) BodyBackground ¶
func (*App) BodyBackgroundGet ¶
func (*App) BodyColorGet ¶
func (*App) ButtonBarGet ¶
func (*App) CardBackground ¶
func (*App) CardBackgroundGet ¶
func (*App) CardColorGet ¶
func (*App) DimensionCaption ¶
func (a *App) DimensionCaption(gtx l.Context) l.Dimensions
func (*App) HideSideBar ¶
func (*App) HideSideBarGet ¶
func (*App) HideTitleBar ¶
func (*App) HideTitleBarGet ¶
func (*App) LogoAndTitle ¶
func (a *App) LogoAndTitle(gtx l.Context) l.Dimensions
func (*App) MenuBackground ¶
func (*App) MenuBackgroundGet ¶
func (*App) MenuButton ¶
func (a *App) MenuButton(gtx l.Context) l.Dimensions
func (*App) MenuColorGet ¶
func (*App) MenuIconGet ¶
func (*App) NoMenuButton ¶
func (a *App) NoMenuButton(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) SideBarBackground ¶
func (*App) SideBarBackgroundGet ¶
func (*App) SideBarColor ¶
func (*App) SideBarColorGet ¶
func (*App) SideBarGet ¶
func (*App) StatusBarBackground ¶
func (*App) StatusBarBackgroundGet ¶
func (*App) StatusBarColor ¶
func (*App) StatusBarColorGet ¶
func (*App) StatusBarGet ¶
func (*App) TitleBarBackground ¶
func (*App) TitleBarBackgroundGet ¶
func (*App) TitleBarColor ¶
func (*App) TitleBarColorGet ¶
func (*App) TitleFontGet ¶
type Bool ¶
type Bool struct {
// contains filtered or unexported fields
}
func (*Bool) Fn ¶
func (b *Bool) Fn(gtx layout.Context) layout.Dimensions
Fn renders the events of the boolean widget
func (*Bool) History ¶
func (b *Bool) History() []press
History returns the history of presses in the buffer
func (*Bool) SetOnChange ¶
SetOnChange sets the callback function to run when the state changes
type Border ¶
type Border struct {
// contains filtered or unexported fields
}
Border lays out a widget and draws a border inside it.
func (*Border) CornerRadius ¶
CornerRadius sets the radius of the curve on the corners
type Button ¶
type Button struct {
// contains filtered or unexported fields
}
func (*Button) Background ¶
Background sets the background color
func (*Button) CornerRadius ¶
CornerRadius sets the corner radius (all measurements are scaled from the base text size)
type ButtonLayout ¶
type ButtonLayout struct {
// 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) 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()
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 CellPriorities ¶
type CellPriorities []CellPriority
func (CellPriorities) Less ¶
func (c CellPriorities) Less(i, j int) bool
func (CellPriorities) Swap ¶
func (c CellPriorities) Swap(i, j int)
type CellPriority ¶
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 {
// contains filtered or unexported fields
}
func (*Checkable) CheckedStateIcon ¶
CheckedStateIcon loads the icon for the checked state
func (*Checkable) UncheckedStateIcon ¶
UncheckedStateIcon loads the icon for the unchecked state
type Checkbox ¶
type Checkbox struct { *Checkable // contains filtered or unexported fields }
func (*Checkbox) SetOnChange ¶
SetOnChange sets the callback when a state change event occurs
type Clickable ¶
type Clickable struct { Events clickEvents // contains filtered or unexported fields }
Clickable represents a clickable area.
func (*Clickable) Clicked ¶
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.
type Collection ¶
type Colors ¶
Colors is a map of names to hex strings specifying colors
type DimensionList ¶
type DimensionList []l.Dimensions
func GetDimensionList ¶
func GetDimensionList(gtx l.Context, length int, listElement ListElement) (dims DimensionList)
func (DimensionList) CoordinateToPosition ¶
func (d DimensionList) CoordinateToPosition(coordinate int, axis l.Axis) (position Position)
func (DimensionList) GetSizes ¶
func (d DimensionList) GetSizes(position Position, axis l.Axis) (total, before int)
func (DimensionList) PositionToCoordinate ¶
func (d DimensionList) PositionToCoordinate(position Position, axis l.Axis) (coordinate int)
type Direction ¶
func (*Direction) Fn ¶
func (d *Direction) Fn(c l.Context) l.Dimensions
Fn the given widget given the context and direction
type Editor ¶
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 ¶
CaretCoords returns the coordinates of the caret, relative to the editor itself.
func (*Editor) Delete ¶
Delete runes from the caret position. The sign of runes specifies the direction to delete: positive is forward, negative is backward.
func (*Editor) Events ¶
func (e *Editor) Events() []EditorEvent
Events returns available editor events.
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) Move ¶
Move the caret: positive distance moves forward, negative distance moves backward.
func (*Editor) PaintCaret ¶
func (*Editor) SingleLine ¶
type EditorEvent ¶
type EditorEvent interface {
// contains filtered or unexported methods
}
type Enum ¶
type Enum struct {
// contains filtered or unexported fields
}
func (*Enum) Changed ¶
Changed reports whether Value has changed by user interaction since the last call to Changed.
func (*Enum) SetOnChange ¶
type Flex ¶
type Flex struct {
// contains filtered or unexported fields
}
func (*Flex) AlignBaseline ¶
AlignBaseline sets alignment for layout from Baseline
func (*Flex) AlignMiddle ¶
AlignMiddle sets alignment for layout from Middle
func (*Flex) AlignStart ¶
AlignStart sets alignment for layout from Start
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) SpaceAround ¶
SpaceAround sets the corresponding flex spacing parameter
func (*Flex) SpaceBetween ¶
SpaceBetween sets the corresponding flex spacing parameter
func (*Flex) SpaceEvenly ¶
SpaceEvenly sets the corresponding flex spacing parameter
func (*Flex) SpaceSides ¶
SpaceSides sets the corresponding flex spacing parameter
func (*Flex) SpaceStart ¶
SpaceStart sets the corresponding flex spacing parameter
type Float ¶
type Float struct {
// contains filtered or unexported fields
}
Float is for selecting a value in a range.
func (*Float) Changed ¶
Changed reports whether the value has changed since the last call to Changed.
type Icon ¶
type Icon struct {
// contains filtered or unexported fields
}
func (*Icon) Color ¶
Color sets the color of the icon image. It must be called before creating the image
type IconButton ¶
type IconButton struct {
// 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) Color ¶
func (b *IconButton) Color(color string) *IconButton
Color sets the color of the icon
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) Inset ¶
func (b *IconButton) Inset(inset float32) *IconButton
Inset sets the size of inset that goes in between the button background and the icon
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
func (*IconButton) SetClick ¶
func (b *IconButton) SetClick(fn func()) *IconButton
func (*IconButton) SetPress ¶
func (b *IconButton) SetPress(fn func()) *IconButton
type IconBySize ¶
type IconBySize map[float32]IconByColor
type IconCache ¶
type IconCache map[*[]byte]IconBySize
type Image ¶
type Image struct {
// contains filtered or unexported fields
}
Image is a widget that displays an image.
type IncDec ¶
type IncDec struct {
// contains filtered or unexported fields
}
func (*IncDec) Background ¶
func (*IncDec) ChangeHook ¶
func (*IncDec) GetCurrent ¶
func (*IncDec) SetCurrent ¶
type Indefinite ¶
type Indefinite struct {
// contains filtered or unexported fields
}
func (*Indefinite) Color ¶
func (lo *Indefinite) Color(color string) *Indefinite
Color sets the color of the spinner
func (*Indefinite) Scale ¶
func (lo *Indefinite) Scale(scale float32) *Indefinite
Scale sets the size of the spinner
type Inset ¶
type Inset struct {
// contains filtered or unexported fields
}
type Label ¶
type Label struct {
// contains filtered or unexported fields
}
type List ¶
type List struct {
// 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 ¶
func (*List) DisableScroll ¶
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) JumpToStart ¶
func (li *List) JumpToStart()
func (*List) Layout ¶
func (li *List) Layout(gtx l.Context, len int, w ListElement) l.Dimensions
Layout the List.
func (*List) ListElement ¶
func (li *List) ListElement(w ListElement) *List
func (*List) ScrollToEnd ¶
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 (*List) SetPosition ¶
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 { *Theme // contains filtered or unexported fields }
func (*Multi) PopulateWidgets ¶
func (*Multi) UpdateWidgets ¶
type Password ¶
type Password struct { *Theme // contains filtered or unexported fields }
func (*Password) GetPassword ¶
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func (*Pool) FreeCheckable ¶
func (*Pool) FreeClickable ¶
func (*Pool) FreeEditor ¶
func (*Pool) FreeIncDec ¶
func (*Pool) GetCheckable ¶
func (*Pool) GetClickable ¶
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 }
Position is a List scroll offset represented as an offset from the top edge of a child element.
type ProgressBar ¶
type ProgressBar struct {
// 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 // contains filtered or unexported fields }
func (RadioButton) Fn ¶
func (r RadioButton) Fn(gtx layout.Context) layout.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 { Widgets // contains filtered or unexported fields }
func (*Responsive) Embed ¶
func (r *Responsive) Embed(widgets Widgets) *Responsive
func (*Responsive) Fn ¶
func (r *Responsive) Fn(gtx l.Context) l.Dimensions
type Slider ¶
type Slider struct {
// contains filtered or unexported fields
}
type 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 {
// contains filtered or unexported fields
}
func (*Switch) DisabledColor ¶
DisabledColor sets the color to draw for the disabled state
func (*Switch) EnabledColor ¶
EnabledColor sets the color to draw for the enabled state
type Table ¶
type Table struct {
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) CellBackground ¶
func (*Table) HeaderBackground ¶
func (*Table) SetReverse ¶
type Text ¶
type Text struct {
// contains filtered or unexported fields
}
Text is a widget for laying out and drawing text.
type TextInput ¶
type TextInput struct {
// contains filtered or unexported fields
}
func (*TextInput) Fn ¶
func (e *TextInput) Fn(c l.Context) l.Dimensions
Fn renders the text input widget
type TextTable ¶
type TextTable struct { *Theme Header TextTableHeader Body TextTableBody HeaderColor string HeaderDarkTheme bool HeaderBackground string HeaderFont string HeaderFontScale float32 CellColor string CellBackground string CellFont string CellFontScale float32 Inset 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 ¶
Regenerate the text table.
func (*TextTable) SetDefaults ¶
func (*TextTable) SetReverse ¶
type TextTableBody ¶
type TextTableBody []TextTableRow
type TextTableHeader ¶
type TextTableHeader []string
type TextTableRow ¶
type TextTableRow []string
type Theme ¶
type Theme struct { TextSize unit.Value Colors Colors Dark *bool WidgetPool *Pool BackgroundProcessingQueue CallbackQueue // contains filtered or unexported fields }
func (*Theme) App ¶
func (th *Theme) App(size *int, activePage *uberatomic.String, invalidate chan struct{}) *App
func (*Theme) Button ¶
Button is a regular material text button where all the dimensions, colors, corners and font can be changed
func (*Theme) ButtonLayout ¶
func (th *Theme) ButtonLayout(button *Clickable) *ButtonLayout
ButtonLayout creates a button with a background and another widget over top
func (*Theme) CardContent ¶
func (*Theme) Direction ¶
Direction creates a directional layout that sets its contents to align according to the configured direction (8 cardinal directions and centered)
func (*Theme) Fill ¶
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 (*Theme) IconButton ¶
func (th *Theme) IconButton(button *Clickable) *IconButton
IconButton creates an icon with a circular background and an icon placed in the centre
func (*Theme) Indefinite ¶
func (th *Theme) Indefinite() *Indefinite
Indefinite creates an indefinite loading animation icon
func (*Theme) ProgressBar ¶
func (th *Theme) ProgressBar() *ProgressBar
ProgressBar renders a horizontal bar with an indication of completion of a process
func (*Theme) RadioButton ¶
func (th *Theme) 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 (*Theme) Responsive ¶
func (th *Theme) Responsive(size int, widgets Widgets) *Responsive
func (*Theme) Switch ¶
Switch creates a boolean switch widget (basically a checkbox but looks like a switch)
type WidgetSize ¶
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
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