primitive

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ActionModal

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

ActionModal is a centered message window used to inform the user or prompt them for an immediate decision. It needs to have at least one button (added via AddButtons()) or it will never disappear.

This primitive is based on tview.Modal.

func NewActionModal

func NewActionModal() *ActionModal

NewActionModal returns a new modal message window.

func (*ActionModal) AddButtons

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

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 (*ActionModal) ClearButtons

func (m *ActionModal) ClearButtons() *ActionModal

ClearButtons removes all buttons from the window.

func (*ActionModal) Draw

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

Draw draws this primitive onto the screen.

func (*ActionModal) Focus

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

Focus is called when this primitive receives focus.

func (*ActionModal) GetFooter

func (m *ActionModal) GetFooter() *tview.TextView

GetFooter returns the footer of the modal.

func (*ActionModal) HasFocus

func (m *ActionModal) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*ActionModal) InputHandler

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

InputHandler returns the handler for this primitive.

func (*ActionModal) MouseHandler

func (m *ActionModal) 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 (*ActionModal) SetBackgroundColor

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

SetBackgroundColor sets the color of the modal frame background.

func (*ActionModal) SetButtonBackgroundColor

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

SetButtonBackgroundColor sets the background color of the buttons.

func (*ActionModal) SetButtonTextColor

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

SetButtonTextColor sets the color of the button texts.

func (*ActionModal) SetDoneFunc

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

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 emptry string.

func (*ActionModal) SetFocus

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

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

func (*ActionModal) SetText

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

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

func (*ActionModal) SetTextColor

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

SetTextColor sets the color of the message text.

type InfoModal

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

InfoModal is a centered message window used to inform the user or prompt them for an immediate decision. It needs to have at least one button (added via AddButtons()) or it will never disappear.

This primitive is based on tview.Modal.

func NewInfoModal

func NewInfoModal() *InfoModal

NewInfoModal returns a new modal message window.

func (*InfoModal) Draw

func (i *InfoModal) Draw(screen tcell.Screen)

Draw draws this primitive onto the screen.

func (*InfoModal) SetAlign

func (i *InfoModal) SetAlign(align int) *InfoModal

SetAlign sets the alignment of the text.

func (*InfoModal) SetInfo

func (i *InfoModal) SetInfo(info string) *InfoModal

SetInfo sets the body of the modal.

func (*InfoModal) SetTitle

func (i *InfoModal) SetTitle(title string) *InfoModal

SetTitle sets the title of the modal frame.

Jump to

Keyboard shortcuts

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