tui

package
v0.0.0-...-fe43c73 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTui

func NewTui() *tui

Types

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

func NewModal

func NewModal() *Modal

func (*Modal) AddButtons

func (m *Modal) AddButtons(labels []string) *Modal

AddButtons adds buttons to the window. There must be at least one button and a "done" handler so the window can be closed again.

func (*Modal) AddInputFields

func (m *Modal) AddInputFields(labels []string) *Modal

func (*Modal) ClearButtons

func (m *Modal) ClearButtons() *Modal

ClearButtons removes all buttons from the window.

func (*Modal) Draw

func (m *Modal) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*Modal) Focus

func (m *Modal) Focus(delegate func(p tview.Primitive))

Focus is called when this primitive receives focus.

func (*Modal) HasFocus

func (m *Modal) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*Modal) InputHandler

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

InputHandler returns the handler for this primitive.

func (*Modal) MouseHandler

func (m *Modal) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)

MouseHandler returns the mouse handler for this primitive.

func (*Modal) SetBackgroundColor

func (m *Modal) SetBackgroundColor(color tcell.Color) *Modal

SetBackgroundColor sets the color of the modal frame background.

func (*Modal) SetButtonActivatedStyle

func (m *Modal) SetButtonActivatedStyle(style tcell.Style) *Modal

SetButtonActivatedStyle sets the style of the buttons when they are focused.

func (*Modal) SetButtonBackgroundColor

func (m *Modal) SetButtonBackgroundColor(color tcell.Color) *Modal

SetButtonBackgroundColor sets the background color of the buttons.

func (*Modal) SetButtonStyle

func (m *Modal) SetButtonStyle(style tcell.Style) *Modal

SetButtonStyle sets the style of the buttons when they are not focused.

func (*Modal) SetButtonTextColor

func (m *Modal) SetButtonTextColor(color tcell.Color) *Modal

SetButtonTextColor sets the color of the button texts.

func (*Modal) SetChangedFunc

func (m *Modal) SetChangedFunc(handler func(inputIndex int, inputValue string)) *Modal

func (*Modal) SetDoneFunc

func (m *Modal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *Modal

SetDoneFunc sets a handler which is called when one of the buttons was pressed. It receives the index of the button as well as its label text. The handler is also called when the user presses the Escape key. The index will then be negative and the label text an empty string.

func (*Modal) SetFocus

func (m *Modal) SetFocus(index int) *Modal

SetFocus shifts the focus to the button with the given index.

func (*Modal) SetText

func (m *Modal) SetText(text string) *Modal

SetText sets the message text of the window. The text may contain line breaks but style tag states will not transfer to following lines. Note that words are wrapped, too, based on the final size of the window.

func (*Modal) SetTextColor

func (m *Modal) SetTextColor(color tcell.Color) *Modal

SetTextColor sets the color of the message text.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