app

package
v0.0.0-...-21417f8 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	KeyBackspace  = KeyBS
	KeyTab        = KeyTAB
	KeyEsc        = KeyESC
	KeyEscape     = KeyESC
	KeyEnter      = KeyCR
	KeyBackspace2 = KeyDEL
)

These are aliases for other keys.

View Source
const (
	PrtBorderKey               = "prt.border"
	PrtBorderFocusedKey        = "prt.border.focused"
	PrtTitleKey                = "prt.title"
	PrtTitleFocusedKey         = "prt.title.focused"
	TextKey                    = "text"
	TextFocusedKey             = "text.focused"
	ListItemKey                = "list.item"
	ListItemSelectedKey        = "list.item.selected"
	ListItemSelectedFocusedKey = "list.item.selected.focused"
)

Variables

This section is empty.

Functions

func SetLogger

func SetLogger(l Logger)

SetLogger sets the logger that is used in tui.

Types

type Alignment

type Alignment int

Alignment is used to set the direction in which widgets are laid out.

const (
	Horizontal Alignment = iota
	Vertical
)

Available alignment options.

type App

type App struct {
	Cfg  *cfg.Cfg
	Runr *run.Runr
	Cldr *cld.Cldr
	Dskr *dsk.Dskr
	Actr *act.Actr
	Ticr *ana.Ticr
	Oan  *ana.Oan
	UI   *UI
	Lrnr *ml.Lrnr
}

func New

func New(c *cfg.Cfg, dir ...string) (r *App)

func (*App) Cls

func (x *App) Cls()

type BorderBse

type BorderBse struct {
	CtrlBse
	// contains filtered or unexported fields
}

func (*BorderBse) ApplyStyle

func (x *BorderBse) ApplyStyle(isFocused ...bool)

func (*BorderBse) DrawBorder

func (x *BorderBse) DrawBorder(p *Painter, fn func(*Painter, image.Point))

func (*BorderBse) Focus

func (x *BorderBse) Focus(prev ...bool) bool

func (*BorderBse) MeasureBorder

func (x *BorderBse) MeasureBorder() (borderSize, minSize image.Point)

func (*BorderBse) SetBorder

func (x *BorderBse) SetBorder(has bool)

func (*BorderBse) SetTitle

func (x *BorderBse) SetTitle(text string)

func (*BorderBse) Unfocus

func (x *BorderBse) Unfocus()

type Box

type Box struct {
	BorderBse

	// Border    bool
	Title     string
	Alignment Alignment
	// contains filtered or unexported fields
}

Box is a layout for placing widgets either horizontally or vertically. If horizontally, all widgets will have the same height. If vertically, they will all have the same width.

func NewHBox

func NewHBox(vs ...Ctrl) (r *Box)

func NewVBox

func NewVBox(vs ...Ctrl) (r *Box)

func (*Box) Add

func (x *Box) Add(vs ...Ctrl)

func (*Box) Draw

func (x *Box) Draw(p *Painter)

func (*Box) Focus

func (x *Box) Focus(prev ...bool) bool

func (*Box) FocusNext

func (x *Box) FocusNext() bool

func (*Box) FocusPrev

func (x *Box) FocusPrev() bool

func (*Box) FocusedIdx

func (x *Box) FocusedIdx() int

func (*Box) Insert

func (x *Box) Insert(i int, c Ctrl)

func (*Box) IsChildFocused

func (x *Box) IsChildFocused(child Ctrl) bool

func (*Box) MinSizeHint

func (x *Box) MinSizeHint() image.Point

MinSizeHint returns the minimum size hint for the layout.

func (*Box) OnKeyEvent

func (x *Box) OnKeyEvent(e KeyEvent)

func (*Box) Remove

func (x *Box) Remove(i int)

func (*Box) Resize

func (x *Box) Resize(size image.Point)

Resize recursively updates the size of the Box and all the widgets it contains. This is a potentially expensive operation and should be invoked with restraint.

Resize is called by the layout engine and is not intended to be used by end users.

func (*Box) SizeHint

func (x *Box) SizeHint() image.Point

SizeHint returns the recommended size hint for the layout.

