Documentation ¶
Index ¶
- func BuildStars(data []Bar, maxStars int, starChar string) string
- type Bar
- type BarGraph
- type Base
- func (base *Base) BorderColor() string
- func (base *Base) Bordered() bool
- func (base *Base) CommonSettings() *cfg.Common
- func (base *Base) ConfigText() string
- func (base *Base) ContextualTitle(defaultStr string) string
- func (base *Base) Disable()
- func (base *Base) Disabled() bool
- func (base *Base) Enabled() bool
- func (base *Base) FocusChar() string
- func (base *Base) Focusable() bool
- func (base *Base) HelpText() string
- func (base *Base) Name() string
- func (base *Base) QuitChan() chan bool
- func (base *Base) RefreshInterval() int
- func (base *Base) Refreshing() bool
- func (base *Base) SetFocusChar(char string)
- func (base *Base) Stop()
- func (base *Base) String() string
- type KeyboardWidget
- func (widget *KeyboardWidget) HelpText() string
- func (widget *KeyboardWidget) InitializeCommonControls(refreshFunc func())
- func (widget *KeyboardWidget) InputCapture(event *tcell.EventKey) *tcell.EventKey
- func (widget *KeyboardWidget) SetKeyboardChar(char string, fn func(), helpText string)
- func (widget *KeyboardWidget) SetKeyboardKey(key tcell.Key, fn func(), helpText string)
- func (widget *KeyboardWidget) SetView(view *tview.TextView)
- func (widget *KeyboardWidget) ShowHelp()
- type MultiSourceWidget
- type ScrollableWidget
- func (widget *ScrollableWidget) GetSelected() int
- func (widget *ScrollableWidget) Next()
- func (widget *ScrollableWidget) Prev()
- func (widget *ScrollableWidget) Redraw(data func() (string, string, bool))
- func (widget *ScrollableWidget) RowColor(idx int) string
- func (widget *ScrollableWidget) SetItemCount(items int)
- func (widget *ScrollableWidget) SetRenderFunction(displayFunc func())
- func (widget *ScrollableWidget) Unselect()
- type TextWidget
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type BarGraph ¶
BarGraph defines the data required to make a bar graph
func NewBarGraph ¶
NewBarGraph creates and returns an instance of BarGraph
type Base ¶
type Base struct {
// contains filtered or unexported fields
}
func (*Base) BorderColor ¶
func (*Base) CommonSettings ¶
func (*Base) ConfigText ¶
func (*Base) ContextualTitle ¶
func (*Base) RefreshInterval ¶
RefreshInterval returns how often, in seconds, the base will return its data
func (*Base) Refreshing ¶
Refreshing returns TRUE if the base is currently refreshing its data, FALSE if it is not
func (*Base) SetFocusChar ¶
type KeyboardWidget ¶
type KeyboardWidget struct {
// contains filtered or unexported fields
}
KeyboardWidget manages keyboard control for a widget
func NewKeyboardWidget ¶
func NewKeyboardWidget(app *tview.Application, pages *tview.Pages, settings *cfg.Common) KeyboardWidget
NewKeyboardWidget creates and returns a new instance of KeyboardWidget
func (*KeyboardWidget) HelpText ¶
func (widget *KeyboardWidget) HelpText() string
HelpText returns the help text and keyboard command info for this widget
func (*KeyboardWidget) InitializeCommonControls ¶ added in v0.21.0
func (widget *KeyboardWidget) InitializeCommonControls(refreshFunc func())
InitializeCommonControls sets up the keyboard controls that are common to all widgets that accept keyboard input
func (*KeyboardWidget) InputCapture ¶
func (widget *KeyboardWidget) InputCapture(event *tcell.EventKey) *tcell.EventKey
InputCapture is the function passed to tview's SetInputCapture() function This is done during the main widget's creation process using the following code:
widget.View.SetInputCapture(widget.InputCapture)
func (*KeyboardWidget) SetKeyboardChar ¶
func (widget *KeyboardWidget) SetKeyboardChar(char string, fn func(), helpText string)
SetKeyboardChar sets a character/function combination that responds to key presses Example:
widget.SetKeyboardChar("d", widget.deleteSelectedItem)
func (*KeyboardWidget) SetKeyboardKey ¶
func (widget *KeyboardWidget) SetKeyboardKey(key tcell.Key, fn func(), helpText string)
SetKeyboardKey sets a tcell.Key/function combination that responds to key presses Example:
widget.SetKeyboardKey(tcell.KeyCtrlD, widget.deleteSelectedItem)
func (*KeyboardWidget) SetView ¶
func (widget *KeyboardWidget) SetView(view *tview.TextView)
func (*KeyboardWidget) ShowHelp ¶
func (widget *KeyboardWidget) ShowHelp()
type MultiSourceWidget ¶
type MultiSourceWidget struct { DisplayFunction func() Idx int Sources []string // contains filtered or unexported fields }
MultiSourceWidget is a widget that supports displaying data from multiple sources
func NewMultiSourceWidget ¶
func NewMultiSourceWidget(moduleConfig *cfg.Common, singular, plural string) MultiSourceWidget
NewMultiSourceWidget creates and returns an instance of MultiSourceWidget
func (*MultiSourceWidget) CurrentSource ¶
func (widget *MultiSourceWidget) CurrentSource() string
CurrentSource returns the string representations of the currently-displayed source
func (*MultiSourceWidget) NextSource ¶
func (widget *MultiSourceWidget) NextSource()
NextSource displays the next source in the source list. If the current source is the last source it wraps around to the first source
func (*MultiSourceWidget) PrevSource ¶
func (widget *MultiSourceWidget) PrevSource()
PrevSource displays the previous source in the source list. If the current source is the first source, it wraps around to the last source
func (*MultiSourceWidget) SetDisplayFunction ¶
func (widget *MultiSourceWidget) SetDisplayFunction(displayFunc func())
SetDisplayFunction stores the function that should be called when the source is changed. This is typically called from within the initializer for the struct that embeds MultiSourceWidget
Example:
widget := Widget{ MultiSourceWidget: wtf.NewMultiSourceWidget(settings.common, "person", "people") } widget.SetDisplayFunction(widget.display)
type ScrollableWidget ¶
type ScrollableWidget struct { TextWidget Selected int RenderFunction func() // contains filtered or unexported fields }
func NewScrollableWidget ¶
func NewScrollableWidget(app *tview.Application, commonSettings *cfg.Common) ScrollableWidget
func (*ScrollableWidget) GetSelected ¶
func (widget *ScrollableWidget) GetSelected() int
func (*ScrollableWidget) Next ¶
func (widget *ScrollableWidget) Next()
func (*ScrollableWidget) Prev ¶
func (widget *ScrollableWidget) Prev()
func (*ScrollableWidget) Redraw ¶
func (widget *ScrollableWidget) Redraw(data func() (string, string, bool))
func (*ScrollableWidget) RowColor ¶
func (widget *ScrollableWidget) RowColor(idx int) string
func (*ScrollableWidget) SetItemCount ¶
func (widget *ScrollableWidget) SetItemCount(items int)
func (*ScrollableWidget) SetRenderFunction ¶
func (widget *ScrollableWidget) SetRenderFunction(displayFunc func())
func (*ScrollableWidget) Unselect ¶
func (widget *ScrollableWidget) Unselect()
type TextWidget ¶
TextWidget defines the data necessary to make a text widget
func NewTextWidget ¶
func NewTextWidget(app *tview.Application, commonSettings *cfg.Common) TextWidget
NewTextWidget creates and returns an instance of TextWidget
func (*TextWidget) TextView ¶
func (widget *TextWidget) TextView() *tview.TextView