Documentation ¶
Index ¶
- Constants
- Variables
- func Const(i int) func() int
- type Beeper
- type Bordered
- type Container
- type Context
- func (ctx *Context) Fill(x, y, width, height int, rune rune, style tcell.Style)
- func (ctx *Context) Height() int
- func (ctx *Context) HideCursor()
- func (ctx *Context) Popover(x, y, width, height int, d Drawable)
- func (ctx *Context) Printf(x, y int, style tcell.Style, format string, a ...interface{}) int
- func (ctx *Context) SetCell(x, y int, ch rune, style tcell.Style)
- func (ctx *Context) SetCursor(x, y int)
- func (ctx *Context) Subcontext(x, y, width, height int) *Context
- func (ctx *Context) Width() int
- func (ctx *Context) X() int
- func (ctx *Context) Y() int
- type Drawable
- type DrawableInteractive
- type DrawableInteractiveBeeper
- type Fill
- type Grid
- func (grid *Grid) AddChild(content Drawable) *GridCell
- func (grid *Grid) Children() []Drawable
- func (grid *Grid) Columns(spec []GridSpec) *Grid
- func (grid *Grid) Draw(ctx *Context)
- func (grid *Grid) Invalidate()
- func (grid *Grid) MouseEvent(localX int, localY int, event tcell.Event)
- func (grid *Grid) RemoveChild(content Drawable)
- func (grid *Grid) Rows(spec []GridSpec) *Grid
- type GridCell
- type GridSpec
- type Interactive
- type Invalidatable
- type MouseHandler
- type Mouseable
- type MouseableDrawableInteractive
- type Popover
- type RootDrawable
- type Stack
- func (stack *Stack) Children() []Drawable
- func (stack *Stack) Draw(ctx *Context)
- func (stack *Stack) Invalidate()
- func (stack *Stack) MouseEvent(localX int, localY int, event tcell.Event)
- func (stack *Stack) OnInvalidate(onInvalidate func(d Drawable))
- func (stack *Stack) Peek() Drawable
- func (stack *Stack) Pop() Drawable
- func (stack *Stack) Push(d Drawable)
- type Style
- type StyleObject
- type StyleSet
- func (ss StyleSet) Compose(so StyleObject, sos []StyleObject) tcell.Style
- func (ss StyleSet) ComposeSelected(so StyleObject, sos []StyleObject) tcell.Style
- func (ss StyleSet) Get(so StyleObject) tcell.Style
- func (ss *StyleSet) LoadStyleSet(stylesetName string, stylesetDirs []string) error
- func (ss *StyleSet) ParseStyleSet(file *ini.File) error
- func (ss StyleSet) Selected(so StyleObject) tcell.Style
- type Tab
- type TabContent
- type TabStrip
- type Tabs
- func (tabs *Tabs) Add(content Drawable, name string) *Tab
- func (tabs *Tabs) MoveTab(to int)
- func (tabs *Tabs) NextTab()
- func (tabs *Tabs) PinTab()
- func (tabs *Tabs) PrevTab()
- func (tabs *Tabs) Remove(content Drawable)
- func (tabs *Tabs) Replace(contentSrc Drawable, contentTarget Drawable, name string)
- func (tabs *Tabs) Select(index int)
- func (tabs *Tabs) SelectPrevious() bool
- func (tabs *Tabs) UnpinTab()
- type Text
- type TextInput
- func (ti *TextInput) Draw(ctx *Context)
- func (ti *TextInput) Event(event tcell.Event) bool
- func (ti *TextInput) Focus(focus bool)
- func (ti *TextInput) Invalidate()
- func (ti *TextInput) MouseEvent(localX int, localY int, event tcell.Event)
- func (ti *TextInput) OnChange(onChange func(ti *TextInput))
- func (ti *TextInput) Password(password bool) *TextInput
- func (ti *TextInput) Prompt(prompt string) *TextInput
- func (ti *TextInput) Set(value string) *TextInput
- func (ti *TextInput) String() string
- func (ti *TextInput) StringLeft() string
- func (ti *TextInput) StringRight() string
- func (ti *TextInput) TabComplete(tabcomplete func(s string) []string, d time.Duration) *TextInput
- type UI
- type UIConfig
- func (uiConfig UIConfig) GetComposedStyle(base StyleObject, styles []StyleObject) tcell.Style
- func (uiConfig UIConfig) GetComposedStyleSelected(base StyleObject, styles []StyleObject) tcell.Style
- func (uiConfig UIConfig) GetStyle(so StyleObject) tcell.Style
- func (uiConfig UIConfig) GetStyleSelected(so StyleObject) tcell.Style
Constants ¶
const ( BORDER_LEFT = 1 << iota BORDER_TOP = 1 << iota BORDER_RIGHT = 1 << iota BORDER_BOTTOM = 1 << iota )
const ( SIZE_EXACT = iota SIZE_WEIGHT = iota )
const ( TEXT_LEFT = iota TEXT_CENTER = iota TEXT_RIGHT = iota )
Variables ¶
var StyleNames = map[string]StyleObject{ "default": STYLE_DEFAULT, "error": STYLE_ERROR, "warning": STYLE_WARNING, "success": STYLE_SUCCESS, "title": STYLE_TITLE, "header": STYLE_HEADER, "statusline_default": STYLE_STATUSLINE_DEFAULT, "statusline_error": STYLE_STATUSLINE_ERROR, "statusline_success": STYLE_STATUSLINE_SUCCESS, "msglist_default": STYLE_MSGLIST_DEFAULT, "msglist_unread": STYLE_MSGLIST_UNREAD, "msglist_read": STYLE_MSGLIST_READ, "msglist_flagged": STYLE_MSGLIST_FLAGGED, "msglist_deleted": STYLE_MSGLIST_DELETED, "msglist_marked": STYLE_MSGLIST_MARKED, "dirlist_default": STYLE_DIRLIST_DEFAULT, "completion_default": STYLE_COMPLETION_DEFAULT, "completion_gutter": STYLE_COMPLETION_GUTTER, "completion_pill": STYLE_COMPLETION_PILL, "tab": STYLE_TAB, "stack": STYLE_STACK, "spinner": STYLE_SPINNER, "border": STYLE_BORDER, "selector_default": STYLE_SELECTOR_DEFAULT, "selector_focused": STYLE_SELECTOR_FOCUSED, "selector_chooser": STYLE_SELECTOR_CHOOSER, }
Functions ¶
Types ¶
type Bordered ¶
type Bordered struct { Invalidatable // contains filtered or unexported fields }
func (*Bordered) Invalidate ¶
func (bordered *Bordered) Invalidate()
func (*Bordered) MouseEvent ¶
type Container ¶
type Container interface { Drawable // Return all of the drawables which are children of this one (do not // recurse into your grandchildren). Children() []Drawable }
A drawable which contains other drawables
type Context ¶
type Context struct {
// contains filtered or unexported fields
}
A context allows you to draw in a sub-region of the terminal
func NewContext ¶
func (*Context) HideCursor ¶
func (ctx *Context) HideCursor()
func (*Context) Subcontext ¶
type Drawable ¶
type Drawable interface { // Called when this renderable should draw itself. Draw(ctx *Context) // Specifies a function to call when this cell needs to be redrawn. The // callback may be called in any goroutine. OnInvalidate(callback func(d Drawable)) // Invalidates the drawable. This can be called from any goroutine. Invalidate() }
Drawable is a UI component that can draw. Unless specified, all methods must only be called from a single goroutine, the UI goroutine.
type DrawableInteractive ¶
type DrawableInteractive interface { Drawable Interactive }
type DrawableInteractiveBeeper ¶
type DrawableInteractiveBeeper interface { DrawableInteractive Beeper }
type Fill ¶
type Fill rune
func (Fill) Invalidate ¶
func (f Fill) Invalidate()
func (Fill) OnInvalidate ¶
type Grid ¶
type Grid struct { Invalidatable // contains filtered or unexported fields }
func MakeGrid ¶
MakeGrid creates a grid with the specified number of columns and rows. Each cell has a size of 1.
func (*Grid) Invalidate ¶
func (grid *Grid) Invalidate()
func (*Grid) MouseEvent ¶
func (*Grid) RemoveChild ¶
type GridCell ¶
type GridSpec ¶
type GridSpec struct { // One of SIZE_EXACT or SIZE_WEIGHT Strategy int // If Strategy = SIZE_EXACT, this function returns the number of cells // this row/col shall occupy. If SIZE_WEIGHT, the space left after all // exact rows/cols are measured is distributed amonst the remainder // weighted by the value returned by this function. Size func() int }
Specifies the layout of a single row or column
type Interactive ¶
type Invalidatable ¶
type Invalidatable struct {
// contains filtered or unexported fields
}
func (*Invalidatable) DoInvalidate ¶
func (i *Invalidatable) DoInvalidate(d Drawable)
func (*Invalidatable) OnInvalidate ¶
func (i *Invalidatable) OnInvalidate(f func(d Drawable))
type MouseHandler ¶
type Mouseable ¶
type Mouseable interface { Drawable MouseHandler }
A drawable that can be interacted with by the mouse
type MouseableDrawableInteractive ¶
type MouseableDrawableInteractive interface { DrawableInteractive MouseHandler }
type Popover ¶
type Popover struct {
// contains filtered or unexported fields
}
func (*Popover) Invalidate ¶
func (p *Popover) Invalidate()
func (*Popover) OnInvalidate ¶
type RootDrawable ¶
type RootDrawable interface {
Initialize(ui *UI)
}
type Stack ¶
type Stack struct {
// contains filtered or unexported fields
}
func (*Stack) Invalidate ¶
func (stack *Stack) Invalidate()
func (*Stack) MouseEvent ¶
func (*Stack) OnInvalidate ¶
type Style ¶
type StyleObject ¶
type StyleObject int32
const ( STYLE_DEFAULT StyleObject = iota STYLE_ERROR STYLE_WARNING STYLE_SUCCESS STYLE_TITLE STYLE_HEADER STYLE_STATUSLINE_DEFAULT STYLE_STATUSLINE_ERROR STYLE_STATUSLINE_SUCCESS STYLE_MSGLIST_DEFAULT STYLE_MSGLIST_UNREAD STYLE_MSGLIST_READ STYLE_MSGLIST_FLAGGED STYLE_MSGLIST_DELETED STYLE_MSGLIST_MARKED STYLE_DIRLIST_DEFAULT STYLE_COMPLETION_DEFAULT STYLE_COMPLETION_GUTTER STYLE_COMPLETION_PILL STYLE_TAB STYLE_STACK STYLE_SPINNER STYLE_BORDER STYLE_SELECTOR_DEFAULT STYLE_SELECTOR_FOCUSED STYLE_SELECTOR_CHOOSER )
type StyleSet ¶
type StyleSet struct {
// contains filtered or unexported fields
}
func NewStyleSet ¶
func NewStyleSet() StyleSet
func (StyleSet) Compose ¶
func (ss StyleSet) Compose(so StyleObject, sos []StyleObject) tcell.Style
func (StyleSet) ComposeSelected ¶
func (ss StyleSet) ComposeSelected(so StyleObject, sos []StyleObject) tcell.Style
func (StyleSet) Get ¶
func (ss StyleSet) Get(so StyleObject) tcell.Style
func (*StyleSet) LoadStyleSet ¶
func (StyleSet) Selected ¶
func (ss StyleSet) Selected(so StyleObject) tcell.Style
type TabContent ¶
type TabContent Tabs
func (*TabContent) Children ¶
func (content *TabContent) Children() []Drawable
func (*TabContent) Draw ¶
func (content *TabContent) Draw(ctx *Context)
func (*TabContent) Invalidate ¶
func (content *TabContent) Invalidate()
func (*TabContent) MouseEvent ¶
func (content *TabContent) MouseEvent(localX int, localY int, event tcell.Event)
func (*TabContent) OnInvalidate ¶
func (content *TabContent) OnInvalidate(onInvalidate func(d Drawable))
type TabStrip ¶
type TabStrip Tabs
func (*TabStrip) Invalidate ¶
func (strip *TabStrip) Invalidate()
func (*TabStrip) MouseEvent ¶
func (*TabStrip) OnInvalidate ¶
type Tabs ¶
type Tabs struct { Tabs []*Tab TabStrip *TabStrip TabContent *TabContent Selected int CloseTab func(index int) // contains filtered or unexported fields }
func (*Tabs) SelectPrevious ¶
type Text ¶
type Text struct { Invalidatable // contains filtered or unexported fields }
func (*Text) Invalidate ¶
func (t *Text) Invalidate()
type TextInput ¶
type TextInput struct { Invalidatable // contains filtered or unexported fields }
func NewTextInput ¶
Creates a new TextInput. TextInputs will render a "textbox" in the entire context they're given, and process keypresses to build a string from user input.
func (*TextInput) Invalidate ¶
func (ti *TextInput) Invalidate()
func (*TextInput) MouseEvent ¶
func (*TextInput) StringLeft ¶
func (*TextInput) StringRight ¶
type UI ¶
type UI struct { Content DrawableInteractive // contains filtered or unexported fields }
func Initialize ¶
func Initialize(content DrawableInteractive) (*UI, error)
func (*UI) EnableMouse ¶
func (state *UI) EnableMouse()
func (*UI) ShouldExit ¶
type UIConfig ¶
type UIConfig struct { PinnedTabMarker string `ini:"pinned-tab-marker"` SidebarWidth int `ini:"sidebar-width"` PreviewHeight int `ini:"preview-height"` EmptyFeed string `ini:"empty-feed"` MouseEnabled bool `ini:"mouse-enabled"` //NewArticleBell bool `ini:"new-article-bell"` Spinner string `ini:"spinner"` SpinnerDelimiter string `ini:"spinner-delimiter"` //Sort []string `delim:" "` //CompletionDelay time.Duration `ini:"completion-delay"` //CompletionPopovers bool `ini:"completion-popovers"` StyleSetDirs []string `ini:"stylesets-dirs" delim:":"` StyleSetName string `ini:"styleset-name"` // contains filtered or unexported fields }
TODO add back the removed stuff TODO some of this stuff should probably be extracted if it is not directly used in the lib
func (UIConfig) GetComposedStyle ¶
func (uiConfig UIConfig) GetComposedStyle(base StyleObject, styles []StyleObject) tcell.Style
func (UIConfig) GetComposedStyleSelected ¶
func (uiConfig UIConfig) GetComposedStyleSelected(base StyleObject, styles []StyleObject) tcell.Style
func (UIConfig) GetStyle ¶
func (uiConfig UIConfig) GetStyle(so StyleObject) tcell.Style
func (UIConfig) GetStyleSelected ¶
func (uiConfig UIConfig) GetStyleSelected(so StyleObject) tcell.Style