Documentation
¶
Index ¶
- type FormModal
- func (m *FormModal) Draw(screen tcell.Screen)
- func (m *FormModal) Focus(delegate func(p tview.Primitive))
- func (m *FormModal) GetForm() *tview.Form
- func (m *FormModal) HasFocus() bool
- func (m *FormModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (m *FormModal) MouseHandler() ...
- func (m *FormModal) SetCancelFunc(handler func()) *FormModal
- func (m *FormModal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *FormModal
- type InputModal
- func (mi *InputModal) Draw(screen tcell.Screen)
- func (mi *InputModal) GetText() string
- func (mi *InputModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (mi *InputModal) SetBackgroundColor(color tcell.Color) *InputModal
- func (mi *InputModal) SetFieldBackgroundColor(color tcell.Color) *InputModal
- func (mi *InputModal) SetFieldTextColor(color tcell.Color) *InputModal
- func (mi *InputModal) SetInputLabel(label string) *InputModal
- func (mi *InputModal) SetLabel(label string) *InputModal
- func (mi *InputModal) SetLabelColor(color tcell.Color) *InputModal
- func (mi *InputModal) SetText(text string) *InputModal
- type ListModal
- func (lm *ListModal) AddItem(text string, secondaryText string, shortcut rune, selected func()) *ListModal
- func (lm *ListModal) Clear() *ListModal
- func (lm *ListModal) Draw(screen tcell.Screen)
- func (lm *ListModal) GetCurrentItem() int
- func (lm *ListModal) GetText() string
- func (lm *ListModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (lm *ListModal) RemoveItem(index int) *ListModal
- func (lm *ListModal) SetBorderPadding(top, right, bottom, left int) *ListModal
- func (lm *ListModal) SetMainTextStyle(style tcell.Style) *ListModal
- func (lm *ListModal) SetSecondaryTextStyle(style tcell.Style) *ListModal
- func (lm *ListModal) SetSelectedStyle(style tcell.Style) *ListModal
- func (lm *ListModal) ShowSecondaryText(show bool) *ListModal
- type Text
- type ViewModal
- func (m *ViewModal) AddButtons(labels []string) *ViewModal
- func (m *ViewModal) ClearButtons() *ViewModal
- func (m *ViewModal) CopySelectedLine(copyFunc func(text string) error, copyType string) error
- func (m *ViewModal) Draw(screen tcell.Screen)
- func (m *ViewModal) Focus(delegate func(p tview.Primitive))
- func (m *ViewModal) HasFocus() bool
- func (m *ViewModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (m *ViewModal) IsFullScreen() bool
- func (m *ViewModal) MouseHandler() ...
- func (m *ViewModal) MoveDown()
- func (m *ViewModal) MoveToBottom()
- func (m *ViewModal) MoveToTop()
- func (m *ViewModal) MoveUp()
- func (m *ViewModal) SetBackgroundColor(color tcell.Color) *tview.Box
- func (m *ViewModal) SetBorderColor(color tcell.Color) *tview.Box
- func (m *ViewModal) SetButtonActivatedStyle(style tcell.Style) *ViewModal
- func (m *ViewModal) SetButtonBackgroundColor(color tcell.Color) *ViewModal
- func (m *ViewModal) SetButtonStyle(style tcell.Style) *ViewModal
- func (m *ViewModal) SetButtonTextColor(color tcell.Color) *ViewModal
- func (m *ViewModal) SetDocumentColors(keyColor, valueColor, bracketColor tcell.Color) *ViewModal
- func (m *ViewModal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *ViewModal
- func (m *ViewModal) SetFocus(index int) *ViewModal
- func (m *ViewModal) SetFocusStyle(style tcell.Style) *tview.Box
- func (m *ViewModal) SetFullScreen(fullScreen bool) *ViewModal
- func (m *ViewModal) SetHighlightColor(color tcell.Color) *ViewModal
- func (m *ViewModal) SetScrollable(scrollable bool) *ViewModal
- func (m *ViewModal) SetText(text Text) *ViewModal
- func (m *ViewModal) SetTextColor(color tcell.Color) *tview.Box
- func (m *ViewModal) SetTitleColor(color tcell.Color) *tview.Box
- func (m *ViewModal) TextAlignment(align int) *ViewModal
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FormModal ¶ added in v0.1.10
FormModal is a modal window that contains a form.
func NewFormModal ¶ added in v0.1.10
func NewFormModal() *FormModal
NewFormModal returns a new form modal.
func (*FormModal) Draw ¶ added in v0.1.10
func (m *FormModal) Draw(screen tcell.Screen)
Draw draws this primitive onto the screen.
func (*FormModal) HasFocus ¶ added in v0.1.10
HasFocus returns whether or not this primitive has focus.
func (*FormModal) InputHandler ¶ added in v0.1.10
InputHandler returns the handler for this primitive.
func (*FormModal) MouseHandler ¶ added in v0.1.10
func (m *FormModal) 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 (*FormModal) SetCancelFunc ¶ added in v0.1.10
SetCancelFunc sets a handler which is called when the user cancels the modal.
type InputModal ¶
InputModal is a simple input field primitive that is displayed as a modal
func (*InputModal) Draw ¶
func (mi *InputModal) Draw(screen tcell.Screen)
Draw draws this primitive onto the screen.
func (*InputModal) GetText ¶
func (mi *InputModal) GetText() string
func (*InputModal) InputHandler ¶
func (mi *InputModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
func (*InputModal) SetBackgroundColor ¶
func (mi *InputModal) SetBackgroundColor(color tcell.Color) *InputModal
func (*InputModal) SetFieldBackgroundColor ¶
func (mi *InputModal) SetFieldBackgroundColor(color tcell.Color) *InputModal
func (*InputModal) SetFieldTextColor ¶
func (mi *InputModal) SetFieldTextColor(color tcell.Color) *InputModal
func (*InputModal) SetInputLabel ¶
func (mi *InputModal) SetInputLabel(label string) *InputModal
func (*InputModal) SetLabel ¶
func (mi *InputModal) SetLabel(label string) *InputModal
func (*InputModal) SetLabelColor ¶
func (mi *InputModal) SetLabelColor(color tcell.Color) *InputModal
func (*InputModal) SetText ¶
func (mi *InputModal) SetText(text string) *InputModal
type ListModal ¶
ListModal is a simple list primitive that is displayed as a modal
func NewListModal ¶
func NewListModal() *ListModal
func (*ListModal) AddItem ¶
func (lm *ListModal) AddItem(text string, secondaryText string, shortcut rune, selected func()) *ListModal
AddItem adds item to the list
func (*ListModal) Draw ¶
func (lm *ListModal) Draw(screen tcell.Screen)
Draw draws this primitive onto the screen.
func (*ListModal) GetCurrentItem ¶
GetCurrentItem returns the index of the currently selected item
func (*ListModal) InputHandler ¶
InputHandler returns the handler for this primitive.
func (*ListModal) RemoveItem ¶
RemoveItem removes item from the list
func (*ListModal) SetBorderPadding ¶ added in v0.1.10
SetBorderPadding sets the border padding of the modal
func (*ListModal) SetMainTextStyle ¶
SetMainTextStyle sets the text style of main text.
func (*ListModal) SetSecondaryTextStyle ¶
SetSecondaryTextStyle sets the text style of secondary text.
func (*ListModal) SetSelectedStyle ¶
SetSelectedTextColor sets the color of the selected item's text.
func (*ListModal) ShowSecondaryText ¶
ShowSecondaryText sets whether or not secondary text is shown
type ViewModal ¶
ViewModal 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 ViewModal.AddButtons) or it will never disappear.
func (*ViewModal) AddButtons ¶
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 (*ViewModal) ClearButtons ¶
ClearButtons removes all buttons from the window.
func (*ViewModal) CopySelectedLine ¶
CopySelectedLine copies the selected line to the clipboard. copyType can be "full" or "value". "full" will copy the entire highlighted lines, while "value" will copy only the value of the highlighted line.
func (*ViewModal) InputHandler ¶
InputHandler returns the handler for this primitive.
func (*ViewModal) IsFullScreen ¶ added in v0.1.8
IsFullScreen returns true if the modal is in full-screen mode
func (*ViewModal) MouseHandler ¶
func (m *ViewModal) 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 (*ViewModal) MoveToBottom ¶
func (m *ViewModal) MoveToBottom()
func (*ViewModal) SetBackgroundColor ¶
SetBackgroundColor sets the color of the modal frame background.
func (*ViewModal) SetBorderColor ¶
SetBorderColor sets the color of the modal frame border.
func (*ViewModal) SetButtonActivatedStyle ¶
SetButtonActivatedStyle sets the style of the buttons when they are focused.
func (*ViewModal) SetButtonBackgroundColor ¶
SetButtonBackgroundColor sets the background color of the buttons.
func (*ViewModal) SetButtonStyle ¶
SetButtonStyle sets the style of the buttons when they are not focused.
func (*ViewModal) SetButtonTextColor ¶
SetButtonTextColor sets the color of the button texts.
func (*ViewModal) SetDocumentColors ¶
SetDocumentColors sets the colors for document elements.
func (*ViewModal) SetDoneFunc ¶
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 (*ViewModal) SetFocusStyle ¶
SetFocusStyle sets the style of the modal when it is focused.
func (*ViewModal) SetFullScreen ¶ added in v0.1.8
SetFullScreen toggles between full-screen and modal view
func (*ViewModal) SetHighlightColor ¶
SetHighlightColor sets the color of the highlighted text.
func (*ViewModal) SetScrollable ¶
func (*ViewModal) SetText ¶
TextAlignment sets the text alignment within the modal. This must be one of
func (*ViewModal) SetTextColor ¶
SetTextColor sets the color of the message text.
func (*ViewModal) SetTitleColor ¶
SetTitleColor sets the color of the modal frame title.