func (*Box) String

func (x *Box) String() string

func (*Box) Unfocus

func (x *Box) Unfocus()

type Color

type Color int32

Color represents a color.

const (
	ColorDefault Color = iota
	ColorBlack
	ColorWhite
	ColorRed
	ColorGreen
	ColorBlue
	ColorCyan
	ColorMagenta
	ColorYellow
	ColorNavy
	ColorGray
)

Common colors.

type Ctrl

type Ctrl interface {
	Bse() *CtrlBse
	Draw(p *Painter)
	MinSizeHint() image.Point
	Size() image.Point
	SizeHint() image.Point
	SizePolicy() (SizePolicy, SizePolicy)
	Resize(size image.Point)
	OnKeyEvent(ev KeyEvent)
	Focus(prev ...bool) bool
	Unfocus()
	FocusPrev() bool
	FocusNext() bool
	IsChildFocused(child Ctrl) bool
}

Ctrl defines common operations on widgets.

type CtrlBse

type CtrlBse struct {
	Prnt Ctrl
	// contains filtered or unexported fields
}

func (*CtrlBse) Bse

func (x *CtrlBse) Bse() *CtrlBse

func (*CtrlBse) Draw

func (x *CtrlBse) Draw(p *Painter)

func (*CtrlBse) Focus

func (x *CtrlBse) Focus(prev ...bool) bool

func (*CtrlBse) FocusNext

func (x *CtrlBse) FocusNext() bool

func (*CtrlBse) FocusPrev

func (x *CtrlBse) FocusPrev() bool

func (*CtrlBse) IsChildFocused

func (x *CtrlBse) IsChildFocused(child Ctrl) bool

func (*CtrlBse) MinSizeHint

func (x *CtrlBse) MinSizeHint() image.Point

MinSizeHint returns the size below which the widget cannot shrink.

func (*CtrlBse) OnKeyEvent

func (x *CtrlBse) OnKeyEvent(ev KeyEvent)

OnKeyEvent is an empty operation to fulfill the Ctrl interface.

func (*CtrlBse) Resize

func (x *CtrlBse) Resize(size image.Point)

Resize sets the size of the widget.

func (*CtrlBse) SetSizePolicy

func (x *CtrlBse) SetSizePolicy(h, v SizePolicy)

SetSizePolicy sets the size policy for horizontal and vertical directions.

func (*CtrlBse) SetSizePolicyX

func (x *CtrlBse) SetSizePolicyX(h SizePolicy)

func (*CtrlBse) SetSizePolicyY

func (x *CtrlBse) SetSizePolicyY(v SizePolicy)

func (*CtrlBse) Size

func (x *CtrlBse) Size() image.Point

Size returns the current size of the widget.

func (*CtrlBse) SizeHint

func (x *CtrlBse) SizeHint() image.Point

SizeHint returns the size hint of the widget.

func (*CtrlBse) SizePolicy

func (x *CtrlBse) SizePolicy() (SizePolicy, SizePolicy)

SizePolicy returns the current size policy.

func (*CtrlBse) Unfocus

func (x *CtrlBse) Unfocus()

type Decoration

type Decoration int

Decoration represents a bold/underline/etc. state

const (
	DecorationInherit Decoration = iota
	DecorationOn
	DecorationOff
)

Decoration modes: Inherit from parent widget, explicitly on, or explicitly off.

type Fle

type Fle struct {
	Name string
	Pth  string
	Txt  string
}

func (*Fle) GetName

func (x *Fle) GetName() string

func (*Fle) Load

func (x *Fle) Load()

func (*Fle) Save

func (x *Fle) Save()

type HList

type HList struct {
	List
}

func NewHList

func NewHList() (r *HList)

func (*HList) Draw

func (x *HList) Draw(p *Painter)

func (*HList) Measure

func (x *HList) Measure()

func (*HList) OnKeyEvent

func (x *HList) OnKeyEvent(e KeyEvent)

type Itm

type Itm interface {
	GetName() string
}

type Key

type Key int16

Key represents both normal and special keys. For normal letters, KeyRune is used together with the Rune field in the KeyEvent.

