Documentation
¶
Index ¶
- func SetCommonStyle(s Styler, style *config.Styles)
- type App
- func (a *App) FocusChanged(p tview.Primitive)
- func (a *App) GetConfig() *config.Config
- func (a *App) GetDao() *mongo.Dao
- func (a *App) GetKeys() *config.KeyBindings
- func (a *App) GetManager() *manager.ElementManager
- func (a *App) GetStyles() *config.Styles
- func (a *App) GiveBackFocus()
- func (a *App) SetDao(dao *mongo.Dao)
- func (a *App) SetFocus(p tview.Primitive)
- func (a *App) SetPreviousFocus()
- func (a *App) SetStyle(styleName string) error
- type BaseElement
- func (c *BaseElement) BroadcastEvent(event manager.EventMsg)
- func (c *BaseElement) Disable()
- func (c *BaseElement) Enable()
- func (c *BaseElement) HandleEvents(identifier tview.Identifier, handler func(event manager.EventMsg))
- func (c *BaseElement) Init(app *App) error
- func (c *BaseElement) IsEnabled() bool
- func (c *BaseElement) SendToElement(element tview.Identifier, event manager.EventMsg)
- func (c *BaseElement) SetAfterInitFunc(afterInitFunc func() error)
- func (c *BaseElement) Subscribe(identifier tview.Identifier)
- func (c *BaseElement) Toggle()
- func (c *BaseElement) UpdateDao(dao *mongo.Dao)
- type Flex
- type Form
- type FormModal
- type InputField
- type List
- type ListModal
- type Modal
- type Pages
- type Styler
- type Table
- func (t *Table) GetCellAboveThatMatch(row, col int, condition func(cell *tview.TableCell) bool) *tview.TableCell
- func (t *Table) GetCellBelowThatMatch(row, col int, condition func(cell *tview.TableCell) bool) *tview.TableCell
- func (t *Table) GetContentFromRows(rows []int) []string
- func (t *Table) ImproveScrolling()
- func (t *Table) MoveDownUntil(row, col int, condition func(cell *tview.TableCell) bool)
- func (t *Table) MoveUpUntil(row, col int, condition func(cell *tview.TableCell) bool)
- func (t *Table) SetStyle(style *config.Styles)
- type TextView
- type TreeView
- type ViewModal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SetCommonStyle ¶
SetCommonStyle applies common styling to any component implementing the Styler interface
Types ¶
type App ¶
type App struct { *tview.Application Pages *Pages // contains filtered or unexported fields }
App is a main application struct
func (*App) FocusChanged ¶
FocusChanged is a callback that is called when the focus is changed it is used to update the keys
func (*App) GetKeys ¶
func (a *App) GetKeys() *config.KeyBindings
func (*App) GetManager ¶
func (a *App) GetManager() *manager.ElementManager
func (*App) GiveBackFocus ¶
func (a *App) GiveBackFocus()
func (*App) SetPreviousFocus ¶
func (a *App) SetPreviousFocus()
type BaseElement ¶
type BaseElement struct { // App is a pointer to the main App. // It's used for accessing App focus, root page etc. App *App // dao is a pointer to the mongo dao. Dao *mongo.Dao // Listener is a channel that is used to receive events from the app. Listener chan manager.EventMsg // contains filtered or unexported fields }
BaseElement is a base struct for all visable elements. It contains all the basic fields and functions that are used by all visable elements.
func NewBaseElement ¶
func NewBaseElement() *BaseElement
NewBaseElement is a constructor for the BaseElement struct.
func (*BaseElement) BroadcastEvent ¶
func (c *BaseElement) BroadcastEvent(event manager.EventMsg)
Broadcast sends an event to all listeners.
func (*BaseElement) HandleEvents ¶
func (c *BaseElement) HandleEvents(identifier tview.Identifier, handler func(event manager.EventMsg))
HandleEvents handles events from the manager
func (*BaseElement) Init ¶
func (c *BaseElement) Init(app *App) error
Init is a function that is called when the view is initialized. If custom initialization is needed, this function should be overriden.
func (*BaseElement) IsEnabled ¶
func (c *BaseElement) IsEnabled() bool
IsEnabled returns the enabled flag.
func (*BaseElement) SendToElement ¶
func (c *BaseElement) SendToElement(element tview.Identifier, event manager.EventMsg)
SendToElement sends an event to the element.
func (*BaseElement) SetAfterInitFunc ¶
func (c *BaseElement) SetAfterInitFunc(afterInitFunc func() error)
SetAfterInitFunc sets the optional function that will be run at the end of the Init function.
func (*BaseElement) Subscribe ¶
func (c *BaseElement) Subscribe(identifier tview.Identifier)
Subscribe subscribes to the view events.
func (*BaseElement) UpdateDao ¶
func (c *BaseElement) UpdateDao(dao *mongo.Dao)
UpdateDao updates the dao in the element
type FormModal ¶ added in v0.1.10
type FormModal struct {
*primitives.FormModal
}
Define structs for each component type
func NewFormModal ¶ added in v0.1.10
func NewFormModal() *FormModal
type InputField ¶
type InputField struct {
*tview.InputField
}
Define structs for each component type
func NewInputField ¶
func NewInputField() *InputField
func (*InputField) SetStyle ¶
func (i *InputField) SetStyle(style *config.Styles)
type ListModal ¶
type ListModal struct {
*primitives.ListModal
}
Define structs for each component type
func NewListModal ¶
func NewListModal() *ListModal
type Pages ¶
func (*Pages) AddPage ¶
func (r *Pages) AddPage(view tview.Identifier, page tview.Primitive, resize, visable bool) *tview.Pages
AddPage is a wrapper for tview.Pages.AddPage
func (*Pages) HasPage ¶
func (r *Pages) HasPage(view tview.Identifier) bool
HasPage is a wrapper for tview.Pages.HasPage
func (*Pages) RemovePage ¶
func (r *Pages) RemovePage(view tview.Identifier) *tview.Pages
RemovePage is a wrapper for tview.Pages.RemovePage
type Styler ¶
type Styler interface { SetBackgroundColor(tcell.Color) *tview.Box SetBorderColor(tcell.Color) *tview.Box SetTitleColor(tcell.Color) *tview.Box SetFocusStyle(tcell.Style) *tview.Box }
Styler is an interface for components that can be styled
type Table ¶
func (*Table) GetCellAboveThatMatch ¶
func (t *Table) GetCellAboveThatMatch(row, col int, condition func(cell *tview.TableCell) bool) *tview.TableCell
GetCellAboveThatMatch returns the cell above the current selection that matches the given condition
func (*Table) GetCellBelowThatMatch ¶
func (t *Table) GetCellBelowThatMatch(row, col int, condition func(cell *tview.TableCell) bool) *tview.TableCell
GetCellBelowThatMatch returns the cell below the current selection that matches the given condition
func (*Table) GetContentFromRows ¶
GetContentFromRows returns the content of the table from the selected rows
func (*Table) ImproveScrolling ¶
func (t *Table) ImproveScrolling()
ImproveScrolling allows to scroll to the beginning and end of the table while moving up and down when reaching the end of selectable area but there are rows non selectable that we like to see TODO: Implement
func (*Table) MoveDownUntil ¶
MoveDownUntil moves the selection down until a condition is met
func (*Table) MoveUpUntil ¶
MoveUpUntil moves the selection up until a condition is met
type TextView ¶
Define structs for each component type
func NewTextView ¶
func NewTextView() *TextView
type TreeView ¶
Define structs for each component type
func NewTreeView ¶
func NewTreeView() *TreeView