Documentation
¶
Index ¶
- Constants
- type Bordered
- type Container
- type Context
- func (ctx *Context) Fill(x, y, width, height int, rune rune, style tcell.Style)
- func (ctx *Context) Height() int
- func (ctx *Context) HideCursor()
- func (ctx *Context) Printf(x, y int, style tcell.Style, format string, a ...interface{}) int
- func (ctx *Context) SetCell(x, y int, ch rune, style tcell.Style)
- func (ctx *Context) SetCursor(x, y int)
- func (ctx *Context) Subcontext(x, y, width, height int) *Context
- func (ctx *Context) Width() int
- func (ctx *Context) X() int
- func (ctx *Context) Y() int
- type Drawable
- type DrawableInteractive
- type Fill
- type Grid
- func (grid *Grid) AddChild(content Drawable) *GridCell
- func (grid *Grid) Children() []Drawable
- func (grid *Grid) Columns(spec []GridSpec) *Grid
- func (grid *Grid) Draw(ctx *Context)
- func (grid *Grid) Invalidate()
- func (grid *Grid) RemoveChild(content Drawable)
- func (grid *Grid) Rows(spec []GridSpec) *Grid
- type GridCell
- type GridSpec
- type Interactive
- type Invalidatable
- type Simulator
- type Stack
- type Tab
- type TabContent
- type TabStrip
- type Tabs
- type Text
- type TextInput
- func (ti *TextInput) Draw(ctx *Context)
- func (ti *TextInput) Event(event tcell.Event) bool
- func (ti *TextInput) Focus(focus bool)
- func (ti *TextInput) Invalidate()
- func (ti *TextInput) OnChange(onChange func(ti *TextInput))
- func (ti *TextInput) Password(password bool) *TextInput
- func (ti *TextInput) Prompt(prompt string) *TextInput
- func (ti *TextInput) Set(value string)
- func (ti *TextInput) String() string
- type UI
Constants ¶
View Source
const ( BORDER_LEFT = 1 << iota BORDER_TOP = 1 << iota BORDER_RIGHT = 1 << iota BORDER_BOTTOM = 1 << iota )
View Source
const ( SIZE_EXACT = iota SIZE_WEIGHT = iota )
View Source
const ( TEXT_LEFT = iota TEXT_CENTER = iota TEXT_RIGHT = iota )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Bordered ¶
type Bordered struct {
Invalidatable
// contains filtered or unexported fields
}
func NewBordered ¶
func (*Bordered) Invalidate ¶
func (bordered *Bordered) Invalidate()
type Container ¶
type Container interface {
Drawable
// Return all of the drawables which are children of this one (do not
// recurse into your grandchildren).
Children() []Drawable
}
A drawable which contains other drawables
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
A context allows you to draw in a sub-region of the terminal
func (*Context) HideCursor ¶
func (ctx *Context) HideCursor()
func (*Context) Subcontext ¶
type Drawable ¶
type Drawable interface {
// Called when this renderable should draw itself.
Draw(ctx *Context)
// Specifies a function to call when this cell needs to be redrawn. The
// callback may be called in any goroutine.
OnInvalidate(callback func(d Drawable))
// Invalidates the drawable. This can be called from any goroutine.
Invalidate()
}
Drawable is a UI component that can draw. Unless specified, all methods must only be called from a single goroutine, the UI goroutine.
type DrawableInteractive ¶
type DrawableInteractive interface {
Drawable
Interactive
}
type Fill ¶
type Fill rune
func (Fill) Invalidate ¶
func (f Fill) Invalidate()
func (Fill) OnInvalidate ¶
type Grid ¶
type Grid struct {
Invalidatable
// contains filtered or unexported fields
}
func (*Grid) Invalidate ¶
func (grid *Grid) Invalidate()
func (*Grid) RemoveChild ¶
type GridCell ¶
type GridSpec ¶
type GridSpec struct {
// One of SIZE_EXACT or SIZE_WEIGHT
Strategy int
// If Strategy = SIZE_EXACT, this is the number of cells this row/col shall
// occupy. If SIZE_WEIGHT, the space left after all exact rows/cols are
// measured is distributed amonst the remainder weighted by this value.
Size int
}
Specifies the layout of a single row or column
type Interactive ¶
type Invalidatable ¶
type Invalidatable struct {
// contains filtered or unexported fields
}
func (*Invalidatable) DoInvalidate ¶
func (i *Invalidatable) DoInvalidate(d Drawable)
func (*Invalidatable) OnInvalidate ¶
func (i *Invalidatable) OnInvalidate(f func(d Drawable))
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
func (*Stack) Invalidate ¶
func (stack *Stack) Invalidate()
func (*Stack) OnInvalidate ¶
type TabContent ¶
type TabContent Tabs
func (*TabContent) Children ¶
func (content *TabContent) Children() []Drawable
func (*TabContent) Draw ¶
func (content *TabContent) Draw(ctx *Context)
func (*TabContent) Invalidate ¶
func (content *TabContent) Invalidate()
func (*TabContent) OnInvalidate ¶
func (content *TabContent) OnInvalidate(onInvalidate func(d Drawable))
type TabStrip ¶
type TabStrip Tabs
func (*TabStrip) Invalidate ¶
func (strip *TabStrip) Invalidate()
func (*TabStrip) OnInvalidate ¶
type Tabs ¶
type Tabs struct {
Tabs []*Tab
TabStrip *TabStrip
TabContent *TabContent
Selected int
// contains filtered or unexported fields
}
type Text ¶
type Text struct {
Invalidatable
// contains filtered or unexported fields
}
func (*Text) Invalidate ¶
func (t *Text) Invalidate()
type TextInput ¶
type TextInput struct {
Invalidatable
// contains filtered or unexported fields
}
func NewTextInput ¶
Creates a new TextInput. TextInputs will render a "textbox" in the entire context they're given, and process keypresses to build a string from user input.
func (*TextInput) Invalidate ¶
func (ti *TextInput) Invalidate()
type UI ¶
type UI struct {
Content DrawableInteractive
// contains filtered or unexported fields
}
func Initialize ¶
func Initialize(conf *config.AercConfig, content DrawableInteractive) (*UI, error)
func (*UI) ShouldExit ¶
Click to show internal directories.
Click to hide internal directories.