const (
	KeyRune Key = iota + 256
	KeyUp
	KeyDown
	KeyRight
	KeyLeft
	KeyUpLeft
	KeyUpRight
	KeyDownLeft
	KeyDownRight
	KeyCenter
	KeyPgUp
	KeyPgDn
	KeyHome
	KeyEnd
	KeyInsert
	KeyDelete
	KeyHelp
	KeyExit
	KeyClear
	KeyCancel
	KeyPrint
	KeyPause
	KeyBacktab
	KeyF1
	KeyF2
	KeyF3
	KeyF4
	KeyF5
	KeyF6
	KeyF7
	KeyF8
	KeyF9
	KeyF10
	KeyF11
	KeyF12
	KeyF13
	KeyF14
	KeyF15
	KeyF16
	KeyF17
	KeyF18
	KeyF19
	KeyF20
	KeyF21
	KeyF22
	KeyF23
	KeyF24
	KeyF25
	KeyF26
	KeyF27
	KeyF28
	KeyF29
	KeyF30
	KeyF31
	KeyF32
	KeyF33
	KeyF34
	KeyF35
	KeyF36
	KeyF37
	KeyF38
	KeyF39
	KeyF40
	KeyF41
	KeyF42
	KeyF43
	KeyF44
	KeyF45
	KeyF46
	KeyF47
	KeyF48
	KeyF49
	KeyF50
	KeyF51
	KeyF52
	KeyF53
	KeyF54
	KeyF55
	KeyF56
	KeyF57
	KeyF58
	KeyF59
	KeyF60
	KeyF61
	KeyF62
	KeyF63
	KeyF64
)

These are named keys that can be handled.

const (
	KeyCtrlSpace Key = iota
	KeyCtrlA
	KeyCtrlB
	KeyCtrlC
	KeyCtrlD
	KeyCtrlE
	KeyCtrlF
	KeyCtrlG
	KeyCtrlH
	KeyCtrlI
	KeyCtrlJ
	KeyCtrlK
	KeyCtrlL
	KeyCtrlM
	KeyCtrlN
	KeyCtrlO
	KeyCtrlP
	KeyCtrlQ
	KeyCtrlR
	KeyCtrlS
	KeyCtrlT
	KeyCtrlU
	KeyCtrlV
	KeyCtrlW
	KeyCtrlX
	KeyCtrlY
	KeyCtrlZ
	KeyCtrlLeftSq // Escape
	KeyCtrlBackslash
	KeyCtrlRightSq
	KeyCtrlCarat
	KeyCtrlUnderscore
)

These are the supported control keys.

const (
	KeyNUL Key = iota
	KeySOH
	KeySTX
	KeyETX
	KeyEOT
	KeyENQ
	KeyACK
	KeyBEL
	KeyBS
	KeyTAB
	KeyLF
	KeyVT
	KeyFF
	KeyCR
	KeySO
	KeySI
	KeyDLE
	KeyDC1
	KeyDC2
	KeyDC3
	KeyDC4
	KeyNAK
	KeySYN
	KeyETB
	KeyCAN
	KeyEM
	KeySUB
	KeyESC
	KeyFS
	KeyGS
	KeyRS
	KeyUS
	KeyDEL Key = 0x7F
)

These are the defined ASCII values for key codes.

type KeyEvent

type KeyEvent struct {
	Key       Key
	Rune      rune
	Modifiers ModMask
}

KeyEvent represents a key press.

func (*KeyEvent) Name

func (ev *KeyEvent) Name() string

Name returns a user-friendly description of the key press.

type Label

type Label struct {
	CtrlBse
	// contains filtered or unexported fields
}

Label is a widget to display read-only text.

func NewLabel

func NewLabel(text string) *Label

NewLabel returns a new Label.

func (*Label) Draw

func (l *Label) Draw(p *Painter)

Draw draws the label.

func (*Label) MinSizeHint

func (l *Label) MinSizeHint() image.Point

MinSizeHint returns the minimum size the widget is allowed to be.

func (*Label) Resize

func (l *Label) Resize(size image.Point)

Resize changes the size of the Ctrl.

