ui

package
v0.0.0-...-a7699be Latest Latest
Warning

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

Go to latest
Published: Nov 20, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	FieldInput field = iota
	FieldPassword
)

Variables

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 DrawModal

func DrawModal(ctx context.Context, title string, background, modal tview.Primitive)

DrawModal run GUI modal view with tview.Primitive as a modal background.

func DrawView

func DrawView(ctx context.Context, title string, p tview.Primitive)

DrawView run new GUI view with income tview.Primitive as main object. Execute on cli commands, extend mainFrame GUI layout.

func StartView

func StartView(ctx context.Context, title string, p tview.Primitive) error

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

type ContentModalData struct {
	Action map[string]func()
	Text   string
}

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.

Jump to

Keyboard shortcuts

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