ui

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: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplyStyling

func ApplyStyling()

ApplyStyling changes the default styling of tview

Types

type List

type List struct {
	*tview.Box
	// contains filtered or unexported fields
}

List is a simple selectable List with callback function

func NewList

func NewList() *List

NewList build a List with default styles

func (*List) AddItem

func (l *List) AddItem(item ListItem) *List

AddItem appends a new ListItem to the list.

func (*List) ClearItems

func (l *List) ClearItems() *List

ClearItems removes all list items.

func (*List) Draw

func (l *List) Draw(screen tcell.Screen)

Draw implements tview.Primitive

func (*List) GetCurrentIdx

func (l *List) GetCurrentIdx() int

GetCurrentIdx returns the index of the current ListItem.

func (*List) GetCurrentItem

func (l *List) GetCurrentItem() ListItem

GetCurrentItem returns the current ListItem

func (*List) GetItemCount

func (l *List) GetItemCount() int

GetItemCount returns the items count.

func (*List) GetItems

func (l *List) GetItems() []ListItem

GetItems return the items.

func (*List) InputHandler

func (l *List) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))

InputHandler implements tview.Primitive

func (*List) SetChangedFn

func (l *List) SetChangedFn(fn func(index int, item ListItem)) *List

SetChangedFn sets the callback function after the position of the current item has changed.

func (*List) SetCurrentBackgroundColor

func (l *List) SetCurrentBackgroundColor(color tcell.Color) *List

SetCurrentBackgroundColor set the color of the currently highlighted item background.

func (*List) SetCurrentItem

func (l *List) SetCurrentItem(index int) *List

SetCurrentItem sets the current ListItem to a specific index.

func (*List) SetCurrentTextColor

func (l *List) SetCurrentTextColor(color tcell.Color) *List

SetCurrentTextColor sets the color of the currently highlighted item text.

func (*List) SetDoneFn

func (l *List) SetDoneFn(fn func()) *List

SetDoneFn sets the callback function if Escape is pressed

func (*List) SetItems

func (l *List) SetItems(items []ListItem, keepPosition bool) *List

SetItems replaced the items. You can choose to keep the current position, with fallback to 0 if no longer valid.

func (*List) SetOverflow

func (l *List) SetOverflow(overflow bool) *List

SetOverflow sets if the list should overflow after reaching the start/end.

func (*List) SetSelectedFn

func (l *List) SetSelectedFn(fn func(index int, item ListItem)) *List

SetSelectedFn sets the callback function after interaction (enter/space) with the current item.

func (*List) SetTextColor

func (l *List) SetTextColor(color tcell.Color) *List

SetTextColor sets the color of non-highlighted text.

func (*List) TriggerChanged

func (l *List) TriggerChanged() *List

TriggerChanged trigger the changedFn callback if set.

type ListItem

type ListItem interface {
	Label() string
}

ListItem represents the minimal item that a List can use.

func NewSimpleListItem

func NewSimpleListItem(label string) ListItem

NewSimpleListItem returns a new SimpleListItem

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

Popup is a simple helper for centering a primitive horizontally/vertically. It contains the actual primitive and delegates all related calls to it.

func NewPopup

func NewPopup(p tview.Primitive) *Popup

NewPopup creates a new horizontal-/vertical-centered Popup.

func (*Popup) Blur

func (p *Popup) Blur()

Blur implements tview.Primitive

func (*Popup) Draw

func (p *Popup) Draw(screen tcell.Screen)

Draw implements tview.Primitive

func (*Popup) Focus

func (p *Popup) Focus(delegate func(p tview.Primitive))

Focus implements tview.Primitive

func (*Popup) GetFocusable

func (p *Popup) GetFocusable() tview.Focusable

GetFocusable implements tview.Primitive

func (*Popup) GetRect

func (p *Popup) GetRect() (int, int, int, int)

GetRect implements tview.Primitive

func (*Popup) InputHandler

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

InputHandler implements tview.Primitive

func (*Popup) SetRect

func (p *Popup) SetRect(x, y, width, height int)

SetRect implements tview.Primitive

type SimpleListItem

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

SimpleListItem is a helper for easier ListItem use.

func (SimpleListItem) Label

func (i SimpleListItem) Label() string

Label implements the interface ListItem

Jump to

Keyboard shortcuts

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