Documentation
¶
Index ¶
- Constants
- func BasicHighlighter(e *EditBox)
- func Close()
- func Init()
- func MainLoop(c *Container)
- func Refresh(root *Container)
- type Button
- type ButtonClickEvent
- type Char
- type CharClass
- type CheckBox
- type Column
- type Container
- type Control
- type CursorMovedEvent
- type DetailView
- type Dialect
- type DrawTarget
- func (target *DrawTarget) Bounds() *Rect
- func (target *DrawTarget) Print(x, y int, foreground, background termbox.Attribute, text string, ...)
- func (target *DrawTarget) SetCell(x, y int, foreground, background termbox.Attribute, char rune) error
- func (parent *DrawTarget) Slice(childBounds *Rect) (*DrawTarget, error)
- type EditBox
- func (e *EditBox) AllChars() []*Char
- func (e *EditBox) CursorAtBeginning() bool
- func (e *EditBox) CursorChar() *Char
- func (e *EditBox) CursorNext() bool
- func (e *EditBox) CursorPrevious() bool
- func (e *EditBox) Delete() bool
- func (e *EditBox) Draw(target *DrawTarget)
- func (e *EditBox) GetBounds() *Rect
- func (e *EditBox) GetChar(index int) (*Char, error)
- func (e *EditBox) GetCursor() int
- func (e *EditBox) GetText() string
- func (e *EditBox) HandleEvent(ev escapebox.Event) bool
- func (e *EditBox) Insert(newText string)
- func (e *EditBox) SetFocus()
- func (e *EditBox) SetText(raw string)
- func (e *EditBox) UnsetFocus()
- type EventHandler
- type Focusable
- type Highlighter
- type KeyBinding
- type Label
- type Rect
- type ResizeEvent
- type TextBox
- type TextChangedEvent
- type Token
Constants ¶
const ( CommandMode = 0 InsertMode = 1 VisualLineMode = 2 )
const ( ClassNormal = 0 ClassWhiteSpace = 1 ClassSymbol = 2 )
const QuoteDouble rune = '"'
const QuoteNone rune = 0
const QuoteSingle rune = '\''
const (
SeqShiftTab = 1
)
Non-standard escape sequences
Variables ¶
This section is empty.
Functions ¶
func BasicHighlighter ¶
func BasicHighlighter(e *EditBox)
Types ¶
type Button ¶
type Button struct {
Bounds Rect
Text string
ClickHandler ButtonClickEvent
// contains filtered or unexported fields
}
func (*Button) Draw ¶
func (b *Button) Draw(target *DrawTarget)
func (*Button) UnsetFocus ¶
func (b *Button) UnsetFocus()
type ButtonClickEvent ¶
type ButtonClickEvent func(*Button)
type CheckBox ¶
type CheckBox struct {
Bounds Rect
Text string
Checked bool
// contains filtered or unexported fields
}
func (*CheckBox) Draw ¶
func (c *CheckBox) Draw(target *DrawTarget)
func (*CheckBox) UnsetFocus ¶
func (c *CheckBox) UnsetFocus()
type Container ¶
type Container struct {
Controls []Control
Focused Focusable
ResizeHandler ResizeEvent
Width int
Height int
KeyBindingFocusNext KeyBinding
KeyBindingFocusPrevious KeyBinding
KeyBindingExit KeyBinding
HandleEvent EventHandler
}
func (*Container) Draw ¶
func (c *Container) Draw(target *DrawTarget)
func (*Container) FocusPrevious ¶
func (c *Container) FocusPrevious()
type Control ¶
type Control interface {
GetBounds() *Rect
Draw(*DrawTarget)
}
type CursorMovedEvent ¶
type CursorMovedEvent func(*EditBox)
type DetailView ¶
type DetailView struct {
Bounds Rect
Columns []Column
Rows [][]string
RowBg termbox.Attribute
RowBgAlt termbox.Attribute
SelectedBg termbox.Attribute
// contains filtered or unexported fields
}
func (*DetailView) Draw ¶
func (d *DetailView) Draw(target *DrawTarget)
func (*DetailView) GetBounds ¶
func (d *DetailView) GetBounds() *Rect
func (*DetailView) HandleEvent ¶
func (d *DetailView) HandleEvent(ev escapebox.Event) bool
func (*DetailView) Reset ¶
func (d *DetailView) Reset()
func (*DetailView) SetCursor ¶
func (d *DetailView) SetCursor(row, col int)
func (*DetailView) SetFocus ¶
func (d *DetailView) SetFocus()
func (*DetailView) UnsetFocus ¶
func (d *DetailView) UnsetFocus()
type DrawTarget ¶
A DrawTarget represents a drawable portion of the terminal window. Drawing with methods like SetCell and Print will automatically translate from local coordinates to screen coordinates and clip drawing to the drawable region. It can be further subdivided by calling ChildDrawTarget().
func (*DrawTarget) Bounds ¶
func (target *DrawTarget) Bounds() *Rect
The location and size of the drawable area in local coordinates.
func (*DrawTarget) Print ¶
func (target *DrawTarget) Print(x, y int, foreground, background termbox.Attribute, text string, args ...interface{})
Write formatted text to the terminal using the "fmt" package formatting style. The text will be automatically clipped to the DrawTarget's drawable region.
func (*DrawTarget) SetCell ¶
func (target *DrawTarget) SetCell(x, y int, foreground, background termbox.Attribute, char rune) error
Set one terminal cell. If (x, y) is out of bounds, an error will be returned and the terminal will be unchanged.
func (*DrawTarget) Slice ¶
func (parent *DrawTarget) Slice(childBounds *Rect) (*DrawTarget, error)
Create a DrawTarget which allows drawing to a portion of the parent's DrawTarget area. childBounds should be specified in the parent's local coordinates.
Note: this is mostly needed if you're writing a control that contains other controls.
type EditBox ¶
type EditBox struct {
Bounds Rect
Lines [][]Char
OnTextChanged TextChangedEvent
OnCursorMoved CursorMovedEvent
Highlighter Highlighter
Dialect Dialect
// contains filtered or unexported fields
}
func (*EditBox) CursorAtBeginning ¶
func (*EditBox) CursorChar ¶
func (*EditBox) CursorNext ¶
func (*EditBox) CursorPrevious ¶
func (*EditBox) Draw ¶
func (e *EditBox) Draw(target *DrawTarget)
func (*EditBox) UnsetFocus ¶
func (e *EditBox) UnsetFocus()
type Highlighter ¶
type Highlighter func(*EditBox)
type Rect ¶
type Rect struct {
Left, Top, Width, Height int
}
func (*Rect) ContainsPoint ¶
func (*Rect) ContainsRect ¶
type ResizeEvent ¶
type ResizeEvent func()
type TextBox ¶
func (*TextBox) Draw ¶
func (t *TextBox) Draw(target *DrawTarget)
func (*TextBox) UnsetFocus ¶
func (t *TextBox) UnsetFocus()
type TextChangedEvent ¶
type TextChangedEvent func(*EditBox)