func (*Label) SetStyleName

func (l *Label) SetStyleName(style string)

SetStyleName sets the identifier used for custom styling.

func (*Label) SetText

func (l *Label) SetText(text string)

SetText sets the text content of the label.

func (*Label) SetWordWrap

func (l *Label) SetWordWrap(enabled bool)

SetWordWrap sets whether text content should be wrapped.

func (*Label) SizeHint

func (l *Label) SizeHint() image.Point

SizeHint returns the recommended size for the label.

func (*Label) Text

func (l *Label) Text() string

Text returns the text content of the label.

type Length

type Length struct {
	LengthX
	LengthY
}

func NewLength

func NewLength(left, right, bottom, top int) (r Length)

type LengthX

type LengthX struct {
	Left  int
	Right int
}

func NewLengthX

func NewLengthX(left, right int) (r LengthX)

func (*LengthX) Set

func (x *LengthX) Set(leftAndRight int)

func (*LengthX) Width

func (x *LengthX) Width() int

type LengthY

type LengthY struct {
	Btm int
	Top int
}

func NewLengthY

func NewLengthY(bottom, top int) (r LengthY)

func (*LengthY) Height

func (x *LengthY) Height() int

func (*LengthY) Set

func (x *LengthY) Set(bottomAndTop int)

type List

type List struct {
	BorderBse
	Padding Length
	// contains filtered or unexported fields
}

func (*List) Add

func (x *List) Add(vs ...Itm)

func (*List) ApplyStyle

func (x *List) ApplyStyle(isFocused bool)

func (*List) ClearItems

func (x *List) ClearItems()

func (*List) ClearSizeHints

func (x *List) ClearSizeHints()

func (*List) Focus

func (x *List) Focus(prev ...bool) bool

func (*List) MinSizeHint

func (x *List) MinSizeHint() image.Point

func (*List) Navigate

func (x *List) Navigate(i int, isFst ...bool)

func (*List) Next

func (x *List) Next()

func (*List) OnItemActivated

func (x *List) OnItemActivated(fn func(*List))

OnItemActivated gets called when activated (through pressing KeyEnter).

func (*List) OnSelectionChanged

func (x *List) OnSelectionChanged(fn func(*List))

OnSelectionChanged gets called whenever a new item is selected.

func (*List) Prev

func (x *List) Prev()

func (*List) RaiseActivate

func (x *List) RaiseActivate()

func (*List) RaiseSelectionChanged

func (x *List) RaiseSelectionChanged()

func (*List) RemoveAt

func (x *List) RemoveAt(i int)

func (*List) Selected

func (x *List) Selected() int

func (*List) SelectedItem

func (x *List) SelectedItem() Itm

func (*List) SetBorder

func (x *List) SetBorder(has bool)

func (*List) SetTitle

func (x *List) SetTitle(text string)

func (*List) SizeHint

func (x *List) SizeHint() image.Point

func (*List) Unfocus

func (x *List) Unfocus()

type ListItem

type ListItem struct {
	Itm   Itm
	Style Style
	X     int
	Width int
}

type Ln

type Ln struct {
	Text  string
	Width int // visible rune width
}

type Logger

type Logger interface {
	Printf(format string, args ...interface{})
}

Logger provides a interface for the standard logger.

type ModMask

type ModMask int16

ModMask is a mask of modifier keys.

const (
	ModShift ModMask = 1 << iota
	ModCtrl
	ModAlt
	ModMeta
	ModNone ModMask = 0
)

Modifiers that can be sent with a KeyEvent or a MouseEvent.

type MouseEvent

type MouseEvent struct {
	X int
	Y int
}

MouseEvent represents the event where a mouse button was pressed or released.

type Painter

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

Painter provides operations to paint on a surface.

func NewPainter

func NewPainter(s Surface, theme *Theme) *Painter

NewPainter returns a new instance of Painter.

func (*Painter) Begin

func (p *Painter) Begin()

Begin prepares the surface for painting.

func (*Painter) DrawCursor

func (p *Painter) DrawCursor(x, y int)

DrawCursor draws the cursor at the given position.

