menu

package
v0.7.7 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2022 License: MIT Imports: 2 Imported by: 12

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Item

type Item struct {
	Val   string
	Label string
}

func (Item) Text

func (m Item) Text() string

Use label as display text of item, if given

type Items

type Items []Item

func NewItems

func NewItems(items ...Item) (mitems Items)

func (Items) Len

func (m Items) Len() int

Sort methods for Items

func (Items) Less

func (m Items) Less(a, b int) bool

func (Items) Swap

func (m Items) Swap(a, b int)
type Menu struct {
	ui.Block
	SortItems   bool   // enable automatic sorting of menu items
	Selectable  bool   // whether menu is navigable
	SubText     string // optional text to display before items
	TextFgColor ui.Attribute
	TextBgColor ui.Attribute
	// contains filtered or unexported fields
}

func NewMenu

func NewMenu() *Menu
func (m *Menu) AddItems(items ...Item)

Append Item to Menu

func (m *Menu) Buffer() ui.Buffer
func (m *Menu) ClearItems()

ClearItems removes all current menu items

func (m *Menu) DelItem(s string) (success bool)

DelItem removes menu item by value or label

func (m *Menu) Down()
func (m *Menu) SelectedItem() Item
func (m *Menu) SelectedValue() string
func (m *Menu) SetCursor(s string) (success bool)

Move cursor to an position by Item value or label

func (m *Menu) SetToolTip(lines ...string)

SetToolTip sets an optional tooltip string to show at bottom of screen

func (m *Menu) Up()

type Padding

type Padding [2]int // x,y padding

type ToolTip added in v0.7.4

type ToolTip struct {
	ui.Block
	Lines       []string
	TextFgColor ui.Attribute
	TextBgColor ui.Attribute
	// contains filtered or unexported fields
}

func NewToolTip added in v0.7.4

func NewToolTip(lines ...string) *ToolTip

func (*ToolTip) Align added in v0.7.4

func (t *ToolTip) Align()

Set width and height based on screen size

func (*ToolTip) Buffer added in v0.7.4

func (t *ToolTip) Buffer() ui.Buffer

Jump to

Keyboard shortcuts

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