Documentation
¶
Index ¶
- Constants
- type ClipRegion
- func (cr *ClipRegion) Clear()
- func (cr *ClipRegion) Fill(ch rune, style tcell.Style)
- func (cr *ClipRegion) InRect(x, y int) bool
- func (cr *ClipRegion) SetCell(x int, y int, style tcell.Style, ch ...rune)
- func (cr *ClipRegion) SetContent(x int, y int, mainc rune, combc []rune, style tcell.Style)
- func (cr *ClipRegion) ShowCursor(x int, y int)
- type Direction
- type Item
- type Layout
- func (l *Layout) AddItem(p tview.Primitive, size int) *Layout
- func (l *Layout) Blur()
- func (l *Layout) ClearItems() *Layout
- func (l *Layout) CountItems() int
- func (l *Layout) Draw(screen tcell.Screen)
- func (l *Layout) Focus(delegate func(p tview.Primitive))
- func (l *Layout) GetBackgroundColor() tcell.Color
- func (l *Layout) GetDirection() Direction
- func (l *Layout) GetInputCapture() func(event *tcell.EventKey) *tcell.EventKey
- func (l *Layout) GetItem(i int) *Item
- func (l *Layout) GetMouseCapture() ...
- func (l *Layout) GetRect() (int, int, int, int)
- func (l *Layout) GetSplitterAttributes() tcell.AttrMask
- func (l *Layout) GetSplitterColor() tcell.Color
- func (l *Layout) HasFocus() bool
- func (l *Layout) InRect(x, y int) bool
- func (l *Layout) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (l *Layout) MouseHandler() ...
- func (l *Layout) RemoveItem(i int) *Layout
- func (l *Layout) SetBackgroundColor(color tcell.Color) *Layout
- func (l *Layout) SetDirection(d Direction) *Layout
- func (l *Layout) SetInputCapture(capture func(event *tcell.EventKey) *tcell.EventKey) *Layout
- func (l *Layout) SetMouseCapture(...) *Layout
- func (l *Layout) SetRect(x, y, width, height int)
- func (l *Layout) SetSplitter(show bool) *Layout
- func (l *Layout) SetSplitterAttributes(attr tcell.AttrMask) *Layout
- func (l *Layout) SetSplitterColor(color tcell.Color) *Layout
- func (l *Layout) WrapInputHandler(inputHandler func(*tcell.EventKey, func(p tview.Primitive))) func(*tcell.EventKey, func(p tview.Primitive))
- func (l *Layout) WrapMouseHandler(...) ...
- type Manager
- func (m *Manager) Draw(screen tcell.Screen)
- func (m *Manager) Focus(delegate func(p tview.Primitive))
- func (m *Manager) GetRoot() *Layout
- func (m *Manager) HasFocus() bool
- func (m *Manager) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (m *Manager) IsMaximazed(w *Window) bool
- func (m *Manager) Maximize(w *Window) *Manager
- func (m *Manager) MouseHandler() ...
- func (m *Manager) Restore() *Manager
- func (m *Manager) SetRoot(root *Layout) *Manager
- type Window
- func (w *Window) AddButton(symbol rune, alignment WindowButtonAlignment, ...) *Window
- func (w *Window) Blur()
- func (w *Window) ClearButtons() *Window
- func (w *Window) CountButtons() int
- func (w *Window) Draw(screen tcell.Screen)
- func (w *Window) Focus(delegate func(p tview.Primitive))
- func (w *Window) GetButton(i int) *WindowButton
- func (w *Window) GetRoot() tview.Primitive
- func (w *Window) HasBorder() bool
- func (w *Window) HasFocus() bool
- func (w *Window) InputHandler() func(event *tcell.EventKey, setFocus func(p tview.Primitive))
- func (w *Window) MouseHandler() ...
- func (w *Window) RemoveButton(i int) *Window
- func (w *Window) SetBorder(show bool) *Window
- func (w *Window) SetRoot(root tview.Primitive) *Window
- func (w *Window) SetTitle(text string) *Window
- type WindowButton
- type WindowButtonAlignment
Constants ¶
const (
AutoSize = 0
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ClipRegion ¶
type ClipRegion struct { tcell.Screen // contains filtered or unexported fields }
ClipRegion implements tcell.Screen and only allows setting content within a defined region
func NewClipRegion ¶
func NewClipRegion(screen tcell.Screen, x, y, width, height int) *ClipRegion
New creates a new clipped screen with the given rectangular coordinates
func (*ClipRegion) Fill ¶
func (cr *ClipRegion) Fill(ch rune, style tcell.Style)
Fill implements tcell.Screen.Fill
func (*ClipRegion) InRect ¶
func (cr *ClipRegion) InRect(x, y int) bool
InRect returns true if the given coordinates are within this clipped region
func (*ClipRegion) SetCell ¶
func (cr *ClipRegion) SetCell(x int, y int, style tcell.Style, ch ...rune)
SetCell is an older API, and will be removed. Please use SetContent instead; SetCell is implemented in terms of SetContent.
func (*ClipRegion) SetContent ¶
func (cr *ClipRegion) SetContent(x int, y int, mainc rune, combc []rune, style tcell.Style)
SetContent sets the contents of the given cell location. If the coordinates are out of range, then the operation is ignored.
The first rune is the primary non-zero width rune. The array that follows is a possible list of combining characters to append, and will usually be nil (no combining characters.)
The results are not displayed until Show() or Sync() is called.
Note that wide (East Asian full width) runes occupy two cells, and attempts to place character at next cell to the right will have undefined effects. Wide runes that are printed in the last column will be replaced with a single width space on output.
func (*ClipRegion) ShowCursor ¶
func (cr *ClipRegion) ShowCursor(x int, y int)
ShowCursor is used to display the cursor at a given location. If the coordinates -1, -1 are given or are otherwise outside the dimensions of the screen, the cursor will be hidden.
type Layout ¶
type Layout struct {
// contains filtered or unexported fields
}
func (*Layout) ClearItems ¶
func (*Layout) CountItems ¶
func (*Layout) GetBackgroundColor ¶
func (l *Layout) GetBackgroundColor() tcell.Color
GetBackgroundColor returns the layout's background color.
func (*Layout) GetDirection ¶
func (*Layout) GetInputCapture ¶
func (l *Layout) GetInputCapture() func(event *tcell.EventKey) *tcell.EventKey
GetInputCapture returns the function installed with SetInputCapture() or nil if no such function has been installed.
func (*Layout) GetMouseCapture ¶
func (l *Layout) GetMouseCapture() func(action tview.MouseAction, event *tcell.EventMouse) (tview.MouseAction, *tcell.EventMouse)
GetMouseCapture returns the function installed with SetMouseCapture() or nil if no such function has been installed.
func (*Layout) GetSplitterAttributes ¶
func (l *Layout) GetSplitterAttributes() tcell.AttrMask
GetSplitterAttributes returns the splitter's style attributes.
func (*Layout) GetSplitterColor ¶
func (l *Layout) GetSplitterColor() tcell.Color
GetSplitterColor returns the layout's splitter color.
func (*Layout) InRect ¶
InRect returns true if the given coordinate is within the bounds of the box's rectangle.
func (*Layout) InputHandler ¶
func (*Layout) MouseHandler ¶
func (l *Layout) 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 (*Layout) RemoveItem ¶
func (*Layout) SetBackgroundColor ¶
SetBackgroundColor sets the layout's background color.
func (*Layout) SetDirection ¶
func (*Layout) SetInputCapture ¶
SetInputCapture installs a function which captures key events before they are forwarded to the primitive's default key event handler. This function can then choose to forward that key event (or a different one) to the default handler by returning it. If nil is returned, the default handler will not be called.
Providing a nil handler will remove a previously existing handler.
Note that this function will not have an effect on primitives composed of other primitives, such as Form, Flex, or Grid. Key events are only captured by the primitives that have focus (e.g. InputField) and only one primitive can have focus at a time. Composing primitives such as Form pass the focus on to their contained primitives and thus never receive any key events themselves. Therefore, they cannot intercept key events.
func (*Layout) SetMouseCapture ¶
func (l *Layout) SetMouseCapture(capture func(action tview.MouseAction, event *tcell.EventMouse) (tview.MouseAction, *tcell.EventMouse)) *Layout
SetMouseCapture sets a function which captures mouse events (consisting of the original tcell mouse event and the semantic mouse action) before they are forwarded to the primitive's default mouse event handler. This function can then choose to forward that event (or a different one) by returning it or returning a nil mouse event, in which case the default handler will not be called.
Providing a nil handler will remove a previously existing handler.
func (*Layout) SetSplitter ¶
SetSplitter sets the flag indicating whether or not the layout should render a splitters between primitives
func (*Layout) SetSplitterAttributes ¶
SetSplitterAttributes sets the splitter's style attributes. You can combine different attributes using bitmask operations:
layout.SetSplitterAttributes(tcell.AttrUnderline | tcell.AttrBold)
func (*Layout) SetSplitterColor ¶
SetSplitterColor sets the layout's splitter color.
func (*Layout) WrapInputHandler ¶
func (l *Layout) WrapInputHandler(inputHandler func(*tcell.EventKey, func(p tview.Primitive))) func(*tcell.EventKey, func(p tview.Primitive))
WrapInputHandler wraps an input handler (see InputHandler()) with the functionality to capture input (see SetInputCapture()) before passing it on to the provided (default) input handler.
This is only meant to be used by subclassing primitives.
func (*Layout) WrapMouseHandler ¶
func (l *Layout) WrapMouseHandler(mouseHandler func(tview.MouseAction, *tcell.EventMouse, func(p tview.Primitive)) (bool, tview.Primitive)) func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)
WrapMouseHandler wraps a mouse event handler (see MouseHandler()) with the functionality to capture mouse events (see SetMouseCapture()) before passing them on to the provided (default) event handler.
This is only meant to be used by subclassing primitives.
type Manager ¶
func NewWindowManager ¶
func NewWindowManager() *Manager
func (*Manager) Draw ¶
func (m *Manager) Draw(screen tcell.Screen)
Draw draws this primitive onto the screen.
func (*Manager) InputHandler ¶
InputHandler returns a handler which receives key events when it has focus.
func (*Manager) IsMaximazed ¶
func (*Manager) MouseHandler ¶
func (m *Manager) 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.
type Window ¶
Window defines a basic window
func (*Window) AddButton ¶
func (w *Window) AddButton(symbol rune, alignment WindowButtonAlignment, onclick func(w *Window, b *WindowButton)) *Window
AddButton adds a new window button to the title bar
func (*Window) ClearButtons ¶
func (*Window) CountButtons ¶
CountButtons returns the number of buttons in the window title bar
func (*Window) Draw ¶
func (w *Window) Draw(screen tcell.Screen)
Draw draws this primitive on to the screen
func (*Window) GetButton ¶
func (w *Window) GetButton(i int) *WindowButton
GetButton returns the given button
func (*Window) GetRoot ¶
GetRoot returns the primitive that represents the main content of the window
func (*Window) HasBorder ¶
HasBorder returns true if this window has a border windows without border cannot be resized or dragged by the user
func (*Window) InputHandler ¶
InputHandler returns a handler which receives key events when it has focus.
func (*Window) MouseHandler ¶
func (w *Window) MouseHandler() func(action tview.MouseAction, event *tcell.EventMouse, setFocus func(p tview.Primitive)) (consumed bool, capture tview.Primitive)
MouseHandler returns a mouse handler for this primitive
func (*Window) RemoveButton ¶
func (*Window) SetBorder ¶
SetBorder sets the flag indicating whether or not the box should have a border.
type WindowButton ¶
type WindowButton struct { Alignment WindowButtonAlignment Symbol rune // icon for the button OnClick func(w *Window, b *WindowButton) // callback to be invoked when the button is clicked // contains filtered or unexported fields }
WindowButton represents a button on the window title bar
type WindowButtonAlignment ¶
type WindowButtonAlignment int
const ( WindowButtonAlignLeft WindowButtonAlignment = tview.AlignLeft WindowButtonAlignRight WindowButtonAlignment = tview.AlignRight )