tui

package module
v0.0.0-...-ded924b Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2018 License: GPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CommandMode    = 0
	InsertMode     = 1
	VisualLineMode = 2
)
View Source
const (
	ClassNormal     = 0
	ClassWhiteSpace = 1
	ClassSymbol     = 2
)
View Source
const QuoteDouble rune = '"'
View Source
const QuoteNone rune = 0
View Source
const QuoteSingle rune = '\''
View Source
const (
	SeqShiftTab = 1
)

Non-standard escape sequences

Variables

This section is empty.

Functions

func BasicHighlighter

func BasicHighlighter(e *EditBox)

func Close

func Close()

func Init

func Init()

func MainLoop

func MainLoop(c *Container)

func Refresh

func Refresh(root *Container)

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) GetBounds

func (b *Button) GetBounds() *Rect

func (*Button) HandleEvent

func (b *Button) HandleEvent(ev escapebox.Event) bool

func (*Button) SetFocus

func (b *Button) SetFocus()

func (*Button) UnsetFocus

func (b *Button) UnsetFocus()

type ButtonClickEvent

type ButtonClickEvent func(*Button)

type Char

type Char struct {
	Char rune
	Fg   termbox.Attribute
	Bg   termbox.Attribute

	// Highlighter data
	Quote   rune
	Escaped bool
}

type CharClass

type CharClass int

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) GetBounds

func (c *CheckBox) GetBounds() *Rect

func (*CheckBox) HandleEvent

func (c *CheckBox) HandleEvent(ev escapebox.Event) bool

func (*CheckBox) SetFocus

func (c *CheckBox) SetFocus()

func (*CheckBox) UnsetFocus

func (c *CheckBox) UnsetFocus()

type Column

type Column struct {
	Name  string
	Width int
}

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) FocusNext

func (c *Container) FocusNext()

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 Dialect

type Dialect func(string) Token

type DrawTarget

type DrawTarget struct {
	Width  int
	Height int
	// contains filtered or unexported fields
}

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) AllChars

func (e *EditBox) AllChars() []*Char

func (*EditBox) CursorAtBeginning

func (e *EditBox) CursorAtBeginning() bool

func (*EditBox) CursorChar

func (e *EditBox) CursorChar() *Char

func (*EditBox) CursorNext

func (e *EditBox) CursorNext() bool

func (*EditBox) CursorPrevious

func (e *EditBox) CursorPrevious() bool

func (*EditBox) Delete

func (e *EditBox) Delete() bool

func (*EditBox) Draw

func (e *EditBox) Draw(target *DrawTarget)

func (*EditBox) GetBounds

func (e *EditBox) GetBounds() *Rect

func (*EditBox) GetChar

func (e *EditBox) GetChar(index int) (*Char, error)

func (*EditBox) GetCursor

func (e *EditBox) GetCursor() int

func (*EditBox) GetText

func (e *EditBox) GetText() string

func (*EditBox) HandleEvent

func (e *EditBox) HandleEvent(ev escapebox.Event) bool

func (*EditBox) Insert

func (e *EditBox) Insert(newText string)

func (*EditBox) SetFocus

func (e *EditBox) SetFocus()

func (*EditBox) SetText

func (e *EditBox) SetText(raw string)

func (*EditBox) UnsetFocus

func (e *EditBox) UnsetFocus()

type EventHandler

type EventHandler func(c *Container, ev escapebox.Event) bool

type Focusable

type Focusable interface {
	Control
	SetFocus()
	UnsetFocus()
	HandleEvent(escapebox.Event) bool
}

type Highlighter

type Highlighter func(*EditBox)

type KeyBinding

type KeyBinding struct {
	Seq escapebox.Sequence
	Key termbox.Key
	Ch  rune
}

type Label

type Label struct {
	Bounds Rect
	Text   string
}

func (*Label) Draw

func (l *Label) Draw(target *DrawTarget)

func (*Label) GetBounds

func (l *Label) GetBounds() *Rect

type Rect

type Rect struct {
	Left, Top, Width, Height int
}

func (*Rect) Bottom

func (r *Rect) Bottom() int

func (*Rect) ContainsPoint

func (r *Rect) ContainsPoint(x, y int) bool

func (*Rect) ContainsRect

func (r *Rect) ContainsRect(other *Rect) bool

func (*Rect) Right

func (r *Rect) Right() int

type ResizeEvent

type ResizeEvent func()

type TextBox

type TextBox struct {
	Bounds Rect
	Value  string
	// contains filtered or unexported fields
}

func (*TextBox) Draw

func (t *TextBox) Draw(target *DrawTarget)

func (*TextBox) GetBounds

func (t *TextBox) GetBounds() *Rect

func (*TextBox) HandleEvent

func (t *TextBox) HandleEvent(ev escapebox.Event) bool

func (*TextBox) SetFocus

func (t *TextBox) SetFocus()

func (*TextBox) UnsetFocus

func (t *TextBox) UnsetFocus()

type TextChangedEvent

type TextChangedEvent func(*EditBox)

type Token

type Token int
const (
	TokenNone    Token = 0
	TokenKeyword Token = 1
	TokenType    Token = 2
)

func DialectMySQL

func DialectMySQL(word string) Token

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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