widgets

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MainPage Key
	MainPage = "widgets.page.main"

	// FormatterPopupPage Key
	FormatterPopupPage = "widgets.page.formatter-popup"

	// HelpPopupPage Key
	HelpPopupPage = "widgets.page.help-popup"
)

Variables

This section is empty.

Functions

func NewFormatterPopup

func NewFormatterPopup(selectedFn func(fileType input.FileType)) tview.Primitive

NewFormatterPopup builds a new tview.Primitive for the formatter chooser

func NewHelpPopup

func NewHelpPopup() tview.Primitive

NewHelpPopup builds a tview.Primitive for displaying some help text

func NewMainPage

func NewMainPage(ratio int, nodeList *NodeList, output *Output, statusBar *StatusBar) (page tview.Primitive, topContentFlex *tview.Flex)

NewMainPage builds the promitive representing the app.

Types

type NodeList

type NodeList struct {
	*ui.List
	// contains filtered or unexported fields
}

NodeList represents a specialized list for nodes.

func NewNodeList

func NewNodeList(monochrome bool) *NodeList

NewNodeList builds a new empty NodeList.

func (*NodeList) GetCurrentNode

func (nl *NodeList) GetCurrentNode() nodes.Node

GetCurrentNode is a convience method for accessing the currently highlighted node.

func (*NodeList) SetChangedFn

func (nl *NodeList) SetChangedFn(fn func(nodes.Node)) *NodeList

SetChangedFn sets the handler callback on change events.

func (*NodeList) SetRoot

func (nl *NodeList) SetRoot(root nodes.Node) *NodeList

SetRoot make a node the root element and generates all NodeListItems.

type Output

type Output struct {
	// contains filtered or unexported fields
}

Output is a simple tview.TextView wrapper to simplify the exposed interface

func NewOutput

func NewOutput(monochrome bool) *Output

NewOutput creates new simple Output widget

func (*Output) Blur

func (o *Output) Blur()

Blur implements tview.Primitive

func (*Output) Draw

func (o *Output) Draw(screen tcell.Screen)

Draw implements tview.Primitive

func (*Output) Focus

func (o *Output) Focus(delegate func(p tview.Primitive))

Focus implements tview.Primitive

func (*Output) GetFocusable

func (o *Output) GetFocusable() tview.Focusable

GetFocusable implements tview.Primitive

func (*Output) GetRect

func (o *Output) GetRect() (int, int, int, int)

GetRect implements tview.Primitive

func (*Output) InputHandler

func (o *Output) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler implements tview.Primitive, restriction to single line navigation only

func (*Output) SetRect

func (o *Output) SetRect(x int, y int, width int, height int)

SetRect implements tview.Primitive

func (*Output) SetText

func (o *Output) SetText(text string) *Output

SetText sets the text and scrolls to the beginning

type StatusBar

type StatusBar struct {
	// contains filtered or unexported fields
}

StatusBar is a smal wrapper around tview.TextView representing a simple 1-lined status bar

func NewStatusBar

func NewStatusBar() *StatusBar

NewStatusBar creates a new StatusBar

func (*StatusBar) Blur

func (b *StatusBar) Blur()

Blur implements tview.Primitive

func (*StatusBar) Draw

func (b *StatusBar) Draw(screen tcell.Screen)

Draw implements tview.Primitive

func (*StatusBar) Focus

func (b *StatusBar) Focus(delegate func(p tview.Primitive))

Focus implements tview.Primitive

func (*StatusBar) GetFocusable

func (b *StatusBar) GetFocusable() tview.Focusable

GetFocusable implements tview.Primitive

func (*StatusBar) GetRect

func (b *StatusBar) GetRect() (int, int, int, int)

GetRect implements tview.Primitive

func (*StatusBar) InputHandler

func (b *StatusBar) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler implements tview.Primitive

func (*StatusBar) SetContent

func (b *StatusBar) SetContent(path string, fileType input.FileType) *StatusBar

SetContent updates the displayed content of the bar

func (*StatusBar) SetFileType

func (b *StatusBar) SetFileType(fileType input.FileType) *StatusBar

SetFileType only updates the filetype, path remains

func (*StatusBar) SetPath

func (b *StatusBar) SetPath(path string) *StatusBar

SetPath only updates the path, filetype remains

func (*StatusBar) SetRect

func (b *StatusBar) SetRect(x, y, width, height int)

SetRect implements tview.Primitive

Jump to

Keyboard shortcuts

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