Documentation ¶
Index ¶
- func PollEvents(ctx context.Context, events EventChans) error
- func Update(fg, bg termbox.Attribute, update func(BufferSlice))
- type Area
- func (a Area) EachCol(fn func(col int))
- func (a Area) EachRow(fn func(row int))
- func (a Area) HeightCh(n int) Area
- func (a Area) HeightFr(n int) Area
- func (a Area) MaxCol() int
- func (a Area) MaxRow() int
- func (a Area) Span(cols, rows int) Area
- func (a Area) WidthCh(n int) Area
- func (a Area) WidthFr(n int) Area
- type AttrString
- type BufferSlice
- type Cell
- type CellString
- type DeferredSizes
- type Dimension
- type Drawer
- type EventChans
- type Events
- type Grid
- type Line
- type Point
- type Rect
- type Rune
- type Size
- type SizeCh
- type SizeFr
- type SizesGroup
- type String
- type Table
- type TableCell
- type TableRow
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func PollEvents ¶
func PollEvents(ctx context.Context, events EventChans) error
func Update ¶
func Update(fg, bg termbox.Attribute, update func(BufferSlice))
Types ¶
type AttrString ¶
func (AttrString) Draw ¶
func (a AttrString) Draw(dest BufferSlice)
func (AttrString) Width ¶
func (a AttrString) Width() int
type BufferSlice ¶
type BufferSlice struct { Width int Height int Stride int // contains filtered or unexported fields }
BufferSlice is a sub-rectangle within a larger Buffer.
func TermboxBackBuffer ¶
func TermboxBackBuffer() BufferSlice
func (BufferSlice) Get ¶
func (sl BufferSlice) Get(x, y int) (*termbox.Cell, bool)
Get returns a pointer to the underlying Cell in the backing buffer, or nil if out of bounds.
func (BufferSlice) SetBg ¶
func (sl BufferSlice) SetBg(a termbox.Attribute)
func (BufferSlice) SetFg ¶
func (sl BufferSlice) SetFg(a termbox.Attribute)
func (BufferSlice) Slice ¶
func (sl BufferSlice) Slice(x, y, width, height int) BufferSlice
type CellString ¶
func (CellString) Draw ¶
func (cs CellString) Draw(dest BufferSlice)
func (CellString) Width ¶
func (cs CellString) Width() int
type DeferredSizes ¶
type DeferredSizes struct {
// contains filtered or unexported fields
}
func NewDeferredSizes ¶
func NewDeferredSizes(length int) *DeferredSizes
func (*DeferredSizes) CalculateAll ¶
func (d *DeferredSizes) CalculateAll() []int
func (*DeferredSizes) Length ¶
func (d *DeferredSizes) Length() int
func (*DeferredSizes) Push ¶
func (d *DeferredSizes) Push(i int, fn di.DeferredInt)
type Drawer ¶
type Drawer interface {
Draw(dest BufferSlice)
}
type EventChans ¶
type EventChans struct { Chars chan<- rune Keys chan<- termbox.Key Resizes chan<- Dimension MouseCoords chan<- Point Errors chan<- error Interrupts chan<- bool }
EventChans are writeable channels for the various event types.
type Events ¶
type Events struct { Chars <-chan rune Keys <-chan termbox.Key Resizes <-chan Dimension MouseCoords <-chan Point Errors <-chan error Interrupts <-chan bool }
Events are readable channels for the various event types.
func StartPollEvents ¶
StartPollEvents starts a goroutine that polls termbox events and writes them to the returned channel. It explodes the single termbox.Event into many events, each with unique channel. This makes things a bit nicer and less nested when you're going to manage the event loop manually with a big for{select...} loop.
The downside is the caller must select from every returned channel. Failing to receive and event from one channel will result in the polling loop blocking, unable to handle further events.
type Grid ¶
func (*Grid) Draw ¶
func (grid *Grid) Draw(dest BufferSlice)
func (*Grid) Layout ¶
Layout the grid into a rectangle of the given dimensions. The units of the returned rectangles are in cells. The previous layout (only one previous layout) is cached internally, and the cached layout returned for subsequent calls with the same dimensions.
func (*Grid) LayoutBuffers ¶
func (grid *Grid) LayoutBuffers(buf BufferSlice) map[string]BufferSlice
func (*Grid) RowsAndColumns ¶
type Line ¶
type Line []TableCell
Line is a horizontal list of TableCell
func (Line) Draw ¶
func (line Line) Draw(buf BufferSlice)
type Size ¶
type Size interface {
// contains filtered or unexported methods
}
Size represents the size (length or width) of a screen area.
type SizeFr ¶
type SizeFr int
SizeFr is a fractional size, or weight. All fractional sizes in a given row or column are summed to be the denominator of the fraction, which the individual size is the numerator, minus any space already consumed by absolute sized areas.
type SizesGroup ¶
type SizesGroup struct {
Sizes []Size
}
type Table ¶
type Table struct {
Rows []TableRow
}
func (*Table) ColumnCount ¶
func (*Table) ColumnWidths ¶
func (*Table) Draw ¶
func (table *Table) Draw(dest BufferSlice)
type TableCell ¶
type TableCell interface { Draw(dest BufferSlice) Width() int }