components

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Menu struct {
	W, H  int
	X, Y  int
	Items []string
	Win   goncurses.Window

	Selected bool
	// contains filtered or unexported fields
}

Menu represents a vertical panel menu of cellular entries taking up an entire row from X to W

Menu handles focus, scrolling and the managing of elements at each render.

This component is not thread safe and should only be modified directly one a single thread

func (m *Menu) ChangeSelection(index int)

ChangeSelection changes the selection to the index specified. If index is out of range, no action is taken.

func (m *Menu) GetSelection() string

GetSelection returns the text of the currently selected menu element. If there are no items selected, GetSelection returns an empty string.

func (m *Menu) MoveSelection(offset int)

MoveSelection changes the selected item relative to the current position. If the new selection would be out of range, no action is taken.

func (m *Menu) Render()

Render immediately renders the menu to the specified fields X, Y, H and W.

Jump to

Keyboard shortcuts

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