Documentation
¶
Index ¶
- func AddTableData(table *tview.Table, headers []string, data [][]string, alignment []int, ...)
- func CreateConfirmBox(content string, yes, no func())
- func CreateMessageBox(content string)
- func CreateModalPage(content tview.Primitive, background tview.Primitive, width, height int, ...) *tview.Pages
- func PrependRowNumColumn(data [][]string) [][]string
- func RemoveFrontPage(pages *tview.Pages)
- type Application
- type ContentPage
- type Header
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTableData ¶
func AddTableData(table *tview.Table, headers []string, data [][]string, alignment []int, expansions []int, color tcell.Color, selectable bool)
AddTableData adds data to the table. Lets you set the headers, texts, alignment, color, and if cells are selectable. Selectable is not per cell, but a global value for the whole table. Header row is not selectable
func CreateConfirmBox ¶
func CreateConfirmBox(content string, yes, no func())
CreateConfirmBox creates a modal message box using tview's native modal element. Two buttons are added (yes and no) for which the yes and no callback functions will be called when pressed.
func CreateMessageBox ¶
func CreateMessageBox(content string)
CreateMessageBox creates a modal message box using tview's native modal element. Only one button is added (close) and no callback is possible. The modal is added to the provided pages view and removed when the button is pressed
func CreateModalPage ¶
func CreateModalPage(content tview.Primitive, background tview.Primitive, width, height int, name string) *tview.Pages
CreateModalPage creates a modal window by creating a pages view and add a flex view with the specified width and height. The page is named the same as the name parameter and if the background primitive is set, it is added as a background to the modal
func PrependRowNumColumn ¶
PrependRowNumColumn prepends every slice in data with a row-number value
func RemoveFrontPage ¶
Types ¶
type Application ¶
type Application struct { TviewApp *tview.Application Layout *tview.Flex Content *tview.Pages ContentMap map[string]ContentPage HeaderBar *Header AccountData *data.AccountData }
var App *Application
func NewApplication ¶
func NewApplication(accountData *data.AccountData) *Application
func (*Application) BuildApplicationUI ¶
func (a *Application) BuildApplicationUI()
Build the UI elements and configures the application
func (*Application) RegisterContent ¶
func (a *Application) RegisterContent(page ContentPage)
func (*Application) RemoveContent ¶
func (a *Application) RemoveContent(page ContentPage)
func (*Application) Run ¶
func (a *Application) Run() error
func (*Application) ShowPage ¶
func (a *Application) ShowPage(selectedPage ContentPage)
type ContentPage ¶
type ContentPage interface { Render(accountData *data.AccountData) Name() string View() tview.Primitive ContextView() tview.Primitive Close() SetFocus(app *tview.Application) IsPersistent() bool }