termui

package
v0.0.0-...-d16cf1c Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: AGPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ELLIPSIS = "…"
	CURSOR   = " "
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Block

	Style Style

	Label          string
	Value          string
	ShowWhenEmpty  bool
	UpdateCallback func(string)
	// contains filtered or unexported fields
}

func (*Entry) Draw

func (self *Entry) Draw(buf *Buffer)

func (*Entry) HandleEvent

func (self *Entry) HandleEvent(e Event) bool

HandleEvent handles input events if the entry is being edited. Returns true if the event was handled.

func (*Entry) SetEditing

func (self *Entry) SetEditing(editing bool)

type LineGraph

type LineGraph struct {
	*Block

	Data   map[string][]float64
	Labels map[string]string

	HorizontalScale int

	LineColors       map[string]Color
	DefaultLineColor Color
}

LineGraph implements a line graph of data points.

func NewLineGraph

func NewLineGraph() *LineGraph

func (*LineGraph) Draw

func (self *LineGraph) Draw(buf *Buffer)

type Sparkline

type Sparkline struct {
	Data       []int
	Title1     string
	Title2     string
	TitleColor Color
	LineColor  Color
}

Sparkline is like: ▅▆▂▂▅▇▂▂▃▆▆▆▅▃. The data points should be non-negative integers.

func NewSparkline

func NewSparkline() *Sparkline

NewSparkline returns an unrenderable single sparkline that intended to be added into a SparklineGroup.

type SparklineGroup

type SparklineGroup struct {
	*Block
	Lines []*Sparkline
}

SparklineGroup is a renderable widget which groups together the given sparklines.

func NewSparklineGroup

func NewSparklineGroup(ss ...*Sparkline) *SparklineGroup

NewSparklineGroup return a new *SparklineGroup with given Sparklines, you can always add a new Sparkline later.

func (*SparklineGroup) Add

func (self *SparklineGroup) Add(sl Sparkline)

Add appends a given Sparkline to the *SparklineGroup.

func (*SparklineGroup) Draw

func (self *SparklineGroup) Draw(buf *Buffer)

type Table

type Table struct {
	*Block

	Header []string
	Rows   [][]string

	ColWidths []int
	ColGap    int
	PadLeft   int

	ShowCursor  bool
	CursorColor Color

	ShowLocation bool

	UniqueCol    int    // the column used to uniquely identify each table row
	SelectedItem string // used to keep the cursor on the correct item if the data changes
	SelectedRow  int
	TopRow       int // used to indicate where in the table we are scrolled at

	ColResizer func()
}

func NewTable

func NewTable() *Table

NewTable returns a new Table instance

func (*Table) Draw

func (self *Table) Draw(buf *Buffer)

func (*Table) HandleClick

func (self *Table) HandleClick(x, y int)

func (*Table) ScrollBottom

func (self *Table) ScrollBottom()

func (*Table) ScrollDown

func (self *Table) ScrollDown()

func (*Table) ScrollHalfPageDown

func (self *Table) ScrollHalfPageDown()

func (*Table) ScrollHalfPageUp

func (self *Table) ScrollHalfPageUp()

func (*Table) ScrollPageDown

func (self *Table) ScrollPageDown()

func (*Table) ScrollPageUp

func (self *Table) ScrollPageUp()

func (*Table) ScrollTop

func (self *Table) ScrollTop()

func (*Table) ScrollUp

func (self *Table) ScrollUp()

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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