Documentation
¶
Index ¶
- Variables
- func DefaultStyleButton(button *tview.Button)
- type FlexList
- func (fl *FlexList) AddItem(item tview.Primitive, height int, proportion int, focus bool) *FlexList
- func (fl *FlexList) Clear()
- func (fl *FlexList) Draw(screen tcell.Screen)
- func (fl *FlexList) Focus(delegate func(p tview.Primitive))
- func (fl *FlexList) GetCurrentItem() int
- func (fl *FlexList) GetItemCount() int
- func (fl *FlexList) HasFocus() bool
- func (fl *FlexList) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (fl *FlexList) SetChangedFunc(handler func(index int)) *FlexList
- func (fl *FlexList) SetCurrentItem(index int)
- func (fl *FlexList) SetSelectionColor(color tcell.Color) *FlexList
- type FocusWrapper
- func (fw *FocusWrapper) Blur()
- func (fw *FocusWrapper) Draw(screen tcell.Screen)
- func (fw *FocusWrapper) Focus(delegate func(p tview.Primitive))
- func (fw *FocusWrapper) GetFocusablePrimitives() []tview.Primitive
- func (fw *FocusWrapper) GetRect() (int, int, int, int)
- func (fw *FocusWrapper) HasFocus() bool
- func (fw *FocusWrapper) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (fw *FocusWrapper) MouseHandler() ...
- func (fw *FocusWrapper) SetRect(x, y, width, height int)
- type HorizontalSeparator
- type OverviewWidget
- type RichModal
- func (m *RichModal) AddButtons(labels []string) *RichModal
- func (m *RichModal) ClearButtons() *RichModal
- func (m *RichModal) Draw(screen tcell.Screen)
- func (m *RichModal) Focus(delegate func(p tview.Primitive))
- func (m *RichModal) HasFocus() bool
- func (m *RichModal) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (m *RichModal) MouseHandler() ...
- func (m *RichModal) SetBackgroundColor(color tcell.Color) *RichModal
- func (m *RichModal) SetButtonActivatedStyle(style tcell.Style) *RichModal
- func (m *RichModal) SetButtonBackgroundColor(color tcell.Color) *RichModal
- func (m *RichModal) SetButtonStyle(style tcell.Style) *RichModal
- func (m *RichModal) SetButtonTextColor(color tcell.Color) *RichModal
- func (m *RichModal) SetCenteredText(text string) *RichModal
- func (m *RichModal) SetDetailsText(text string) *RichModal
- func (m *RichModal) SetDetailsTextColor(color tcell.Color) *RichModal
- func (m *RichModal) SetDoneFunc(handler func(buttonIndex int, buttonLabel string)) *RichModal
- func (m *RichModal) SetFocus(index int) *RichModal
- func (m *RichModal) SetMaxWidth(max int) *RichModal
- func (m *RichModal) SetMinWidth(min int) *RichModal
- func (m *RichModal) SetTextColor(color tcell.Color) *RichModal
- type SearchableList
- type SearchableTable
- func (st *SearchableTable) Blur()
- func (st *SearchableTable) Clear()
- func (st *SearchableTable) Filter(query string)
- func (st *SearchableTable) Focus(delegate func(p tview.Primitive))
- func (st *SearchableTable) GetCell(row, column int) *tview.TableCell
- func (st *SearchableTable) GetFocusablePrimitives() []tview.Primitive
- func (st *SearchableTable) GetRowCount() int
- func (st *SearchableTable) GetSelection() (row, column int)
- func (st *SearchableTable) Select(row, column int)
- func (st *SearchableTable) SetData(data [][]string)
- type TabBar
- type TabbedPanes
- func (t *TabbedPanes) AddTab(label string, content tview.Primitive)
- func (t *TabbedPanes) Focus(delegate func(p tview.Primitive))
- func (t *TabbedPanes) GetActiveContent() tview.Primitive
- func (t *TabbedPanes) GetActiveTab() int
- func (t *TabbedPanes) GetFocusablePrimitives() []tview.Primitive
- func (t *TabbedPanes) SelectNext()
- func (t *TabbedPanes) SelectPrevious()
- func (t *TabbedPanes) SetActiveTab(index int)
- func (t *TabbedPanes) SetOnTabChange(handler func(index int, label string))
- type TitleFrame
- func (f *TitleFrame) Draw(screen tcell.Screen)
- func (f *TitleFrame) Focus(delegate func(p tview.Primitive))
- func (f *TitleFrame) HasFocus() bool
- func (f *TitleFrame) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (f *TitleFrame) MouseHandler() ...
- func (f *TitleFrame) PasteHandler() func(pastedText string, setFocus func(p tview.Primitive))
- func (f *TitleFrame) SetTitle(title string)
- type VerticalSeparator
Constants ¶
This section is empty.
Variables ¶
var ( DefaultButtonStlye = tcell.StyleDefault.Foreground(tcell.ColorBlack).Background(tcell.ColorWhite) DefaultButtonActiveStyle = tcell.StyleDefault.Foreground(tcell.ColorBlack).Background(tcell.ColorBlue).Underline(true) DefaultButtonDisabledStyle = tcell.StyleDefault.Foreground(tcell.ColorLightGray).Background(tcell.ColorDarkGray) )
Functions ¶
func DefaultStyleButton ¶
Types ¶
type FlexList ¶
FlexList is a scrollable container for other primitives that behaves like a list, allowing selection and navigation of its child items.
func (*FlexList) AddItem ¶
AddItem adds a primitive to the list. Height is the fixed height of the item.
func (*FlexList) GetCurrentItem ¶
GetCurrentItem returns the index of the currently selected item.
func (*FlexList) GetItemCount ¶
GetItemCount returns the number of items in the list.
func (*FlexList) InputHandler ¶
InputHandler handles keyboard input for selection and scrolling.
func (*FlexList) SetChangedFunc ¶
SetChangedFunc sets a callback that is fired when the selection changes.
func (*FlexList) SetCurrentItem ¶
SetCurrentItem sets the currently selected item by its index.
type FocusWrapper ¶
FocusWrapper is a lightweight struct that wraps a tview.Primitive to make it conform to our Focusable interface, using a delegate function to determine its focusable children.
func NewFocusWrapper ¶
func NewFocusWrapper(p tview.Primitive, getFocusables func() []tview.Primitive) *FocusWrapper
NewFocusWrapper creates a new wrapper with a dynamic function to get focusable children.
func NewFocusWrapperWithStatic ¶
func NewFocusWrapperWithStatic(p tview.Primitive, focusables ...tview.Primitive) *FocusWrapper
NewFocusWrapperWithStatic is a convenience constructor that takes a static slice of primitives.
func (*FocusWrapper) Blur ¶
func (fw *FocusWrapper) Blur()
Blur is called when this primitive loses focus.
func (*FocusWrapper) Draw ¶
func (fw *FocusWrapper) Draw(screen tcell.Screen)
Draw delegates the drawing to the wrapped primitive.
func (*FocusWrapper) Focus ¶
func (fw *FocusWrapper) Focus(delegate func(p tview.Primitive))
Blur is called when this primitive loses focus.
func (*FocusWrapper) GetFocusablePrimitives ¶
func (fw *FocusWrapper) GetFocusablePrimitives() []tview.Primitive
GetFocusablePrimitives implements the Focusable interface by calling the delegate function.
func (*FocusWrapper) GetRect ¶
func (fw *FocusWrapper) GetRect() (int, int, int, int)
GetRect returns the rectangle of the wrapped primitive.
func (*FocusWrapper) HasFocus ¶
func (fw *FocusWrapper) HasFocus() bool
HasFocus returns whether or not this primitive has focus.
func (*FocusWrapper) InputHandler ¶
func (fw *FocusWrapper) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
InputHandler returns the handler for this primitive.
func (*FocusWrapper) MouseHandler ¶
func (fw *FocusWrapper) 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 (*FocusWrapper) SetRect ¶
func (fw *FocusWrapper) SetRect(x, y, width, height int)
SetRect sets the rectangle of the wrapped primitive.
type HorizontalSeparator ¶
HorizontalSeparator is a simple primitive that draws a horizontal line.
func NewHorizontalSeparator ¶
func NewHorizontalSeparator(color tcell.Color) *HorizontalSeparator
NewHorizontalSeparator creates a new separator with a given color.
func (*HorizontalSeparator) Draw ¶
func (s *HorizontalSeparator) Draw(screen tcell.Screen)
Draw draws the separator.
type OverviewWidget ¶
OverviewWidget is a single-row visual representation of mod sets.
func NewOverviewWidget ¶
func NewOverviewWidget(allMods []string) *OverviewWidget
NewOverviewWidget creates a new widget. allMods should be a sorted list.
func (*OverviewWidget) Draw ¶
func (w *OverviewWidget) Draw(screen tcell.Screen)
Draw implements tview.Primitive.
func (*OverviewWidget) SetAllMods ¶
func (w *OverviewWidget) SetAllMods(allMods []string)
SetAllMods sets or updates the universe of all mods for the widget.
func (*OverviewWidget) UpdateState ¶
func (w *OverviewWidget) UpdateState(problemMods, clearedMods, candidateMods, effectiveMods sets.Set)
UpdateState provides the widget with the current sets to display.
type RichModal ¶
RichModal is a centered message window that offers control over width and supports separately-aligned text sections using a Flex layout.
func NewRichModal ¶
func NewRichModal() *RichModal
NewRichModal returns a new RichModal message window.
func (*RichModal) AddButtons ¶
AddButtons adds buttons to the window.
func (*RichModal) ClearButtons ¶
ClearButtons removes all buttons from the window.
func (*RichModal) InputHandler ¶
InputHandler delegates input events to the flex layout.
func (*RichModal) MouseHandler ¶
func (m *RichModal) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)
MouseHandler delegates mouse events to the flex layout.
func (*RichModal) SetBackgroundColor ¶
SetBackgroundColor sets the background color of the modal and its contents.
func (*RichModal) SetButtonActivatedStyle ¶
SetButtonActivatedStyle sets the style of the buttons when they are focused.
func (*RichModal) SetButtonBackgroundColor ¶
SetButtonBackgroundColor sets the background color of the buttons.
func (*RichModal) SetButtonStyle ¶
SetButtonStyle sets the style of the buttons when they are not focused.
func (*RichModal) SetButtonTextColor ¶
SetButtonTextColor sets the color of the button texts.
func (*RichModal) SetCenteredText ¶
SetCenteredText sets the main, centered message text of the window.
func (*RichModal) SetDetailsText ¶
SetDetailsText sets the optional, left-aligned details text of the window.
func (*RichModal) SetDetailsTextColor ¶
SetDetailsTextColor sets the color of the left-aligned details text.
func (*RichModal) SetDoneFunc ¶
SetDoneFunc sets a handler which is called when one of the buttons was pressed.
func (*RichModal) SetMaxWidth ¶
SetMaxWidth sets the maximum width of the modal's content area.
func (*RichModal) SetMinWidth ¶
SetMinWidth sets the minimum width of the modal's content area.
type SearchableList ¶
SearchableList is a custom widget that combines an input field for searching with a list that displays filtered results. It implements Focusable.
func NewSearchableList ¶
func NewSearchableList() *SearchableList
NewSearchableList creates a new SearchableList.
func (*SearchableList) Blur ¶
func (s *SearchableList) Blur()
func (*SearchableList) Focus ¶
func (s *SearchableList) Focus(delegate func(p tview.Primitive))
Focus delegates focus to the search field by default.
func (*SearchableList) GetFocusablePrimitives ¶
func (s *SearchableList) GetFocusablePrimitives() []tview.Primitive
GetFocusablePrimitives implements the Focusable interface.
func (*SearchableList) SetItems ¶
func (s *SearchableList) SetItems(items []string)
SetItems clears the list and sets new items.
type SearchableTable ¶
type SearchableTable struct {
*tview.Flex
Table *tview.Table
Search *tview.InputField
// contains filtered or unexported fields
}
SearchableTable combines a search input field with a tview.Table.
func NewSearchableTable ¶
func NewSearchableTable(headers []string, searchColumns ...int) *SearchableTable
NewSearchableTable creates a new SearchableTable.
func (*SearchableTable) Blur ¶
func (st *SearchableTable) Blur()
Blur is called when this primitive loses focus.
func (*SearchableTable) Clear ¶
func (st *SearchableTable) Clear()
Clear implements a custom Clear method that targets the inner table, preventing the Flex layout from being destroyed.
func (*SearchableTable) Filter ¶
func (st *SearchableTable) Filter(query string)
Filter re-populates the table based on the search query. Replace the Filter method to use pre-calculated widths
func (*SearchableTable) Focus ¶
func (st *SearchableTable) Focus(delegate func(p tview.Primitive))
Focus delegates focus to the search field by default.
func (*SearchableTable) GetCell ¶
func (st *SearchableTable) GetCell(row, column int) *tview.TableCell
GetCell returns the cell at the specified row and column.
func (*SearchableTable) GetFocusablePrimitives ¶
func (st *SearchableTable) GetFocusablePrimitives() []tview.Primitive
GetFocusablePrimitives implements the Focusable interface.
func (*SearchableTable) GetRowCount ¶
func (st *SearchableTable) GetRowCount() int
GetRowCount returns the number of rows in the table, including headers.
func (*SearchableTable) GetSelection ¶
func (st *SearchableTable) GetSelection() (row, column int)
GetSelection returns the currently selected row and column.
func (*SearchableTable) Select ¶
func (st *SearchableTable) Select(row, column int)
Select sets the currently selected cell by row and column.
func (*SearchableTable) SetData ¶
func (st *SearchableTable) SetData(data [][]string)
Replace the SetData method
type TabBar ¶
TabBar is a primitive that draws a bar of selectable tabs.
func (*TabBar) InputHandler ¶
InputHandler handles keyboard navigation for the tab bar.
func (*TabBar) MouseHandler ¶
func (tb *TabBar) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)
MouseHandler handles mouse clicks on the tab bar.
type TabbedPanes ¶
TabbedPanes is a custom widget that provides a tabbed view.
func NewTabbedPanes ¶
func NewTabbedPanes() *TabbedPanes
NewTabbedPanes creates a new TabbedPanes widget.
func (*TabbedPanes) AddTab ¶
func (t *TabbedPanes) AddTab(label string, content tview.Primitive)
AddTab adds a new tab with a given label and content primitive.
func (*TabbedPanes) Focus ¶
func (t *TabbedPanes) Focus(delegate func(p tview.Primitive))
func (*TabbedPanes) GetActiveContent ¶
func (t *TabbedPanes) GetActiveContent() tview.Primitive
GetActiveContent returns the primitive of the currently active tab.
func (*TabbedPanes) GetActiveTab ¶
func (t *TabbedPanes) GetActiveTab() int
GetActiveTab returns the index of the currently active tab.
func (*TabbedPanes) GetFocusablePrimitives ¶
func (t *TabbedPanes) GetFocusablePrimitives() []tview.Primitive
GetFocusablePrimitives implements the Focusable interface.
func (*TabbedPanes) SelectNext ¶
func (t *TabbedPanes) SelectNext()
SelectNext selects the next tab in the sequence.
func (*TabbedPanes) SelectPrevious ¶
func (t *TabbedPanes) SelectPrevious()
SelectPrevious selects the previous tab in the sequence.
func (*TabbedPanes) SetActiveTab ¶
func (t *TabbedPanes) SetActiveTab(index int)
SetActiveTab sets the currently active tab by its index.
func (*TabbedPanes) SetOnTabChange ¶
func (t *TabbedPanes) SetOnTabChange(handler func(index int, label string))
SetOnTabChange sets a callback function to be executed when the active tab changes.
type TitleFrame ¶
TitleFrame is a primitive that wraps another primitive, adding a horizontal rule at the top with an optional title.
func NewTitleFrame ¶
func NewTitleFrame(content tview.Primitive, title string) *TitleFrame
NewTitleFrame creates a new TitleFrame.
func (*TitleFrame) Focus ¶
func (f *TitleFrame) Focus(delegate func(p tview.Primitive))
Focus is called when this primitive receives focus.
func (*TitleFrame) HasFocus ¶
func (f *TitleFrame) HasFocus() bool
HasFocus returns whether or not this primitive has focus.
func (*TitleFrame) InputHandler ¶
func (f *TitleFrame) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
InputHandler returns the handler for this primitive.
func (*TitleFrame) MouseHandler ¶
func (f *TitleFrame) 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 (*TitleFrame) PasteHandler ¶
func (f *TitleFrame) PasteHandler() func(pastedText string, setFocus func(p tview.Primitive))
PasteHandler returns the handler for this primitive.
func (*TitleFrame) SetTitle ¶
func (f *TitleFrame) SetTitle(title string)
Focus is called when this primitive receives focus.
type VerticalSeparator ¶
VerticalSeparator is a simple primitive that draws a vertical line.
func NewVerticalSeparator ¶
func NewVerticalSeparator(color tcell.Color) *VerticalSeparator
NewVerticalSeparator creates a new separator with a given color.
func (*VerticalSeparator) Draw ¶
func (s *VerticalSeparator) Draw(screen tcell.Screen)
Draw draws the separator.