func (*Painter) DrawHorizontalLine

func (p *Painter) DrawHorizontalLine(x1, x2, y int)

DrawHorizontalLine paints a horizontal line using box characters.

func (*Painter) DrawRect

func (p *Painter) DrawRect(x, y, w, h int)

DrawRect paints a rectangle using box characters.

func (*Painter) DrawRune

func (p *Painter) DrawRune(x, y int, r rune)

DrawRune paints a rune at the given coordinate.

func (*Painter) DrawText

func (p *Painter) DrawText(x, y int, text string)

DrawText paints a string starting at the given coordinate.

func (*Painter) DrawVerticalLine

func (p *Painter) DrawVerticalLine(x, y1, y2 int)

DrawVerticalLine paints a vertical line using box characters.

func (*Painter) End

func (p *Painter) End()

End finalizes any painting that has been made.

func (*Painter) FillRect

func (p *Painter) FillRect(x, y, w, h int)

FillRect clears a rectangular area with whitespace.

func (*Painter) Repaint

func (p *Painter) Repaint(w Ctrl)

Repaint clears the surface, draws the scene and flushes it.

func (*Painter) Restore

func (p *Painter) Restore()

Restore pops the latest transform from the stack.

func (*Painter) SetStyle

func (p *Painter) SetStyle(s Style)

SetStyle sets the style used when painting.

func (*Painter) Translate

func (p *Painter) Translate(x, y int)

Translate pushes a new translation transform to the stack.

func (*Painter) WithMask

func (p *Painter) WithMask(r image.Rectangle, fn func(*Painter))

WithMask masks a painter to restrict painting within the given rectangle.

func (*Painter) WithStyle

func (p *Painter) WithStyle(s Style, fn func(*Painter))

WithStyle executes the provided function with the named Style applied on top of the current one.

func (*Painter) WithStyleKey

func (p *Painter) WithStyleKey(key string, fn func(*Painter))

WithStyleKey executes the provided function with the named Style applied on top of the current one.

type ProBox

type ProBox struct {
	Box
	// contains filtered or unexported fields
}

func NewProBox

func NewProBox(app *App) (r *ProBox)

func (*ProBox) OnKeyEvent

func (x *ProBox) OnKeyEvent(e KeyEvent)

func (*ProBox) ParseCompleted

func (x *ProBox) ParseCompleted(start time.Time, er error, reloaded bool)

func (*ProBox) ParseFle

func (x *ProBox) ParseFle(reloaded ...bool)

func (*ProBox) ReloadFle

func (x *ProBox) ReloadFle()

func (*ProBox) RunCompleted

func (x *ProBox) RunCompleted(start time.Time, er error)

func (*ProBox) RunFle

func (x *ProBox) RunFle()

func (*ProBox) SetEllapsedTxt

func (x *ProBox) SetEllapsedTxt(ellapsed time.Duration)

func (*ProBox) SetFle

func (x *ProBox) SetFle(fle *Fle)

func (*ProBox) SetSizePolicy

func (x *ProBox) SetSizePolicy(h, v SizePolicy)

func (*ProBox) String

func (x *ProBox) String() string

func (*ProBox) UpdateEllapsed

func (x *ProBox) UpdateEllapsed(ellapsed time.Duration)

type PrtBorder

type PrtBorder struct {
	Style Style
}

func NewPrtBorder

func NewPrtBorder(isFocused ...bool) (r *PrtBorder)

func (*PrtBorder) ApplyStyle

func (x *PrtBorder) ApplyStyle(isFocused ...bool)

func (*PrtBorder) Height

func (x *PrtBorder) Height() int

func (*PrtBorder) Width

func (x *PrtBorder) Width() int

type PrtTitle

type PrtTitle struct {
	Style Style
	// contains filtered or unexported fields
}

func NewPrtTitle

func NewPrtTitle(txt ...string) (r *PrtTitle)

func (*PrtTitle) ApplyStyle

func (x *PrtTitle) ApplyStyle(isFocused ...bool)

func (*PrtTitle) SetTitle

func (x *PrtTitle) SetTitle(txt string)

type ReadBox

