Documentation ¶
Index ¶
- Constants
- func String(b bufferer) (string, error)
- type GaugeColumn
- type KeyValuePar
- type MarkupPar
- type ParColumn
- type Row
- type SizableBufferer
- type Table
- type TableHeader
- func (th *TableHeader) AddColumn(s string)
- func (th *TableHeader) AddFixedWidthColumn(s string, width int)
- func (th *TableHeader) Buffer() termui.Buffer
- func (th *TableHeader) ColumnCount() int
- func (th *TableHeader) ColumnWidths() []int
- func (th *TableHeader) GetHeight() int
- func (th *TableHeader) SetWidth(w int)
- func (th *TableHeader) SetX(x int)
- func (th *TableHeader) SetY(y int)
- type TextInput
- type Widget
Constants ¶
const DefaultColumnSpacing = 1
DefaultColumnSpacing default the spacing (in chars) between columns of a table
Variables ¶
This section is empty.
Functions ¶
Types ¶
type GaugeColumn ¶
GaugeColumn is a termui.Gauge to be used as a Grid column. It is borderless, has a height of 1 and its label is left-aligned.
func NewThemedGaugeColumn ¶
func NewThemedGaugeColumn(theme *ui.ColorTheme) *GaugeColumn
NewThemedGaugeColumn creates a new GaugeColumn using the given theme
type KeyValuePar ¶
KeyValuePar is a widget for key value pairs
func NewKeyValuePar ¶
func NewKeyValuePar(key, value string, theme *ui.ColorTheme) *KeyValuePar
NewKeyValuePar creates a KeyValuePar widget with the given values
func (*KeyValuePar) Buffer ¶
func (kv *KeyValuePar) Buffer() gtermui.Buffer
Buffer returns this kv data as a gtermui.Buffer
func (*KeyValuePar) GetHeight ¶
func (kv *KeyValuePar) GetHeight() int
GetHeight returns this kv heigth
func (*KeyValuePar) SetWidth ¶
func (kv *KeyValuePar) SetWidth(width int)
SetWidth sets the width of this kv
type MarkupPar ¶
type MarkupPar struct { gizaktermui.Paragraph // contains filtered or unexported fields }
MarkupPar is a paragraph with marked-up text
func NewParFromMarkupText ¶
func NewParFromMarkupText(theme *ui.ColorTheme, str string) *MarkupPar
NewParFromMarkupText creates a new termui paragraph from marked-up text.
func (*MarkupPar) Buffer ¶
func (p *MarkupPar) Buffer() gizaktermui.Buffer
Buffer return this paragraph content as a termui.Buffer
type ParColumn ¶
ParColumn is a termui.Par that can be used in a grid to show text
func NewParColumn ¶
NewParColumn creates a new paragraph column with the given text
func NewThemedParColumn ¶
func NewThemedParColumn(theme *ui.ColorTheme, s string) *ParColumn
NewThemedParColumn creates a new paragraph column with the given text using the given color theme
type Row ¶
Row is a widget for table rows
func (*Row) AddColumn ¶
func (row *Row) AddColumn(c gtermui.GridBufferer)
AddColumn adds the given column to this row
type SizableBufferer ¶
SizableBufferer is a termui.Bufferer with dimensions and position
type Table ¶
type Table interface {
ColumnWidths() []int
}
Table defines common behaviour for table widgets
type TableHeader ¶
type TableHeader struct {
X, Y int
Height, Width int
Columns []*termui.Paragraph
ColumnSpacing int
Theme *ui.ColorTheme
// contains filtered or unexported fields
}
TableHeader is a table header widget
func NewHeader ¶
func NewHeader(Theme *ui.ColorTheme) *TableHeader
NewHeader creates a header of height 1 that uses the given Theme
func (*TableHeader) AddColumn ¶
func (th *TableHeader) AddColumn(s string)
AddColumn adds a column to this header
func (*TableHeader) AddFixedWidthColumn ¶
func (th *TableHeader) AddFixedWidthColumn(s string, width int)
AddFixedWidthColumn adds a column to this header with a fixed width
func (*TableHeader) Buffer ¶
func (th *TableHeader) Buffer() termui.Buffer
Buffer returns the content of this header as a buffer
func (*TableHeader) ColumnCount ¶
func (th *TableHeader) ColumnCount() int
ColumnCount returns the number of columns on this header
func (*TableHeader) ColumnWidths ¶
func (th *TableHeader) ColumnWidths() []int
ColumnWidths returns the width of each column of the table
func (*TableHeader) GetHeight ¶
func (th *TableHeader) GetHeight() int
GetHeight return this header's height
func (*TableHeader) SetWidth ¶
func (th *TableHeader) SetWidth(w int)
SetWidth sets the width of this header
func (*TableHeader) SetX ¶
func (th *TableHeader) SetX(x int)
SetX sets the X position of this header
func (*TableHeader) SetY ¶
func (th *TableHeader) SetY(y int)
SetY sets the Y position of this header
type TextInput ¶
type TextInput struct { termui.Block TextFgColor termui.Attribute TextBgColor termui.Attribute TextBuilder termui.TextBuilder sync.RWMutex // contains filtered or unexported fields }
TextInput is a widget to capture user input
func NewTextInput ¶
NewTextInput creates a new TextInput showing the text provided
type Widget ¶
type Widget interface { Buffer() gizaktermui.Buffer Mount() error Name() string Unmount() error }
Widget defines how a UI widget responds to its lifecycle events:
- Buffer returns the content of the widget as termui.Buffer, it will be invoked every time the widget is render.
- Mount will be invoked before the Buffer method, it can be used to prepare the widget for rendering.
- Unmount will be invoked to signal that the widget is not going to be used anymore, it can be used for cleaning up.
Widget are identified by its name.