Documentation
¶
Index ¶
- Constants
- Variables
- func ContentForm(data ContentFormData) *tview.Form
- func ContentModal(data ContentModalData) *tview.Modal
- func ContentTable(data ContentTableData) *tview.Table
- func DrawModal(ctx context.Context, title string, background, modal tview.Primitive)
- func DrawView(ctx context.Context, title string, p tview.Primitive)
- func StartView(ctx context.Context, title string, p tview.Primitive) error
- func UpdateFormButtons(form *tview.Form, buttons []ContentFormButton) *tview.Form
- func UpdateTable(table *tview.Table, data []ContentTableRow)
- type ContentFormButton
- type ContentFormData
- type ContentFormField
- type ContentModalData
- type ContentTableData
- type ContentTableRow
- type HotKeys
Constants ¶
const ( FieldInput field = iota FieldPassword )
Variables ¶
var App = tview.NewApplication()
App is a main application view object.
Functions ¶
func ContentForm ¶
func ContentForm(data ContentFormData) *tview.Form
ContentForm create and return a new tview.Form widget with the provided data.
func ContentModal ¶
func ContentModal(data ContentModalData) *tview.Modal
ContentModal create and return a new tview.Modal widget with the provided data.
func ContentTable ¶
func ContentTable(data ContentTableData) *tview.Table
ContentTable create and return a new tview.Table widget with the provided data.
func DrawView ¶
DrawView run new GUI view with income tview.Primitive as main object. Execute on cli commands, extend mainFrame GUI layout.
func StartView ¶
StartView run console GUI. Execute only in main process, extend mainFrame GUI layout.
func UpdateFormButtons ¶
func UpdateFormButtons(form *tview.Form, buttons []ContentFormButton) *tview.Form
UpdateFormButtons add cations to the form.
func UpdateTable ¶
func UpdateTable(table *tview.Table, data []ContentTableRow)
UpdateTable updates the given tview.Table with new data.
Types ¶
type ContentFormButton ¶
type ContentFormButton struct {
// Action func for button.
Action func()
// Label of the button.
Label string
}
ContentFormButton describe button in form.
type ContentFormData ¶
type ContentFormData struct {
Fields []ContentFormField
}
ContentFormData describe form.
type ContentFormField ¶
type ContentFormField struct {
// Label of the field.
Label string
// Value of the field.
Value string
// Type of the field.
Type field
}
ContentFormField describe field in form.
type ContentModalData ¶
ContentModalData structures the data necessary to build a content modal.
type ContentTableData ¶
type ContentTableData struct {
// Headers are the titles for each column.
Headers []string
// Data is a slice of ContentTableRow, representing each row in the table.
Data []ContentTableRow
}
ContentTableData structures the data necessary to build a content table.
type ContentTableRow ¶
type ContentTableRow struct {
// Action is the function to be executed when this row is selected.
Action func()
// Data holds the textual content for each column in this row.
Data []string
}
ContentTableRow represents a single row in a content table.
type HotKeys ¶
type HotKeys struct {
// Action is a function to be executed when the hot key is activated.
Action func(ctx context.Context)
// Description is the text describing the hot key's purpose in the GUI.
Description string
// Key is the key code in the format of tcell.Key.
Key tcell.Key
}
HotKeys is a structure for storing hot key data used in a GUI helper and hot key listener. Expects the HotKeys structure to be present in the provided context.