menu

package
v0.0.0-...-69c762e Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DialogPadding dialog inner paddign.
	DialogPadding = 3

	// DialogFormHeight dialog "Enter"/"Cancel" form height.
	DialogHelpHeight = 1

	// DialogMinWidth dialog min width.
	DialogMinWidth = 40

	// TableHeightOffset table height offset for border.
	TableHeightOffset = 3
)

Variables

This section is empty.

Functions

func EmptyBoxSpace

func EmptyBoxSpace(bgColor tcell.Color) *tview.Box

Types

type Item

type Item struct {
	Index       int
	Key         string
	Name        string
	Description string
	Hidden      bool
	Selected    func(i *Item)
}
type Menu struct {
	*tview.Box
	// contains filtered or unexported fields
}

func New

func New(title string) *Menu
func (m *Menu) AddItem(item *Item)
func (m *Menu) Draw(screen tcell.Screen)
func (m *Menu) Focus(delegate func(p tview.Primitive))
func (m *Menu) GetItems() []*Item
func (m *Menu) HasFocus() bool

HasFocus returns whether or not this primitive has focus

func (m *Menu) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
func (m *Menu) SetItems(items []*Item)

type SortItems

type SortItems []*Item

func (SortItems) Len

func (l SortItems) Len() int

func (SortItems) Less

func (l SortItems) Less(i, j int) bool

func (SortItems) Swap

func (l SortItems) Swap(i, j int)
type SubMenu struct {
	*tview.Box
	// contains filtered or unexported fields
}

func NewSubMenu

func NewSubMenu(title string) *SubMenu
func (m *SubMenu) AddItem(item *Item)
func (m *SubMenu) Draw(screen tcell.Screen)
func (m *SubMenu) Focus(delegate func(p tview.Primitive))
func (m *SubMenu) HasFocus() bool

HasFocus returns whether or not this primitive has focus

func (m *SubMenu) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
func (m *SubMenu) SetCancelFunc(handler func()) *SubMenu
func (m *SubMenu) SetItems(items []*Item)
func (m *SubMenu) SetRect(x, y, width, height int)

Jump to

Keyboard shortcuts

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