Documentation
¶
Index ¶
- Variables
- func OptionGroup[V comparable](t *Timui, name string, selected *V, f func(*OptionGroupElement[V]))
- type Backend
- type BorderStyle
- type Draggable
- type Grid
- type GridCell
- type Key
- type MouseInput
- type OptionGroupElement
- type Panel
- type RGBAColor
- type RGBColor
- type ScrollBarTheme
- type SplitOptions
- type Theme
- type Timui
- func (t *Timui) Border(style [6]rune, fg, bg RGBColor)
- func (g *Timui) Button(name string) bool
- func (g *Timui) Checkbox(name string, checked *bool) bool
- func (t *Timui) ClipContains(pos mathi.Vec2) bool
- func (g *Timui) Columns(opts *SplitOptions, cells ...func())
- func (t *Timui) CurrentArea() *mathi.Box2
- func (t *Timui) Dialog(title string, visible *bool, content func())
- func (t *Timui) Draggable(id string, area mathi.Box2, size mathi.Vec2, pos *mathi.Vec2) (bool, bool)
- func (g *Timui) Dropdown(id string, elements int, selected *int, paint func(i int, s bool))
- func (t *Timui) Finish()
- func (t *Timui) GetMousePosition() mathi.Vec2
- func (t *Timui) Grid(body func(grid *Grid))
- func (t *Timui) HLine(style [3]rune, fg, bg RGBColor)
- func (t *Timui) Label(name string)
- func (t *Timui) MouseInput(id string) *MouseInput
- func (t *Timui) MouseInputForArea(id string, area mathi.Box2) *MouseInput
- func (t *Timui) MouseInputForSize(id string, size mathi.Vec2) *MouseInput
- func (t *Timui) Pad(top, right, bottom, left int, body func())
- func (t *Timui) Panel(body func(p *Panel))
- func (g *Timui) PeekClip() mathi.Box2
- func (t *Timui) PopArea()
- func (g *Timui) PopClip()
- func (t *Timui) PushArea(area mathi.Box2)
- func (t *Timui) PushAreaTranslation(dir mathi.Vec2)
- func (g *Timui) PushClip(area mathi.Box2)
- func (g *Timui) Rows(opts *SplitOptions, cells ...func())
- func (g *Timui) ScrollAreaV(id string, body func())
- func (t *Timui) Set(pos mathi.Vec2, char rune, fg, bg RGBColor)
- func (t *Timui) SetAlpha(pos mathi.Vec2, char rune, fg, bg RGBAColor)
- func (t *Timui) SetArea(char rune, fg, bg RGBColor)
- func (t *Timui) SetAreaAlpha(char rune, fg, bg RGBAColor)
- func (t *Timui) SetBorder(pos mathi.Vec2, char rune, fg, bg RGBColor)
- func (t *Timui) Size() mathi.Vec2
- func (t *Timui) Text(name string, pos mathi.Vec2, fg, bg RGBAColor)
- func (t *Timui) VLine(style [3]rune, fg, bg RGBColor)
- func (t *Timui) WithArea(area mathi.Box2, body func())
- func (t *Timui) WithAreaTranslation(dir mathi.Vec2, body func())
- func (g *Timui) WithClip(area mathi.Box2, body func())
- func (t *Timui) WithID(id string, body func())
- type WidgetTheme
Constants ¶
This section is empty.
Variables ¶
var ( Transparent = RGBA(0, 0, 0, 0) White = RGBA(0xff, 0xff, 0xff, 0xff) Black = RGBA(0x0, 0x0, 0x0, 0xff) )
var BorderBasic = BorderStyle{ Rect: [6]rune{'-', '|', '/', '\\', '\\', '/'}, Vertical: [3]rune{'+', '|', '+'}, Horizontal: [3]rune{'+', '-', '+'}, }
var BorderDouble = BorderStyle{ Rect: [6]rune{'═', '║', '╔', '╗', '╚', '╝'}, Vertical: [3]rune{'╦', '║', '╩'}, Horizontal: [3]rune{'╠', '═', '╣'}, }
var BorderNone = BorderStyle{ Rect: [6]rune{' ', ' ', ' ', ' ', ' ', ' '}, Vertical: [3]rune{' ', ' ', ' '}, Horizontal: [3]rune{' ', ' ', ' '}, }
var BorderRoundSingle = BorderStyle{ Rect: [6]rune{'─', '│', '╭', '╮', '╰', '╯'}, Vertical: [3]rune{'┬', '│', '┴'}, Horizontal: [3]rune{'├', '─', '┤'}, }
var BorderSingle = BorderStyle{ Rect: [6]rune{'─', '│', '┌', '┐', '└', '┘'}, Vertical: [3]rune{'┬', '│', '┴'}, Horizontal: [3]rune{'├', '─', '┤'}, }
var DefaultTheme = Theme{ BG: MustRGBS("#000"), Text: MustRGBS("#f33"), BorderLine: MustRGBS("#3ff"), BorderBG: MustRGBS("#000"), Widget: WidgetTheme{ BG: MustRGBS("#004"), Text: MustRGBS("#bbb"), Line: MustRGBS("#a0a"), HoverBG: MustRGBS("#22a"), InteractBG: MustRGBS("#008"), FocusLine: MustRGBS("#ffa"), }, ScrollBar: ScrollBarTheme{ Text: MustRGBS("#bbb"), BG: MustRGBS("#013"), ArrowBG: MustRGBS("#135"), Knob: MustRGBS("#46f"), KnobBG: MustRGBS("#00a"), }, BorderStyle: BorderDouble, }
Functions ¶
func OptionGroup ¶
func OptionGroup[V comparable](t *Timui, name string, selected *V, f func(*OptionGroupElement[V]))
Types ¶
type BorderStyle ¶
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
func (*Grid) Columns ¶
func (g *Grid) Columns(opts *SplitOptions, cells ...func(cell *GridCell))
func (*Grid) Rows ¶
func (g *Grid) Rows(opts *SplitOptions, cells ...func(cell *GridCell))
type GridCell ¶
type GridCell struct {
// contains filtered or unexported fields
}
GridCell is the context of one grid cell. Its area is the complete cell including the border lines around it, so nested splits overlap the parent's lines and their divider glyphs merge into junctions.
func (*GridCell) Columns ¶
func (c *GridCell) Columns(opts *SplitOptions, cells ...func(cell *GridCell))
func (*GridCell) Rows ¶
func (c *GridCell) Rows(opts *SplitOptions, cells ...func(cell *GridCell))
type MouseInput ¶
type MouseInput struct {
// contains filtered or unexported fields
}
func (*MouseInput) Hovered ¶
func (m *MouseInput) Hovered() int
func (*MouseInput) LeftPressed ¶
func (m *MouseInput) LeftPressed() int
func (*MouseInput) LeftReleased ¶
func (m *MouseInput) LeftReleased() bool
type OptionGroupElement ¶
type OptionGroupElement[V comparable] struct { // contains filtered or unexported fields }
func (OptionGroupElement[V]) Option ¶
func (o OptionGroupElement[V]) Option(name string, value V) bool
type RGBAColor ¶
type RGBAColor uint32
type ScrollBarTheme ¶
type SplitOptions ¶
type SplitOptions struct {
// contains filtered or unexported fields
}
func Split ¶
func Split() *SplitOptions
func (*SplitOptions) Add ¶
func (s *SplitOptions) Add(factor float32, fixed int) *SplitOptions
func (*SplitOptions) Factor ¶
func (s *SplitOptions) Factor(factors ...float32) *SplitOptions
func (*SplitOptions) Fixed ¶
func (s *SplitOptions) Fixed(fixed ...int) *SplitOptions
func (*SplitOptions) Pad ¶
func (s *SplitOptions) Pad(padding int) *SplitOptions
type Theme ¶
type Theme struct {
BG RGBColor
Text RGBColor
BorderLine RGBColor
BorderBG RGBColor
Widget WidgetTheme
ScrollBar ScrollBarTheme
BorderStyle BorderStyle
}
func (*Theme) WithBorder ¶
func (t *Theme) WithBorder(b BorderStyle, content func())
type Timui ¶
type Timui struct {
Theme Theme
// contains filtered or unexported fields
}
func (*Timui) Columns ¶
func (g *Timui) Columns(opts *SplitOptions, cells ...func())
Columns splits the current area horizontally and runs one cell func per split entry, each inside its column area. Afterwards the parent cursor is advanced to the bottom of the tallest column. Panics if the cell count does not match the split count.
func (*Timui) CurrentArea ¶
func (*Timui) GetMousePosition ¶
func (*Timui) Grid ¶
Grid draws a bordered container and runs body inside its padded area. Rows and Columns on the grid subdivide it with divider lines that join the surrounding border.
func (*Timui) MouseInput ¶
func (t *Timui) MouseInput(id string) *MouseInput
MouseInput creates a mouse area for the current cursor area
func (*Timui) MouseInputForArea ¶
func (t *Timui) MouseInputForArea(id string, area mathi.Box2) *MouseInput
MouseInputForArea creates a mouse area from given area relative to the current cursor area
func (*Timui) MouseInputForSize ¶
func (t *Timui) MouseInputForSize(id string, size mathi.Vec2) *MouseInput
MouseInputForSize creates a mouse area from given size relative to the current cursor area
func (*Timui) PushAreaTranslation ¶
func (*Timui) Rows ¶
func (g *Timui) Rows(opts *SplitOptions, cells ...func())
Rows splits the current area vertically and runs one cell func per split entry, each inside its row area. Panics if the cell count does not match the split count.
func (*Timui) ScrollAreaV ¶
func (*Timui) SetAreaAlpha ¶
func (*Timui) WithAreaTranslation ¶
WithAreaTranslation runs body with the current area translated by dir.
