Documentation
¶
Index ¶
- func NewTextEditor() (*Tile, *Tile, *Box)
- type Blank
- func (b Blank) Draw(g *Graphics)
- func (b Blank) IsFlexibleHeight() bool
- func (b Blank) IsFlexibleWidth() bool
- func (b Blank) Layout(w int, h int)
- func (b Blank) MinimumSize(width int, height int) (Width int, Height int)
- func (b Blank) Move(x int, y int)
- func (b Blank) Traverse(fm *FocusManager)
- func (b Blank) Update()
- type Box
- func (b *Box) Draw(g *Graphics)
- func (b *Box) GetOrientation() Orientation
- func (b *Box) Init(orientation Orientation)
- func (b *Box) IsFlexibleHeight() bool
- func (b *Box) IsFlexibleWidth() bool
- func (b *Box) Layout(width int, height int)
- func (b *Box) MinimumSize(width int, height int) (Width int, Height int)
- func (b *Box) Move(x int, y int)
- func (b *Box) Traverse(fm *FocusManager)
- func (b *Box) Update()
- type Card
- func (c *Card) Draw(g *Graphics)
- func (c *Card) Init(controls []Control)
- func (c *Card) IsFlexibleHeight() bool
- func (c *Card) IsFlexibleWidth() bool
- func (c *Card) Layout(w int, h int)
- func (c *Card) MinimumSize(width int, height int) (Width int, Height int)
- func (c *Card) Move(x int, y int)
- func (c *Card) Next()
- func (c *Card) Prev()
- func (c *Card) Target() Control
- func (c *Card) Traverse(fm *FocusManager)
- func (c *Card) Update()
- type Center
- func (c *Center) Draw(g *Graphics)
- func (c *Center) IsFlexibleHeight() bool
- func (c *Center) IsFlexibleWidth() bool
- func (c *Center) Layout(width int, height int)
- func (c *Center) MinimumSize(width int, height int) (Width int, Height int)
- func (c *Center) Move(x int, y int)
- func (c *Center) Traverse(fm *FocusManager)
- func (c *Center) Update()
- type Clip
- type Control
- type Event
- type FocusManager
- type Frame
- func (fr *Frame) Draw(g *Graphics)
- func (fr *Frame) IsFlexibleHeight() bool
- func (fr *Frame) IsFlexibleWidth() bool
- func (fr *Frame) Layout(width int, height int)
- func (fr *Frame) MinimumSize(width int, height int) (Width int, Height int)
- func (fr *Frame) Move(x int, y int)
- func (fr *Frame) Traverse(fm *FocusManager)
- func (fr *Frame) Update()
- type Graphics
- type Grid
- func (g *Grid) Draw(gg *Graphics)
- func (g *Grid) HeightTable(h int) []int
- func (g *Grid) Init(rowCount int, columnCount int)
- func (g *Grid) IsFlexibleHeight() bool
- func (g *Grid) IsFlexibleWidth() bool
- func (g *Grid) Layout(w int, h int)
- func (g *Grid) MaxStaticHeight(row int) int
- func (g *Grid) MaxStaticWidth(column int) int
- func (g *Grid) MinimumSize(width int, height int) (Width int, Height int)
- func (g *Grid) Move(x int, y int)
- func (g *Grid) SetControl(row int, column int, ctrl Control) *GridCell
- func (g *Grid) SetTile(row int, column int, staticWidth int, staticHeight int, ...) *GridCell
- func (g *Grid) StaticColumns(row int) int
- func (g *Grid) StaticRows(column int) int
- func (g *Grid) StaticSize() (Width int, Height int)
- func (g *Grid) Traverse(fm *FocusManager)
- func (g *Grid) Update()
- type GridCell
- type Layer
- type Orientation
- type RepaintMessage
- type Stack
- type TextBox
- func (tb *TextBox) BreakIter() iter.Seq[presenter.Segment]
- func (tb *TextBox) CursorPosition() (X int, Y int, Rune rune, Combine []rune)
- func (tb *TextBox) CursorReset()
- func (tb *TextBox) CursorUpdate()
- func (tb *TextBox) Draw(g *Graphics)
- func (tb *TextBox) GetDocument() *model.Document
- func (tb *TextBox) GetHeight() int
- func (tb *TextBox) GetScrollX() int
- func (tb *TextBox) GetScrollY() int
- func (tb *TextBox) GetWidth() int
- func (tb *TextBox) Init()
- func (tb *TextBox) TextClear()
- func (tb *TextBox) TextFrame()
- func (tb *TextBox) TextHorizontal()
- func (tb *TextBox) TextVertical()
- func (tb *TextBox) WrappedLineCount() int
- type TextPresenter
- type Tile
- func NewCenteredLabelTile(text string) *Tile
- func NewCustomListTile(items []string, cursorChar rune, prefix string) *Tile
- func NewEditTile() *Tile
- func NewFileTree(rootDir string, onFileOpen func(string)) *Tile
- func NewFixedTile(presenter TextPresenter, width, height int) *Tile
- func NewFlexTile(presenter TextPresenter) *Tile
- func NewHorizontalSeparator() *Tile
- func NewLabelTile(text string) *Tile
- func NewListTile(items []string) *Tile
- func NewTile(presenter TextPresenter) *Tile
- func NewVerticalSeparator() *Tile
- func (t *Tile) Draw(g *Graphics)
- func (t *Tile) Focus(on bool)
- func (t *Tile) Handle(ev Event)
- func (t *Tile) Init()
- func (t *Tile) IsFlexibleHeight() bool
- func (t *Tile) IsFlexibleWidth() bool
- func (t *Tile) Layout(w int, h int)
- func (t *Tile) MinimumSize(width int, height int) (Width int, Height int)
- func (t *Tile) Move(x int, y int)
- func (t *Tile) Traverse(fm *FocusManager)
- func (t *Tile) Update()
- type Window
- func (w *Window) BeginBackground()
- func (w *Window) Blit(width int, height int)
- func (w *Window) DoInBackground() bool
- func (w *Window) EndBackground()
- func (w *Window) FocusNext()
- func (w *Window) FocusPrev()
- func (w *Window) GetLayerCount() int
- func (w *Window) Handle(ev Event)
- func (w *Window) Init(s tcell.Screen, width int, height int)
- func (w *Window) Pop(returnCode int)
- func (w *Window) Push(layer Layer)
- func (w *Window) Repaint()
- func (w *Window) Resize(width int, height int)
- func (w *Window) Top() Control
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Blank ¶
type Blank struct {
}
Blank is most simply implement of Control. Blank is provide empty region, and not draw content, and not update.
func (Blank) MinimumSize ¶
MinimumSize returns zero.
type Box ¶
type Box struct {
Controls []Control
// contains filtered or unexported fields
}
Box is layout sub controls by horizontal or vertical.
func WithSeparators ¶
func WithSeparators(orientation Orientation, controls ...Control) *Box
Layout composition helpers
func (*Box) GetOrientation ¶
func (b *Box) GetOrientation() Orientation
GetOrientation returns orientation.
func (*Box) IsFlexibleHeight ¶
IsFlexibleHeight returns true if have to any flexible height controls.
func (*Box) IsFlexibleWidth ¶
IsFlexibleWidth returns true if have to any flexible width controls.
func (*Box) MinimumSize ¶
MinimumSize is calculate minimum size in consideration flex. flexible controls assigned evenly divided size of subtract static size from total size.
func (*Box) Traverse ¶
func (b *Box) Traverse(fm *FocusManager)
Traverse is register sub controls into FocusManager by the array order.
type Card ¶
Card is delegate to the which one of sub controls. uses to switch content like tab pane.
func (*Card) IsFlexibleHeight ¶
IsFlexibleHeight is delegate to current delegate target
func (*Card) IsFlexibleWidth ¶
IsFlexibleWidth is delegate to current delegate target
func (*Card) MinimumSize ¶
MinimumSize is delegate to current delegate target
func (*Card) Traverse ¶
func (c *Card) Traverse(fm *FocusManager)
Traverse is delegate to current delegate target
type Center ¶
type Center struct {
Control Control
Width int
Height int
// contains filtered or unexported fields
}
Center is Control for centering.
func (*Center) IsFlexibleHeight ¶
IsFlexibleHeight returns false.
func (*Center) IsFlexibleWidth ¶
IsFlexibleWidth returns false.
func (*Center) MinimumSize ¶
MinimumSize is provide Control minimum size with margin.
func (*Center) Traverse ¶
func (c *Center) Traverse(fm *FocusManager)
Traverse is delegate to sub control.
type Clip ¶
Clip is clipping specified region in Graphics.
func (Clip) SetContent ¶
SetContent is set a character to specified cell, if not already settled. TODO: refactor
type FocusManager ¶
type FocusManager = base.FocusManager
FocusManager is re-export from base.FocusManager.
type Frame ¶
type Frame struct {
Control Control
// contains filtered or unexported fields
}
Frame is decorate to sub control by ascii frame.
func (*Frame) IsFlexibleHeight ¶
IsFlexibleHeight is delegate to sub control.
func (*Frame) IsFlexibleWidth ¶
IsFlexibleWidth is delegate to sub control.
func (*Frame) MinimumSize ¶
func (*Frame) Traverse ¶
func (fr *Frame) Traverse(fm *FocusManager)
Traverse is delegate to sub control.
type Grid ¶
type Grid struct {
// contains filtered or unexported fields
}
Grid is layout sub controls into by lattice.
func (*Grid) HeightTable ¶
HeightTable returns height table by rows.
func (*Grid) IsFlexibleHeight ¶
IsFlexibleHeight returns false.
func (*Grid) MaxStaticHeight ¶
MaxStaticHeight returns maximum static height of specified column.
func (*Grid) MaxStaticWidth ¶
MaxStaticWidth returns maximum static width of specified column.
func (*Grid) MinimumSize ¶
MinimumSize returns size with border.
func (*Grid) SetControl ¶
SetControl is set the Control at specified cell.
func (*Grid) SetTile ¶
func (g *Grid) SetTile(row int, column int, staticWidth int, staticHeight int, presenter TextPresenter) *GridCell
SetTile is set the Tile at specified cell.
func (*Grid) StaticColumns ¶
StaticColumns returns count of columns have to static width.
func (*Grid) StaticRows ¶
StaticRows returns count of rows have to static height.
func (*Grid) StaticSize ¶
StaticSize returns static size. the static size is total size of not flexible controls.
func (*Grid) Traverse ¶
func (g *Grid) Traverse(fm *FocusManager)
Traverse is register sub controls into FocusManager by the array order.
type Orientation ¶
type Orientation int
Orientation is representation layout orientation by Horizontal either Vertical.
const ( Horizontal Orientation = iota Vertical )
type RepaintMessage ¶
type RepaintMessage struct {
}
type Stack ¶
Stack is stack of layer.
func (*Stack) Draw ¶
Draw is draw all layers or draw top layer only, if top layer's ClearBackground is true.
func (*Stack) MinimumSize ¶
MinimumSize returns maximum of minimum size of each layers.
func (*Stack) Traverse ¶
func (st *Stack) Traverse(fm *FocusManager)
Traverse is delegate to top layer.
type TextBox ¶
type TextBox struct {
Document *model.Document
X int
Y int
Width int
Height int
ShowCursor bool
// contains filtered or unexported fields
}
TextBox is editable text widget. TextBox has region of rect, rendering text within that range. long line is always wrap at right end of region.
func (*TextBox) CursorPosition ¶
CursorPosition returns position of cursor. TODO: refactor
func (*TextBox) CursorReset ¶
func (tb *TextBox) CursorReset()
CursorReset is reset cursor position and scroll.
func (*TextBox) CursorUpdate ¶
func (tb *TextBox) CursorUpdate()
CursorUpdate is scroll to until cursor visible
func (*TextBox) GetDocument ¶
GetDocument returns Document.
func (*TextBox) GetScrollX ¶
GetScrollX returns scroll amount by horizontal.
func (*TextBox) GetScrollY ¶
GetScrollY returns scroll amount by vertical.
func (*TextBox) TextFrame ¶
func (tb *TextBox) TextFrame()
TextFrame is print a frame of TextBox region.
func (*TextBox) TextHorizontal ¶
func (tb *TextBox) TextHorizontal()
TextHorizontal is print horizontal line.
func (*TextBox) TextVertical ¶
func (tb *TextBox) TextVertical()
TextVertical is print vertical line.
func (*TextBox) WrappedLineCount ¶
WrappedLineCount returns count of lines, in consideration a wrap.
type TextPresenter ¶
type TextPresenter interface {
// Present is set shown content to View.
Present(view presenter.View)
// Handle is process a event.
Handle(view presenter.View, ev tcell.Event)
// ShowCursor returns true if should be show cursor.
ShowCursor() bool
// IsFocusable returns true if should be capture the focus.
IsFocusable() bool
}
TextPresenter is show fancy content through TextBox object. in example, show frame by text, show tree by text, etc. in addition, TextPresenter is define event process. input a string when event, or change selected item, or something.
type Tile ¶
type Tile struct {
TextBox *TextBox
TextPresenter TextPresenter
MinimumWidth int
MinimumHeight int
FlexibleWidth bool
FlexibleHeight bool
}
Tile is implement of Control for TextBox.
func NewCenteredLabelTile ¶
func NewCustomListTile ¶
func NewEditTile ¶
func NewEditTile() *Tile
func NewFileTree ¶
func NewFixedTile ¶
func NewFixedTile(presenter TextPresenter, width, height int) *Tile
func NewFlexTile ¶
func NewFlexTile(presenter TextPresenter) *Tile
func NewHorizontalSeparator ¶
func NewHorizontalSeparator() *Tile
func NewLabelTile ¶
func NewListTile ¶
func (*Tile) IsFlexibleHeight ¶
IsFlexibleHeight returns Tile fields to direct.
func (*Tile) IsFlexibleWidth ¶
IsFlexibleWidth returns Tile fields to direct.
func (*Tile) MinimumSize ¶
MinimumSize returns Tile fields to direct.
func (*Tile) Traverse ¶
func (t *Tile) Traverse(fm *FocusManager)
Traverse is register TextBox to FocusManager.
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window is basic implementation of base.Runtime
func (*Window) BeginBackground ¶
func (w *Window) BeginBackground()
BeginBackground is increment number of background tasks. Runtime is ignore events while zero than bigger of number of background tasks.
func (*Window) DoInBackground ¶
DoInBackground returns true if number of background tasks is zero than bigger.
func (*Window) EndBackground ¶
func (w *Window) EndBackground()
EndBackground is decrement number of background tasks.
func (*Window) GetLayerCount ¶
GetLayerCount returns count of layers.