type ReadBox struct {
	BorderBse
	Style Style
	// contains filtered or unexported fields
}

func NewReadBox

func NewReadBox(text ...string) (r *ReadBox)

func (*ReadBox) ApplyStyle

func (x *ReadBox) ApplyStyle(isFocused ...bool)

func (*ReadBox) BufEnd

func (x *ReadBox) BufEnd()

func (*ReadBox) BufStart

func (x *ReadBox) BufStart()

func (*ReadBox) CalcLines

func (x *ReadBox) CalcLines()

func (*ReadBox) Clear

func (x *ReadBox) Clear()

func (*ReadBox) ClearSizeHints

func (x *ReadBox) ClearSizeHints()

func (*ReadBox) Draw

func (x *ReadBox) Draw(p *Painter)

func (*ReadBox) Focus

func (x *ReadBox) Focus(prev ...bool) bool

func (*ReadBox) LnNext

func (x *ReadBox) LnNext()

func (*ReadBox) LnPrev

func (x *ReadBox) LnPrev()

func (*ReadBox) Measure

func (x *ReadBox) Measure()

func (*ReadBox) MinSizeHint

func (x *ReadBox) MinSizeHint() image.Point

func (*ReadBox) OnKeyEvent

func (x *ReadBox) OnKeyEvent(e KeyEvent)

func (*ReadBox) PgNext

func (x *ReadBox) PgNext()

func (*ReadBox) PgPrev

func (x *ReadBox) PgPrev()

func (*ReadBox) SetBorder

func (x *ReadBox) SetBorder(has bool)

func (*ReadBox) SetText

func (x *ReadBox) SetText(text string)

func (*ReadBox) SetTextf

func (x *ReadBox) SetTextf(format string, args ...interface{})

func (*ReadBox) SetTitle

func (x *ReadBox) SetTitle(text string)

func (*ReadBox) SizeHint

func (x *ReadBox) SizeHint() image.Point

func (*ReadBox) String

func (x *ReadBox) String() string

func (*ReadBox) Text

func (x *ReadBox) Text() string

func (*ReadBox) Unfocus

func (x *ReadBox) Unfocus()

type SizePolicy

type SizePolicy int

SizePolicy determines the space occupied by a widget.

const (
	// Preferred interprets the size hint as the preferred size.
	Preferred SizePolicy = iota
	// Minimum allows the widget to shrink down to the size hint.
	Minimum
	// Maximum allows the widget to grow up to the size hint.
	Maximum
	// Expanding makes the widget expand to the available space.
	Expanding
)

type Spacer

type Spacer struct {
	CtrlBse
}

Spacer is a widget to fill out space.

func NewSpacer

func NewSpacer() *Spacer

NewSpacer returns a new Spacer.

func (*Spacer) MinSizeHint

func (s *Spacer) MinSizeHint() image.Point

MinSizeHint returns the minimum size the widget is allowed to be.

func (*Spacer) SizeHint

func (s *Spacer) SizeHint() image.Point

SizeHint returns the recommended size for the spacer.

func (*Spacer) SizePolicy

func (s *Spacer) SizePolicy() (SizePolicy, SizePolicy)

SizePolicy returns the default layout behavior.

type Style

type Style struct {
	Fg Color
	Bg Color

	Reverse   Decoration
	Bold      Decoration
	Underline Decoration
}

Style determines how a cell should be painted. The zero value uses default from

func (Style) Merge

func (s Style) Merge(delta Style) Style

mergeIn returns the receiver Style, with any changes in delta applied.

type Surface

type Surface interface {
	SetCell(x, y int, ch rune, s Style)
	SetCursor(x, y int)
	HideCursor()
	Begin()
	End()
	Size() image.Point
}

Surface defines a surface that can be painted on.

type Tab

type Tab struct {
	Name string
	View Ctrl
}

func (*Tab) GetName

func (x *Tab) GetName() string

type Taber

type Taber struct {
	*Box
	// contains filtered or unexported fields
}

func NewTaber

func NewTaber() (r *Taber)

func (*Taber) Add

func (x *Taber) Add(name string, w Ctrl)

func (*Taber) Navigate

