Documentation
¶
Index ¶
- type Control
- type Event
- type FocusManager
- type Focusable
- type FocusableTree
- type Graphics
- func (g *Graphics) Clear()
- func (g *Graphics) Draw(x int, y int, primary rune, combine []rune, style tcell.Style)
- func (g *Graphics) Empty(x int, y int)
- func (g *Graphics) EmptyRange(x int, y int, width int, height int)
- func (g *Graphics) ForceDraw(x int, y int, primary rune, combine []rune, style tcell.Style)
- func (g *Graphics) Init(screen tcell.Screen)
- func (g *Graphics) Resize(width int, height int)
- type Layer
- type Runtime
- type Stackable
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Control ¶
type Control interface {
// Traverse is register sub controls to FocusManager by the order by focus.
Traverse(fm *FocusManager)
// Update is prepare for draw to terminal.
Update()
// Draw is rendering Control as text, to terminal.
Draw(g *Graphics)
// MinimumSize is provide size of needs to print Control.
MinimumSize(width int, height int) (Width int, Height int)
// Move is move a Control to specified position.
Move(x int, y int)
// Layout is relayout sub controls within specified size.
Layout(w int, h int)
// IsFlexibleWidth is returns true if Control is flexible on horizontal.
IsFlexibleWidth() bool
// IsFlexibleHeight is returns true if Control is flexible on vertical.
IsFlexibleHeight() bool
}
Control is graphical unit for compose a screen. Control can be contain another Control, but no distinction to interface by the see outer.
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event is notify a terminal updates.
func (*Event) GetRuntime ¶
GetRuntime returns Runtime. each controls is able to access to stack of control through this object. in example, use when needs to controls show modal another controls.
type FocusManager ¶
type FocusManager struct {
// contains filtered or unexported fields
}
FocusManager is manage focus order in controls.
func (*FocusManager) FocusNext ¶
func (fm *FocusManager) FocusNext()
FocusNext is move focus to next.
func (*FocusManager) FocusPrev ¶
func (fm *FocusManager) FocusPrev()
FocusPrev is move focus to previous.
func (*FocusManager) Grab ¶
func (fm *FocusManager) Grab()
Grab is try to activate focus on current object.
func (*FocusManager) Handle ¶
func (fm *FocusManager) Handle(ev Event)
Handle is process the event by focused control.
func (*FocusManager) Register ¶
func (fm *FocusManager) Register(t Focusable)
Register is Focusable entry add to table.
func (*FocusManager) Traverse ¶
func (fm *FocusManager) Traverse(ctrl Control)
Traverse is add all controls to table by the order of focus.
type FocusableTree ¶
type FocusableTree interface {
Focusable
// SubFocusFirst is focus to first children.
SubFocusFirst()
// SubFocusPrev is focus to previous children.
SubFocusPrev() bool
// SubFocusNext is focus to next children.
SubFocusNext() bool
// SubFocusLast is focus to last children.
SubFocusLast()
}
FocusableTree is manage focus to sub controls. if implemented this interface, parent controls stealing event, but movable focus to each children. parent controls can be delegate event to children as needed.
type Graphics ¶
type Graphics struct {
// contains filtered or unexported fields
}
Graphics is abstractions to operation for terminal. Graphics has bitmap for avoiding overdraw, also used to hide overwrap region by above layer.
func (*Graphics) EmptyRange ¶
EmptyRange is mark the cells within specified range as used.
type Runtime ¶
type Runtime interface {
Stackable
// BeginBackground is increment number of background tasks.
// Runtime is ignore events while zero than bigger of number of background tasks.
BeginBackground()
// EndBackground is decrement number of background tasks.
EndBackground()
// Repaint is do request rerender terminal.
Repaint()
}
Runtime is provide interface to for driving application. in this, contain supports stack of controls. controls able to erase self from stack through this Runtime object.