Documentation ¶
Overview ¶
termboxui adds extra functionality to the termbox package by nsf. This package is intended to be used with termbox and does not completely encapsulate and wrap all of its functions.
Index ¶
- func DrawBox(x, y, w, h int)
- func DrawHorzLine(x, y int, w int)
- func DrawVertLine(x, y int, h int)
- func Fill(x, y, w, h int, cell termbox.Cell)
- func FillView(view *View, x, y, w, h int, cell termbox.Cell)
- func WrapText(text string, lim int) []string
- type Container
- type Frame
- type HSplit
- type Label
- func (lbl *Label) Clear()
- func (lbl *Label) Draw()
- func (lbl *Label) Move(x, y int)
- func (lbl *Label) NextPage() error
- func (lbl Label) Origin() (x, y int)
- func (lbl Label) Overwrite()
- func (lbl *Label) PrevPage() error
- func (lbl *Label) Resize(width, height int)
- func (lbl *Label) Scroll(amt int) error
- func (lbl *Label) SetBG(attr termbox.Attribute)
- func (lbl *Label) SetBorders(borders bool)
- func (lbl *Label) SetFG(attr termbox.Attribute)
- func (lbl Label) Size() (width, height int)
- func (lbl *Label) Write(p []byte) (n int, err error)
- type Split
- type SplitType
- type VSplit
- type View
- func (v *View) Clear(fg, bg termbox.Attribute)
- func (v *View) ClearDefault()
- func (v *View) Move(xOffset, yOffset int)
- func (v *View) MoveTo(x, y int)
- func (v *View) Origin() (x, y int)
- func (v *View) Resize(w, h int)
- func (v *View) SetCell(x, y int, ch rune, fg, bg termbox.Attribute)
- func (v *View) Size() (width, height int)
- type Window
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DrawHorzLine ¶
Draw a horizontal line starting at point (x, y) with length w
func DrawVertLine ¶
Draw a vertical line starting at point (x, y) with length h
func Fill ¶
func Fill(x, y, w, h int, cell termbox.Cell)
Fill fills a rectangular area with the given cell
Types ¶
type Container ¶
type Container interface { Draw() Place(Window) error Remove(Window) Move(x, y int) Resize(width, height int) }
Container represents anything that can store and display Windows. Generally containers are used to tile the Windows as well as handling resizing the Windows
type HSplit ¶
type HSplit struct {
// contains filtered or unexported fields
}
HSplit creates a vertical divider and tiles windows next to the split.
func (*HSplit) GetSplitLoc ¶
Gets the location of the split relative to the entire screen.
func (*HSplit) Place ¶
Place places the window either to the left or right of the split. If both spaces are empty, it will be placed to the left. If both spaces have been taken, this will return an error.
func (*HSplit) RemoveFirst ¶
func (s *HSplit) RemoveFirst()
RemoveFirst removes the window to the left
func (*HSplit) RemoveLast ¶
func (s *HSplit) RemoveLast()
RemoveLast removes the window to the right
type Label ¶
type Label struct { Title string // contains filtered or unexported fields }
Label creates an area that displays text
func (Label) Overwrite ¶
func (lbl Label) Overwrite()
Redraw clears any previous text in the label and then perform a Draw
func (*Label) SetBorders ¶
type Split ¶
type Split interface { Draw() Place(Window) error Remove(Window) RemoveFirst() RemoveLast() Move(x, y int) Resize(w, h int) }
func NewSplit ¶
NewSplit creates a new horizontal split. If the location is positive then it is based starting from the left/top. If the location is negative then it starts from the right/bottom. If location is on the interval (0, 1), then it is treated as a percentage and the split will appear that percent down the screen. If location is >= 1 then it is truncated and will appear on the location'th row. The split will take up the entire screen by default. A VSplit.Move and VSplit.Resize is necessary to place it in the correct position if that is not the behaviour you want.
type VSplit ¶
type VSplit struct {
// contains filtered or unexported fields
}
VSplit creates a vertical divider and tiles windows next to the split.
func (*VSplit) GetSplitLoc ¶
Gets the location of the split relative to the entire screen.
func (*VSplit) Place ¶
Place places the window either to the left or right of the split. If both spaces are empty, it will be placed to the left. If both spaces have been taken, this will return an error.
func (*VSplit) RemoveFirst ¶
func (s *VSplit) RemoveFirst()
RemoveFirst removes the window to the left
func (*VSplit) RemoveLast ¶
func (s *VSplit) RemoveLast()
RemoveLast removes the window to the right
type View ¶
type View struct {
// contains filtered or unexported fields
}
View imitates another termbox session. Can "pre-render" cells here and display them later on
func NewView ¶
func NewView() *View
Creates a new View with the specified buffer size REQ: bufw and bufh must be greater than 0
func (*View) ClearDefault ¶
func (v *View) ClearDefault()
func (*View) Move ¶
Move moves the location of the view by the specified offset. It does not move the content that has already been rendered but all future content will be rendered at the new location.