Documentation ¶
Index ¶
- Variables
- func AbsInt(x int) int
- func CellsToString(cells []Cell) string
- func FloorFloat64(x float64) float64
- func GetMaxFloat64From2dSlice(slices [][]float64) (float64, error)
- func GetMaxFloat64FromSlice(slice []float64) (float64, error)
- func GetMaxIntFromSlice(slice []int) (int, error)
- func InterfaceSlice(slice interface{}) []interface{}
- func MaxFloat64(x, y float64) float64
- func MaxInt(x, y int) int
- func MinFloat64(x, y float64) float64
- func MinInt(x, y int) int
- func PollEvents() <-chan Event
- func RoundFloat64(x float64) float64
- func SplitCells(cells []Cell, r rune) [][]Cell
- func SumFloat64Slice(data []float64) float64
- func SumIntSlice(slice []int) int
- func TrimString(s string, w int) string
- type Block
- type Buffer
- type Canvas
- type Cell
- type CellWithX
- type Event
- type EventType
- type Grid
- type GridItem
- type Mouse
- type Resize
Constants ¶
This section is empty.
Variables ¶
var CellClear = Cell{
Rune: ' ',
Style: StyleClear,
}
var StyleParserColorMap = map[string]tcell.Color{
"red": ColorRed,
"blue": ColorBlue,
"black": ColorBlack,
"cyan": ColorCyan,
"yellow": ColorYellow,
"white": ColorWhite,
"clear": ColorClear,
"green": ColorGreen,
"magenta": ColorMagenta,
}
StyleParserColorMap can be modified to add custom color parsing to text
Functions ¶
func CellsToString ¶
func FloorFloat64 ¶
func GetMaxFloat64FromSlice ¶
func GetMaxIntFromSlice ¶
func InterfaceSlice ¶
func InterfaceSlice(slice interface{}) []interface{}
InterfaceSlice takes an []interface{} represented as an interface{} and converts it https://stackoverflow.com/questions/12753805/type-converting-slices-of-interfaces-in-go
func MaxFloat64 ¶
func MinFloat64 ¶
func PollEvents ¶
func PollEvents() <-chan Event
PollEvents gets events from termbox, converts them, then sends them to each of its channels.
func RoundFloat64 ¶
func SplitCells ¶
func SumFloat64Slice ¶
func SumIntSlice ¶
func TrimString ¶
TrimString trims a string to a max length and adds '…' to the end if it was trimmed.
Types ¶
type Block ¶
type Block struct { Border bool BorderStyle Style BorderLeft, BorderRight, BorderTop, BorderBottom bool PaddingLeft, PaddingRight, PaddingTop, PaddingBottom int image.Rectangle Inner image.Rectangle Title string TitleStyle Style sync.Mutex }
Block is the base struct inherited by most widgets. Block manages size, position, border, and title. It implements all 3 of the methods needed for the `Drawable` interface. Custom widgets will override the Draw method.
type Cell ¶
type Cell struct { Rune rune Style Style }
Cell represents a viewable terminal cell
func ParseStyles ¶
ParseStyles parses a string for embedded Styles and returns []Cell with the correct styling. Uses defaultStyle for any text without an embedded style. Syntax is of the form [text](fg:<color>,mod:<attribute>,bg:<color>). Ordering does not matter. All fields are optional.
func RunesToStyledCells ¶
func WrapCells ¶
WrapCells takes []Cell and inserts Cells containing '\n' wherever a linebreak should go.
func (*Cell) IsZeroWidth ¶
IsZeroWidth returns true if the rune is a zwc
type CellWithX ¶
func BuildCellWithXArray ¶
type GridItem ¶
type GridItem struct { Type gridItemType XRatio float64 YRatio float64 WidthRatio float64 HeightRatio float64 Entry interface{} // Entry.type == GridBufferer if IsLeaf else []GridItem IsLeaf bool // contains filtered or unexported fields }
GridItem represents either a Row or Column in a grid. Holds sizing information and either an []GridItems or a widget.