Documentation ¶
Index ¶
- type CellModel
- type CellView
- func (a *CellView) Draw()
- func (a *CellView) GetModel() CellModel
- func (a *CellView) HandleEvent(e tcell.Event) bool
- func (a *CellView) Init()
- func (a *CellView) MakeCursorVisible()
- func (a *CellView) MakeVisible(x, y int)
- func (a *CellView) Resize()
- func (a *CellView) SetCursor(x, y int)
- func (a *CellView) SetCursorX(x int)
- func (a *CellView) SetCursorY(y int)
- func (a *CellView) SetModel(model CellModel)
- func (a *CellView) SetStyle(s tcell.Style)
- func (a *CellView) SetView(view View)
- func (a *CellView) Size() (int, int)
- type Text
- func (t *Text) Alignment() Alignment
- func (t *Text) Draw()
- func (t *Text) HandleEvent(tcell.Event) bool
- func (t *Text) Resize()
- func (t *Text) SetAlignment(align Alignment)
- func (t *Text) SetStyle(style tcell.Style)
- func (t *Text) SetStyleAt(pos int, style tcell.Style)
- func (t *Text) SetText(s string)
- func (t *Text) SetView(view View)
- func (t *Text) Size() (int, int)
- func (t *Text) Style() tcell.Style
- func (t *Text) StyleAt(pos int) tcell.Style
- func (t *Text) Text() string
- type TextArea
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CellModel ¶
type CellModel interface { GetCell(x, y int) (rune, tcell.Style, []rune, int) GetBounds() (int, int) SetCursor(int, int) GetCursor() (int, int, bool, bool) MoveCursor(offx, offy int) }
CellModel models the content of a CellView. The dimensions used within a CellModel are always logical, and have origin 0, 0.
type CellView ¶
type CellView struct { WidgetWatchers // contains filtered or unexported fields }
CellView is a flexible view of a CellModel, offering both cursor management and a panning.
func (*CellView) HandleEvent ¶
HandleEvent handles events. In particular, it handles certain key events to move the cursor or pan the view.
func (*CellView) MakeCursorVisible ¶
func (a *CellView) MakeCursorVisible()
MakeCursorVisible ensures that the cursor is visible, panning the ViewPort as necessary, if the cursor is enabled.
func (*CellView) MakeVisible ¶
MakeVisible makes the given coordinates visible, if they are not already. It does this by moving the ViewPort for the CellView.
func (*CellView) Resize ¶
func (a *CellView) Resize()
Resize is called when the View is resized. It will ensure that the cursor is visible, if present.
func (*CellView) SetCursorX ¶
SetCursorX sets the the cursor column.
func (*CellView) SetCursorY ¶
SetCursorY sets the the cursor row.
type Text ¶
type Text struct { WidgetWatchers // contains filtered or unexported fields }
Text is a Widget with containing a block of text, which can optionally be styled.
func (*Text) Alignment ¶
func (t *Text) Alignment() Alignment
Alignment returns the alignment of the Text.
func (*Text) HandleEvent ¶
HandleEvent implements a tcell.EventHandler, but does nothing.
func (*Text) SetAlignment ¶
func (t *Text) SetAlignment(align Alignment)
SetAlignment sets the alignment. Negative values indicate right justification, positive values are left, and zero indicates center aligned.
func (*Text) SetStyle ¶
SetStyle sets the style used. This applies to every cell in the in the text.
func (*Text) SetStyleAt ¶
SetStyleAt sets the style at the given rune index. Note that for strings containing combining characters, it is not possible to change the style at the position of the combining character, but those positions *do* count for calculating the index. A lot of complexity can be avoided by avoiding the use of combining characters.
func (*Text) SetText ¶
SetText sets the text used for the string. Any previously set styles on individual rune indices are reset, and the default style for the widget is set.
func (*Text) SetView ¶
func (t *Text) SetView(view View)
SetView sets the View object used for the text bar.
func (*Text) Style ¶
Style returns the previously set default style. Note that individual characters may have different styles.
type TextArea ¶
type TextArea struct { CellView // contains filtered or unexported fields }
TextArea is a pannable 2 dimensional text widget. It wraps both the view and the model for text in a single, convenient widget. Text is provided as an array of strings, each of which represents a single line to display. All text in the TextArea has the same style. An optional soft cursor is available.
func (*TextArea) EnableCursor ¶
EnableCursor enables a soft cursor in the TextArea.
func (*TextArea) HideCursor ¶
HideCursor hides or shows the cursor in the TextArea. If on is true, the cursor is hidden. Note that a cursor is only shown if it is enabled.
func (*TextArea) SetContent ¶
SetContent is used to set the textual content, passed as a single string. Lines within the string are delimited by newlines.