Documentation
¶
Index ¶
- 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
- func (c *Clip) Region(width int, height int) view.Renderer
- func (c *Clip) SetContent(x int, y int, primary rune, combining []rune, style tcell.Style)
- func (c *Clip) SetCursor(x int, y int, primary rune, combining []rune, style tcell.Style)
- func (c *Clip) Translate(offsetX int, offsetY int) view.Renderer
- type Control
- type Event
- type FocusManager
- type FoldItem
- type FoldManager
- 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 LitemarkTextViewResolver
- type Orientation
- type PlainTextViewResolver
- type RepaintMessage
- type Stack
- type TextBox
- func (tb *TextBox) BreakIter() iter.Seq[presenter.Segment]
- func (tb *TextBox) CanEdit() bool
- 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) FindNext(s string) bool
- func (tb *TextBox) FindPrev(s string) bool
- func (tb *TextBox) GetBytePosition() view.CharacterReference
- func (tb *TextBox) GetDocument() model.Document
- func (tb *TextBox) GetHeight() int
- func (tb *TextBox) GetScrollX() int
- func (tb *TextBox) GetScrollY() int
- func (tb *TextBox) GetSelection() view.TextSelection
- func (tb *TextBox) GetViewHeight() int
- func (tb *TextBox) GetViewPosition() int
- func (tb *TextBox) GetWidth() int
- func (tb *TextBox) Init()
- func (tb *TextBox) InsertString(s string)
- func (tb *TextBox) MoveDown()
- func (tb *TextBox) MoveLeft()
- func (tb *TextBox) MoveLineEnd()
- func (tb *TextBox) MoveLineStart()
- func (tb *TextBox) MoveReset()
- func (tb *TextBox) MoveRight()
- func (tb *TextBox) MoveTextEnd()
- func (tb *TextBox) MoveTextStart()
- func (tb *TextBox) MoveUp()
- func (tb *TextBox) RemoveChar()
- func (tb *TextBox) RemoveSelection()
- func (tb *TextBox) Replace(length int, s string)
- func (tb *TextBox) SelectionEnd()
- func (tb *TextBox) SelectionStart()
- func (tb *TextBox) Submit() bool
- func (tb *TextBox) TextClear()
- func (tb *TextBox) TextFrame()
- func (tb *TextBox) TextHorizontal()
- func (tb *TextBox) TextVertical()
- type TextPresenter
- type TextRenderCache
- func (trc *TextRenderCache) ForceUpdate(ctx view.Context, textBoxWidth int)
- func (trc *TextRenderCache) GetElement(index int) model.Element
- func (trc *TextRenderCache) GetItem(index int) (Element model.Element, Layout *view.TextLayout)
- func (trc *TextRenderCache) GetItemCount() int
- func (trc *TextRenderCache) GetLayout(index int) *view.TextLayout
- func (trc *TextRenderCache) Ghosts() int
- func (trc *TextRenderCache) Stats(viewPosition int) (TotalViewLen int, ElementIndex int, ViewStart int, ViewLocalPosition int)
- func (trc *TextRenderCache) Total() int
- func (trc *TextRenderCache) Update(ctx view.Context, textBoxWidth int)
- type Tile
- func NewCenteredLabelTile(text string) *Tile
- func NewCustomListTile(items []string, cursorChar rune, prefix string) *Tile
- func NewEditTile() *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 ¶
This section is empty.
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 (*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 WithCenter ¶
WithCenter returns Center as wrapper of specified Control.
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 ¶
type Clip struct {
Graphics *Graphics
X int
Y int
Width int
Height int
FirstLineY int
// contains filtered or unexported fields
}
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 FoldItem ¶ added in v0.3.0
type FoldItem struct {
// contains filtered or unexported fields
}
FoldItem is state of folded element.
type FoldManager ¶ added in v0.3.0
type FoldManager struct {
// contains filtered or unexported fields
}
FoldManager is manage list of folded elements
func (*FoldManager) AutoFold ¶ added in v0.3.0
func (fm *FoldManager) AutoFold(doc model.Document, elements []model.Element)
AutoFold is fold a longer elements.
func (*FoldManager) Refresh ¶ added in v0.3.0
func (fm *FoldManager) Refresh(doc model.Document)
Refresh is remove elements where of lost items.
func (*FoldManager) ToggleFold ¶ added in v0.3.0
func (fm *FoldManager) ToggleFold(doc model.Document, e model.Element)
ToggleFold is toggle a folding for specified element.
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 LitemarkTextViewResolver ¶ added in v0.4.0
type LitemarkTextViewResolver struct {
}
LitemarkTextViewResolver implement TextViewResolver for litemark language.
type Orientation ¶
type Orientation int
Orientation is representation layout orientation by Horizontal either Vertical.
const ( Horizontal Orientation = iota Vertical )
type PlainTextViewResolver ¶ added in v0.4.0
type PlainTextViewResolver struct {
}
PlainTextViewResolver implement TextViewResolver for plain text.
type RepaintMessage ¶
type RepaintMessage struct {
}
RepaintMessage is notify need to repaint to tcell system.
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
ViewResolver view.TextViewResolver
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.
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) FindNext ¶ added in v0.3.0
FindNext is finding text to forwards direction, and move to cursor it.
func (*TextBox) FindPrev ¶ added in v0.3.0
FindPrev is finding text to backwards direction, and move to cursor it.
func (*TextBox) GetBytePosition ¶ added in v0.4.0
func (tb *TextBox) GetBytePosition() view.CharacterReference
GetBytePosition returns byte position of cursor.
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) GetSelection ¶ added in v0.4.0
func (tb *TextBox) GetSelection() view.TextSelection
GetSelection returns selected range.
func (*TextBox) GetViewHeight ¶ added in v0.3.0
GetViewHeight returns height of total TextView.
func (*TextBox) GetViewPosition ¶ added in v0.3.0
GetViewPosition returns view position of cursor.
func (*TextBox) InsertString ¶ added in v0.3.0
InsertString is insert string into current byte position.
func (*TextBox) MoveDown ¶ added in v0.3.0
func (tb *TextBox) MoveDown()
MoveDown is move cursor to down.
func (*TextBox) MoveLeft ¶ added in v0.3.0
func (tb *TextBox) MoveLeft()
MoveLeft is move cursor to left.
func (*TextBox) MoveLineEnd ¶ added in v0.3.0
func (tb *TextBox) MoveLineEnd()
MoveLineEnd is move cursor to ends of current line.
func (*TextBox) MoveLineStart ¶ added in v0.3.0
func (tb *TextBox) MoveLineStart()
MoveLineStart is move cursor to starts of current line.
func (*TextBox) MoveReset ¶ added in v0.3.0
func (tb *TextBox) MoveReset()
MoveReset is reset cursor
func (*TextBox) MoveRight ¶ added in v0.3.0
func (tb *TextBox) MoveRight()
MoveRight is move cursor to right.
func (*TextBox) MoveTextEnd ¶ added in v0.3.0
func (tb *TextBox) MoveTextEnd()
MoveTextEnd is move cursor to ends of text.
func (*TextBox) MoveTextStart ¶ added in v0.3.0
func (tb *TextBox) MoveTextStart()
MoveTextStart is move cursor to starts of text.
func (*TextBox) RemoveChar ¶ added in v0.3.0
func (tb *TextBox) RemoveChar()
RemoveChar is remove character from current byte position to backwards.
func (*TextBox) RemoveSelection ¶ added in v0.4.0
func (tb *TextBox) RemoveSelection()
RemoveSelection is remove selected text.
func (*TextBox) SelectionEnd ¶ added in v0.4.0
func (tb *TextBox) SelectionEnd()
SelectionEnd is stop text selection.
func (*TextBox) SelectionStart ¶ added in v0.4.0
func (tb *TextBox) SelectionStart()
SelectionStart is start text selection. select text on every times to call MoveXxx, until call to SelectionEnd
func (*TextBox) Submit ¶ added in v0.3.0
Submit is try submit process on current TextView. returns true if execute in actual.
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.
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 TextRenderCache ¶ added in v0.3.0
type TextRenderCache struct {
// contains filtered or unexported fields
}
TextRenderCache is cache of render info.
func (*TextRenderCache) ForceUpdate ¶ added in v0.3.0
func (trc *TextRenderCache) ForceUpdate(ctx view.Context, textBoxWidth int)
ForceUpdate is update a cache in always.
func (*TextRenderCache) GetElement ¶ added in v0.3.0
func (trc *TextRenderCache) GetElement(index int) model.Element
GetElement returns element.
func (*TextRenderCache) GetItem ¶ added in v0.3.0
func (trc *TextRenderCache) GetItem(index int) (Element model.Element, Layout *view.TextLayout)
GetItem returns element and layout.
func (*TextRenderCache) GetItemCount ¶ added in v0.3.0
func (trc *TextRenderCache) GetItemCount() int
GetItemCount returns count of items.
func (*TextRenderCache) GetLayout ¶ added in v0.3.0
func (trc *TextRenderCache) GetLayout(index int) *view.TextLayout
GetLayout returns layout.
func (*TextRenderCache) Ghosts ¶ added in v0.4.0
func (trc *TextRenderCache) Ghosts() int
Ghosts returns count of GhostElement from array ends.
func (*TextRenderCache) Stats ¶ added in v0.3.0
func (trc *TextRenderCache) Stats(viewPosition int) (TotalViewLen int, ElementIndex int, ViewStart int, ViewLocalPosition int)
Stats returns current state.
func (*TextRenderCache) Total ¶ added in v0.3.0
func (trc *TextRenderCache) Total() int
Total returns length of total TextView.
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 ¶
NewLabelTile returns label text as Tile, and aligned center.
func NewCustomListTile ¶
NewListTile returns list as Tile.
func NewFixedTile ¶
func NewFixedTile(presenter TextPresenter, width, height int) *Tile
NewTile returns fixed Tile, returned Tile is using specified TextPresenter.
func NewFlexTile ¶
func NewFlexTile(presenter TextPresenter) *Tile
NewTile returns flex Tile, returned Tile is using specified TextPresenter.
func NewHorizontalSeparator ¶
func NewHorizontalSeparator() *Tile
NewHorizontalSeparator returns horizontal separator.
func NewTile ¶
func NewTile(presenter TextPresenter) *Tile
NewTile returns Tile, returned Tile is using specified TextPresenter.
func NewVerticalSeparator ¶
func NewVerticalSeparator() *Tile
NewVerticalSeparator returns vertical separator.
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.