func (x *Taber) Navigate(i int)

func (*Taber) Next

func (x *Taber) Next()

func (*Taber) OnKeyEvent

func (x *Taber) OnKeyEvent(ev KeyEvent)

func (*Taber) Prev

func (x *Taber) Prev()

func (*Taber) RemoveAt

func (x *Taber) RemoveAt(i int)

func (*Taber) Selected

func (x *Taber) Selected() int

func (*Taber) SelectedTab

func (x *Taber) SelectedTab() *Tab

func (*Taber) TabChanged

func (x *Taber) TabChanged(l *List)

type Text

type Text struct {
	CtrlBse

	Padding LengthX
	Style   Style
	// contains filtered or unexported fields
}

func NewText

func NewText(txt ...string) (r *Text)

func (*Text) Draw

func (x *Text) Draw(p *Painter)

func (*Text) SetTxt

func (x *Text) SetTxt(txt string)

func (*Text) SetTxtf

func (x *Text) SetTxtf(format string, args ...interface{})

func (*Text) SizeHint

func (x *Text) SizeHint() image.Point

type Theme

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

Theme defines the styles for a set of identifiers.

func NewTheme

func NewTheme() (r *Theme)

func (*Theme) HasStyle

func (p *Theme) HasStyle(key string) bool

func (*Theme) SetStyle

func (p *Theme) SetStyle(key string, i Style)

func (*Theme) Style

func (p *Theme) Style(key string) Style

Style returns the style associated with an identifier. If there is no Style associated with the name, it returns a default Style.

type UI

type UI struct {
	*UIBse
	App         *App
	Main        *Box
	MainLeft    *VList
	MainRight   *ProBox
	Btm         *Box
	ScriptTaber *Taber
	Console     *ReadBox
	HasLeft     bool
	HasBtm      bool
}

func NewUI

func NewUI(app *App) (r *UI)

func (*UI) FleOpn

func (x *UI) FleOpn(l *List)

func (*UI) Init

func (x *UI) Init()

func (*UI) LoadScripts

func (x *UI) LoadScripts()

func (*UI) Log

func (x *UI) Log(s string)

func (*UI) Logf

func (x *UI) Logf(format string, args ...interface{})

func (*UI) ToggleBtm

func (x *UI) ToggleBtm()

func (*UI) ToggleLeft

func (x *UI) ToggleLeft()

func (*UI) Write

func (x *UI) Write(p []byte) (n int, err error)

type UIBse

type UIBse struct {
	Root *Box
	// contains filtered or unexported fields
}

func NewUIBse

func NewUIBse() (*UIBse, error)

func (*UIBse) ClearKeybindings

func (x *UIBse) ClearKeybindings()

ClearKeybindings reinitialises ui.keybindings so as to revert to a clear/original state

func (*UIBse) Quit

func (x *UIBse) Quit()

Quit signals to the UIBse to start shutting down.

func (*UIBse) Run

func (x *UIBse) Run() error

func (*UIBse) SetKeybinding

func (x *UIBse) SetKeybinding(seq string, fn func())

func (*UIBse) SetTheme

func (x *UIBse) SetTheme(t *Theme)

func (*UIBse) Theme

func (x *UIBse) Theme() *Theme

func (*UIBse) Update

func (x *UIBse) Update(fn func())

Schedule an update of the UIBse, running the given function in the UIBse goroutine.

Use this to update the UIBse in response to external events, like a timer tick. This method should be used any time you call methods to change UIBse objects after the first call to `UIBse.Run()`.

Changes invoked outside of either this callback or the other event handler callbacks may appear to work, but is likely a race condition. (Run your program with `go run -race` or `go install -race` to detect this!)

Calling Update from within an event handler, or from within an Update call, is an error, and will deadlock.

type VList

type VList struct {
	List
}

func NewVList

func NewVList() (r *VList)

func (*VList) Draw

func (x *VList) Draw(p *Painter)

func (*VList) Measure

func (x *VList) Measure()

func (*VList) OnKeyEvent

func (x *VList) OnKeyEvent(e KeyEvent)

Jump to

Keyboard shortcuts

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