components

package
v1.3.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2023 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Box

type Box interface {
	SetBackgroundColor(tcell.Color) *tview.Box
}

Box interface that has just SetBackgroundColor.

type Form

type Form struct {
	*tview.Flex
	// contains filtered or unexported fields
}

Form is a more flexible form component for tview lib.

func NewForm

func NewForm(app *tview.Application) *Form

NewForm creates a new form.

func (*Form) AddFormItem

func (f *Form) AddFormItem(item tview.Primitive)

AddFormItem adds a new item to the form.

func (*Form) AddFormItems

func (f *Form) AddFormItems(items []*Item) error

AddFormItems constructs form from data represented as a list of Item objects.

func (*Form) AddMenuButton

func (f *Form) AddMenuButton(label string, alignRight bool) *tview.Button

AddMenuButton adds a button to the menu at the bottom of the form.

func (*Form) Focus

func (f *Form) Focus(delegate func(tview.Primitive))

Focus overrides default focus behavior.

type FormLabel

type FormLabel struct {
	*tview.TextView
}

FormLabel text paragraph that can be used in form.

func NewFormLabel

func NewFormLabel(label string) *FormLabel

NewFormLabel creates a new FormLabel.

func (*FormLabel) GetFieldHeight

func (b *FormLabel) GetFieldHeight() int

GetFieldHeight implements tview.FormItem.

func (*FormLabel) GetFieldWidth

func (b *FormLabel) GetFieldWidth() int

GetFieldWidth implements tview.FormItem.

func (*FormLabel) GetLabel

func (b *FormLabel) GetLabel() string

GetLabel implements tview.FormItem.

func (*FormLabel) SetFinishedFunc

func (b *FormLabel) SetFinishedFunc(handler func(key tcell.Key)) tview.FormItem

SetFinishedFunc implements tview.FormItem.

func (*FormLabel) SetFormAttributes

func (b *FormLabel) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldTextColor, fieldBgColor tcell.Color) tview.FormItem

SetFormAttributes sets form attributes.

type FormModalButton

type FormModalButton struct {
	*tview.Flex
	// contains filtered or unexported fields
}

FormModalButton the button that opens modal dialog with extended settings.

func NewFormModalButton

func NewFormModalButton(formLabel, buttonLabel string) *FormModalButton

NewFormModalButton creates a new FormModalButton.

func (*FormModalButton) Blur

func (b *FormModalButton) Blur()

Blur override default blur behavior.

func (*FormModalButton) Focus

func (b *FormModalButton) Focus(delegate func(tview.Primitive))

Focus override default focus behavior.

func (*FormModalButton) GetFieldHeight

func (b *FormModalButton) GetFieldHeight() int

GetFieldHeight implements tview.FormItem.

func (*FormModalButton) GetFieldWidth

func (b *FormModalButton) GetFieldWidth() int

GetFieldWidth implements tview.FormItem.

func (*FormModalButton) GetLabel

func (b *FormModalButton) GetLabel() string

GetLabel implements tview.FormItem.

func (*FormModalButton) SetFinishedFunc

func (b *FormModalButton) SetFinishedFunc(handler func(key tcell.Key)) tview.FormItem

SetFinishedFunc implements tview.FormItem.

func (*FormModalButton) SetFormAttributes

func (b *FormModalButton) SetFormAttributes(labelWidth int, labelColor, bgColor, fieldTextColor, fieldBgColor tcell.Color) tview.FormItem

SetFormAttributes sets form attributes.

func (*FormModalButton) SetSelectedFunc

func (b *FormModalButton) SetSelectedFunc(handler func()) *FormModalButton

SetSelectedFunc forwards that to underlying button component.

type Group

type Group struct {
	// contains filtered or unexported fields
}

Group is an attempt to straighten out built-in tview TAB focus sequence.

func NewGroup

func NewGroup(app *tview.Application) *Group

NewGroup creates new Group.

func (*Group) AddElement

func (eg *Group) AddElement(element tview.Primitive) tview.Primitive

AddElement to the group.

func (*Group) FocusFirst

func (eg *Group) FocusFirst()

FocusFirst sets focus to the first element.

func (*Group) NextFocus

func (eg *Group) NextFocus()

NextFocus switch focus to the next element.

func (*Group) PrevFocus

func (eg *Group) PrevFocus()

PrevFocus switch focus to the prev element.

type Item

type Item struct {
	Name string
	// contains filtered or unexported fields
}

Item represents a single form item.

func NewItem

func NewItem(name, description string, dest interface{}, options ...interface{}) *Item

NewItem creates new form item.

func NewSeparator

func NewSeparator(description string) *Item

NewSeparator creates new form special form item which can be used as a sections Separator.

type MenuButton struct {
	*tview.Button
	// contains filtered or unexported fields
}

MenuButton creates a new menu button.

func NewMenuButton

func NewMenuButton(label string) *MenuButton

NewMenuButton creates new menu button.

func (b *MenuButton) SetActive(active bool)

SetActive changes menu button active state.

func (b *MenuButton) SetActiveColors(colors ...tcell.Color)

SetActiveColors sets active state colors. 1st value is bg color. 2nd value is label color.

func (b *MenuButton) SetInactiveColors(colors ...tcell.Color)

SetInactiveColors sets inactive state colors. 1st value is bg color. 2nd value is label color.

type Multiline

type Multiline interface {
	GetHeight() int
}

Multiline interface represents elements that can occupy more than one line.

type Separator

type Separator struct {
	*tview.TextView
}

Separator hline with a description below.

func (*Separator) GetHeight

func (s *Separator) GetHeight() int

GetHeight implements Multiline interface.

type Spinner

type Spinner struct {
	*tview.Box
	// contains filtered or unexported fields
}

Spinner a unicode spinner primitive.

func NewSpinner

func NewSpinner(label string, spinner []string, app *tview.Application) *Spinner

NewSpinner creates a new spinner.

func (*Spinner) Draw

func (s *Spinner) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*Spinner) Stop

func (s *Spinner) Stop(success bool) <-chan struct{}

Stop should be always called to stop the spinner background routine.

type Table

type Table struct {
	*tview.Table
	// contains filtered or unexported fields
}

Table list of choices represented in table format.

func NewTable

func NewTable() *Table

NewTable creates new table.

func (*Table) AddRow

func (t *Table) AddRow(columns ...interface{})

AddRow adds a new row to the table.

func (*Table) GetHeight

func (t *Table) GetHeight() int

GetHeight implements Multiline interface.

func (*Table) GetValue

func (t *Table) GetValue(row, column int) interface{}

GetValue returns value in row/column.

func (*Table) HoverRow

func (t *Table) HoverRow(row int) bool

HoverRow highlights the row in the table.

func (*Table) SelectRow

func (t *Table) SelectRow(row int) bool

SelectRow selects the row in the table.

func (*Table) SetHeader

func (t *Table) SetHeader(keys ...interface{})

SetHeader sets table header.

func (*Table) SetRowSelectedFunc

func (t *Table) SetRowSelectedFunc(callback func(row int))

SetRowSelectedFunc called when selected row is updated.

type TableHeaders

type TableHeaders []interface{}

TableHeaders represents table headers list for item options which are using table representation.

func NewTableHeaders

func NewTableHeaders(headers ...interface{}) TableHeaders

NewTableHeaders creates TableHeaders object.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL