Documentation ¶
Index ¶
- type ColorWriter
- type ListWidget
- type Style
- func (s Style) Bg(bg termbox.Attribute) Style
- func (s Style) Bold() Style
- func (s Style) Fg(fg termbox.Attribute) Style
- func (s Style) Fprint(w ColorWriter, a ...interface{}) (n int, err error)
- func (s Style) Fprintln(w ColorWriter, a ...interface{}) (n int, err error)
- func (s Style) Reverse() Style
- type TerminalUI
- type TextWidget
- type Widget
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorWriter ¶
type ColorWriter interface { io.Writer // Define foreground and background color SetWriterColors(termbox.Attribute, termbox.Attribute) }
ColorWriter defines an interface allowing to define color with an io.Writer interface
type ListWidget ¶
type ListWidget struct { // ListWidget is a TextWidget *TextWidget }
ListWidget represents a scrollable list
func NewListWidget ¶
func NewListWidget() *ListWidget
NewListWidget creates new ListWidget, taken its size as parameter
func (*ListWidget) GetCursor ¶
func (l *ListWidget) GetCursor() int
GetCursor gets the line where the viewing cursor is set
func (*ListWidget) SetCursor ¶
func (l *ListWidget) SetCursor(y int)
SetCursor sets the cursor for viewing
func (*ListWidget) SetCursorDown ¶
func (l *ListWidget) SetCursorDown()
SetCursorDown moves cursor down by one line
func (*ListWidget) SetCursorUp ¶
func (l *ListWidget) SetCursorUp()
SetCursorUp moves cursor up by one line
type Style ¶
type Style struct {
// contains filtered or unexported fields
}
Style is a struct that facilitates use of colors and style for terminal printing
func (Style) Fprint ¶
func (s Style) Fprint(w ColorWriter, a ...interface{}) (n int, err error)
Fprint is a convenient wrapper that prints in color to a window that implements ColorWriter interface
type TerminalUI ¶
func New ¶
func New() (*TerminalUI, error)
func (*TerminalUI) AddWidget ¶
func (t *TerminalUI) AddWidget(w Widget)
func (*TerminalUI) Close ¶
func (t *TerminalUI) Close()
func (*TerminalUI) Draw ¶
func (t *TerminalUI) Draw() error
func (*TerminalUI) Resize ¶
func (t *TerminalUI) Resize()
func (*TerminalUI) Run ¶
func (t *TerminalUI) Run() error
type TextWidget ¶
type TextWidget struct { // TextWidget is a Window *Window // contains filtered or unexported fields }
TextWidget represents a scrollable window that displays colored text TextWidget implements the io.Writer interface to facilitate entering content
func (*TextWidget) Draw ¶
func (txt *TextWidget) Draw()
Draw implements Widget interface to display the window content
func (*TextWidget) Scroll ¶
func (txt *TextWidget) Scroll(x, y int)
Scroll modify the viewing position of the text horizontally and/or vertically
func (*TextWidget) SetWriterColors ¶
func (txt *TextWidget) SetWriterColors(fg, bg termbox.Attribute)
SetWriterColors modifies the colors for writing
type Widget ¶
type Widget interface { // Draw widget content on screen Draw() // Set or reset Size of the Widget Resize(int, int, int, int) }
Widget defines an interface for TerminalUI widgets
type Window ¶
type Window struct {
// contains filtered or unexported fields
}
Window represents a window of the user interface
func (*Window) SetLineHighlight ¶
SetLineHighlight prints a line in color using the highlight colorscheme