primitive

package
v1.5.1 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 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 added in v1.4.0

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 added in v1.4.0

func NewActionModal() *ActionModal

NewActionModal returns a new modal message window.

func (*ActionModal) AddButtons added in v1.4.0

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 added in v1.4.0

func (m *ActionModal) ClearButtons() *ActionModal

ClearButtons removes all buttons from the window.

func (*ActionModal) Draw added in v1.4.0

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

Draw draws this primitive onto the screen.

func (*ActionModal) Focus added in v1.4.0

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

Focus is called when this primitive receives focus.

func (*ActionModal) GetFooter added in v1.4.0

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

GetFooter returns the footer of the modal.

func (*ActionModal) HasFocus added in v1.4.0

func (m *ActionModal) HasFocus() bool

HasFocus returns whether or not this primitive has focus.

func (*ActionModal) InputHandler added in v1.4.0

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

InputHandler returns the handler for this primitive.

func (*ActionModal) MouseHandler added in v1.4.0

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 added in v1.4.0

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

SetBackgroundColor sets the color of the modal frame background.

func (*ActionModal) SetButtonBackgroundColor added in v1.4.0

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

SetButtonBackgroundColor sets the background color of the buttons.

func (*ActionModal) SetButtonTextColor added in v1.4.0

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

SetButtonTextColor sets the color of the button texts.

func (*ActionModal) SetDoneFunc added in v1.4.0

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 added in v1.4.0

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

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

func (*ActionModal) SetText added in v1.4.0

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 added in v1.4.0

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

SetTextColor sets the color of the message text.

type InfoModal added in v1.4.0

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 added in v1.4.0

func NewInfoModal() *InfoModal

NewInfoModal returns a new modal message window.

func (*InfoModal) Draw added in v1.4.0

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

Draw draws this primitive onto the screen.

func (*InfoModal) SetAlign added in v1.4.0

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

SetAlign sets the alignment of the text.

func (*InfoModal) SetInfo added in v1.4.0

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

SetInfo sets the body of the modal.

func (*InfoModal) SetTitle added in v1.4.0

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