Documentation ¶
Index ¶
- Constants
- Variables
- func Close()
- func Hline(y, x, width int, fontFace FontFace)
- func Napms(ms uint)
- func SetFontFace(cPair uint8, Bg, Fg uint64)
- func Show(doc *katana.Doc)
- func Size() (height, width int)
- func ToCustomU64(str string, color uint64) (result []uint64)
- func Vline(y, x, width int, fontFace FontFace)
- type Cell
- type CellBuffer
- func (b *CellBuffer) Cap() int
- func (b *CellBuffer) Data() []Cell
- func (b *CellBuffer) Grow(n int)
- func (b *CellBuffer) Len() int
- func (b *CellBuffer) Next(n int) []Cell
- func (b *CellBuffer) ReadFrom(r CellBuffer) (n int, err error)
- func (b *CellBuffer) Reset()
- func (b *CellBuffer) SetFace(face uint64)
- func (b *CellBuffer) String() (str string)
- func (b *CellBuffer) Truncate(n int)
- func (b *CellBuffer) Write(p []Cell) (n int, err error)
- func (b *CellBuffer) WriteRune(r rune) error
- func (b *CellBuffer) WriteString(s string) (n int, err error)
- func (b *CellBuffer) WriteU64(u uint64) error
- type FontFace
- type Gps
- type Pad
- func (p *Pad) AddCell(cell Cell)
- func (p *Pad) AddCells(cells []Cell)
- func (p *Pad) AddCenterCells(cells []Cell, leftMargin uint)
- func (p *Pad) AddCh(ch uint64)
- func (p *Pad) AddChs(ch []uint64)
- func (p *Pad) AddLeftCells(cells []Cell, width, leftMargin uint)
- func (p *Pad) AddPreCells(cells []Cell, leftMargin uint)
- func (p *Pad) AddRightCells(cells []Cell, leftMargin, rightMargin uint)
- func (p *Pad) AddRune(r rune)
- func (p *Pad) AddStr(str string)
- func (p *Pad) CustomFontify(m katana.Markup, color uint64)
- func (p *Pad) Draw()
- func (p *Pad) GetDefaultCell() Cell
- func (p *Pad) Mv(y, x int)
- func (p *Pad) ParseMorg(doc *katana.Doc)
- func (p *Pad) Scroll(dir int)
- func (p *Pad) SetCell(cell Cell)
- func (p *Pad) SetCells(cells []Cell)
- func (p *Pad) SetFace(face uint64)
- func (p *Pad) Shoot(y, x int, cell Cell)
- func (p *Pad) Shooter(y, x int, cells []Cell)
- func (p *Pad) StrToCells(str string) []Cell
- type Window
- func (w *Window) AddCell(cell Cell)
- func (w *Window) AddCells(cells []Cell)
- func (w *Window) AddCh(chtype uint64)
- func (w *Window) AddChs(chs []uint64)
- func (w *Window) AddStr(str string)
- func (w *Window) Attroff(attrs uint64)
- func (w *Window) Attron(attrs uint64)
- func (w *Window) Box()
- func (w *Window) ChFace(face uint64)
- func (w *Window) Clear()
- func (w *Window) CursSet(visibility bool)
- func (w *Window) Draw()
- func (w *Window) GetDefaultCell() Cell
- func (w *Window) GetFace() (ff FontFace)
- func (w *Window) Getch() uint64
- func (w *Window) Hline(y, x, width int)
- func (w *Window) Mv(y, x int) (err bool)
- func (w *Window) MvAddCells(y, x int, cells []Cell) (err bool)
- func (w *Window) MvAddCh(y, x int, chtype uint64) (err bool)
- func (w *Window) MvAddChs(y, x int, chs []uint64) (err bool)
- func (w *Window) MvChFace(y, x int, face uint64) (err bool)
- func (w *Window) Refresh()
- func (w *Window) SetAttrs(attrs uint64)
- func (w *Window) SetColor(face uint64)
- func (w *Window) SetFace(face uint64)
- func (w *Window) Size() (height, width int)
- func (w *Window) StrToCells(str string) []Cell
- func (w *Window) ValidPos(pos Gps) bool
- func (w *Window) Vline(y, x, width int)
Constants ¶
const ( ColorDefault uint64 = iota << 48 ColorBlack ColorRed ColorGreen ColorYellow ColorBlue ColorMagenta ColorCyan ColorWhite )
const ( ColorDD uint64 = iota << 48 ColorBB ColorBR ColorBG ColorBY ColorBX ColorBM ColorBC ColorBW // BLACK B // ColorRB ColorRR ColorRG ColorRY ColorRX ColorRM ColorRC ColorRW // RED R // ColorGB ColorGR ColorGG ColorGY ColorGX ColorGM ColorGC ColorGW // GREEN G // ColorYB ColorYR ColorYG ColorYY ColorYX ColorYM ColorYC ColorYW // YELLOW Y // ColorXB ColorXR ColorXG ColorXY ColorXX ColorXM ColorXC ColorXW // BLUE X // ColorMB ColorMR ColorMG ColorMY ColorMX ColorMM ColorMC ColorMW // MAGENTA M // ColorCB ColorCR ColorCG ColorCY ColorCX ColorCM ColorCC ColorCW // CYAN C // ColorWB ColorWR ColorWG ColorWY ColorWX ColorWM ColorWC ColorWW // WHITE W // )
const ( Bold uint64 = 1 << (57 + iota) Underline Reverse // Blink Normal uint64 = 0 )
const ( Ctrl uint64 = 1 << (32 + iota) Alt Shift )
const ( KeyF1 uint64 = 0xFFFFFFFF - iota KeyF2 KeyF3 KeyF4 KeyF5 KeyF6 KeyF7 KeyF8 KeyF9 KeyF10 KeyF11 KeyF12 KeyInsert KeyDelete KeyHome KeyEnd KeyPgup KeyPgdn KeyArrowUp KeyArrowDown KeyArrowLeft KeyArrowRight Mouse MouseLeft MouseMiddle MouseRight MouseRelease MouseWheelUp MouseWheelDown KeyCtrlTilde KeyCtrl2 KeyBackspace KeyBackspace2 KeyTab uint64 = '\t' KeyEnter uint64 = '\n' KeyEsc uint64 = 27 )
const ( Mouse1_PRESSED = 0 Mouse1_RELEASED Mouse1_CLICKED Mouse1_DOUBLE_CLICKED Mouse1_TRIPLE_CLICKED Mouse2_PRESSED Mouse2_RELEASED Mouse2_CLICKED Mouse2_DOUBLE_CLICKED Mouse2_TRIPLE_CLICKED Mouse3_PRESSED Mouse3_RELEASED Mouse3_CLICKED Mouse3_DOUBLE_CLICKED Mouse3_TRIPLE_CLICKED Mouse4_PRESSED Mouse4_RELEASED Mouse4_CLICKED Mouse4_DOUBLE_CLICKED Mouse4_TRIPLE_CLICKED )
const ( Right int = iota Up Left Down DownRight DownLeft UpRight UpLeft PgUp PgDown Start End )
Variables ¶
var Colors = [256]FontFace{
{Fg: termColorDefault, Bg: termColorDefault},
{Fg: termColorBlack, Bg: termColorBlack}, {Fg: termColorRed, Bg: termColorBlack}, {Fg: termColorGreen, Bg: termColorBlack}, {Fg: termColorYellow, Bg: termColorBlack}, {Fg: termColorBlue, Bg: termColorBlack}, {Fg: termColorMagenta, Bg: termColorBlack}, {Fg: termColorCyan, Bg: termColorBlack}, {Fg: termColorWhite, Bg: termColorBlack},
{Fg: termColorBlack, Bg: termColorRed}, {Fg: termColorRed, Bg: termColorRed}, {Fg: termColorGreen, Bg: termColorRed}, {Fg: termColorYellow, Bg: termColorRed}, {Fg: termColorBlue, Bg: termColorRed}, {Fg: termColorMagenta, Bg: termColorRed}, {Fg: termColorCyan, Bg: termColorRed}, {Fg: termColorWhite, Bg: termColorRed},
{Fg: termColorBlack, Bg: termColorGreen}, {Fg: termColorRed, Bg: termColorGreen}, {Fg: termColorGreen, Bg: termColorGreen}, {Fg: termColorYellow, Bg: termColorGreen}, {Fg: termColorBlue, Bg: termColorGreen}, {Fg: termColorMagenta, Bg: termColorGreen}, {Fg: termColorCyan, Bg: termColorGreen}, {Fg: termColorWhite, Bg: termColorGreen},
{Fg: termColorBlack, Bg: termColorYellow}, {Fg: termColorRed, Bg: termColorYellow}, {Fg: termColorGreen, Bg: termColorYellow}, {Fg: termColorYellow, Bg: termColorYellow}, {Fg: termColorBlue, Bg: termColorYellow}, {Fg: termColorMagenta, Bg: termColorYellow}, {Fg: termColorCyan, Bg: termColorYellow}, {Fg: termColorWhite, Bg: termColorYellow},
{Fg: termColorBlack, Bg: termColorBlue}, {Fg: termColorRed, Bg: termColorBlue}, {Fg: termColorGreen, Bg: termColorBlue}, {Fg: termColorYellow, Bg: termColorBlue}, {Fg: termColorBlue, Bg: termColorBlue}, {Fg: termColorMagenta, Bg: termColorBlue}, {Fg: termColorCyan, Bg: termColorBlue}, {Fg: termColorWhite, Bg: termColorBlue},
{Fg: termColorBlack, Bg: termColorMagenta}, {Fg: termColorRed, Bg: termColorMagenta}, {Fg: termColorGreen, Bg: termColorMagenta}, {Fg: termColorYellow, Bg: termColorMagenta}, {Fg: termColorBlue, Bg: termColorMagenta}, {Fg: termColorMagenta, Bg: termColorMagenta}, {Fg: termColorCyan, Bg: termColorMagenta}, {Fg: termColorWhite, Bg: termColorMagenta},
{Fg: termColorBlack, Bg: termColorCyan}, {Fg: termColorRed, Bg: termColorCyan}, {Fg: termColorGreen, Bg: termColorCyan}, {Fg: termColorYellow, Bg: termColorCyan}, {Fg: termColorBlue, Bg: termColorCyan}, {Fg: termColorMagenta, Bg: termColorCyan}, {Fg: termColorCyan, Bg: termColorCyan}, {Fg: termColorWhite, Bg: termColorCyan},
{Fg: termColorBlack, Bg: termColorWhite}, {Fg: termColorRed, Bg: termColorWhite}, {Fg: termColorGreen, Bg: termColorWhite}, {Fg: termColorYellow, Bg: termColorWhite}, {Fg: termColorBlue, Bg: termColorWhite}, {Fg: termColorMagenta, Bg: termColorWhite}, {Fg: termColorCyan, Bg: termColorWhite}, {Fg: termColorWhite, Bg: termColorWhite},
}
var ErrTooLarge = errors.New("Cells.CellBuffer: too large")
ErrTooLarge is passed to panic if memory cannot be allocated to store data in a buffer.
Functions ¶
func SetFontFace ¶
func ToCustomU64 ¶
Types ¶
type Cell ¶
func StrToCells ¶
type CellBuffer ¶
type CellBuffer struct {
// contains filtered or unexported fields
}
A Buffer is a variable-sized buffer of Cell with Read and Write methods. The zero value for Buffer is an empty buffer ready to use.
func (*CellBuffer) Cap ¶
func (b *CellBuffer) Cap() int
Cap returns the capacity of the buffer's underlying byte slice, that is, the total space allocated for the buffer's data.
func (*CellBuffer) Data ¶
func (b *CellBuffer) Data() []Cell
Bytes returns a slice of length b.Len() holding the unread portion of the buffer. The slice is valid for use only until the next buffer modification (that is, only until the next call to a method like Read, Write, Reset, or Truncate). The slice aliases the buffer content at least until the next buffer modification, so immediate changes to the slice will affect the result of future reads.
func (*CellBuffer) Grow ¶
func (b *CellBuffer) Grow(n int)
Grow grows the buffer's capacity, if necessary, to guarantee space for another n bytes. After Grow(n), at least n bytes can be written to the buffer without another allocation. If n is negative, Grow will panic. If the buffer can't grow it will panic with ErrTooLarge.
func (*CellBuffer) Len ¶
func (b *CellBuffer) Len() int
Len returns the number of bytes of the unread portion of the buffer; b.Len() == len(b.Bytes()).
func (*CellBuffer) Next ¶
func (b *CellBuffer) Next(n int) []Cell
Next returns a slice containing the next n bytes from the buffer, advancing the buffer as if the bytes had been returned by Read. If there are fewer than n bytes in the buffer, Next returns the entire buffer. The slice is only valid until the next call to a read or write method.
func (*CellBuffer) ReadFrom ¶
func (b *CellBuffer) ReadFrom(r CellBuffer) (n int, err error)
func (*CellBuffer) Reset ¶
func (b *CellBuffer) Reset()
Reset resets the buffer to be empty, but it retains the underlying storage for use by future writes. Reset is the same as Truncate(0).
func (*CellBuffer) SetFace ¶
func (b *CellBuffer) SetFace(face uint64)
func (*CellBuffer) String ¶
func (b *CellBuffer) String() (str string)
String returns the contents of the unread portion of the buffer as a string. If the CellBuffer is a nil pointer, it returns "<nil>".
func (*CellBuffer) Truncate ¶
func (b *CellBuffer) Truncate(n int)
Truncate discards all but the first n unread bytes from the buffer but continues to use the same allocated storage. It panics if n is negative or greater than the length of the buffer.
func (*CellBuffer) Write ¶
func (b *CellBuffer) Write(p []Cell) (n int, err error)
Write appends the contents of p to the buffer, growing the buffer as needed. The return value n is the length of p; err is always nil. If the buffer becomes too large, Write will panic with ErrTooLarge.
func (*CellBuffer) WriteRune ¶
func (b *CellBuffer) WriteRune(r rune) error
func (*CellBuffer) WriteString ¶
func (b *CellBuffer) WriteString(s string) (n int, err error)
WriteString appends the contents of s to the buffer, growing the buffer as needed. The return value n is the length of s; err is always nil. If the buffer becomes too large, WriteString will panic with ErrTooLarge.
func (*CellBuffer) WriteU64 ¶
func (b *CellBuffer) WriteU64(u uint64) error
type Pad ¶
type Pad struct { Buffer [][]Cell Curs Gps Frame Gps Color uint8 Attrs uint8 AutoFill bool Screen *Window // contains filtered or unexported fields }
func (*Pad) AddCenterCells ¶
func (*Pad) AddLeftCells ¶
func (*Pad) AddPreCells ¶
func (*Pad) AddRightCells ¶
func (*Pad) GetDefaultCell ¶
func (*Pad) StrToCells ¶
type Window ¶
type Window struct {
Height, Width int // maximums of x and y, NOT window size
CurY, CurX int // current cursor position
InitY, InitX int // screen coords of upper-left-hand corner
Color uint8
Attrs uint8
BGChar rune // current background char
Buffer [][]Cell
Looper bool
Scroll bool
Touch bool
Echo bool
Curs bool
Delay bool
Resize bool
}
func (*Window) GetDefaultCell ¶
func (*Window) StrToCells ¶
func (*Window) ValidPos ¶
int getmouse(MEVENT *event); void getparyx(WINDOW *win, int y, int x); int getstr(char *str); int getnstr(char *str, int n); int halfdelay(int tenths); bool has_colors(void); int hline(chtype ch, int n); void idcok(WINDOW *win, bool bf); void immedok(WINDOW *win, bool bf); chtype inch(void); chtype winch(WINDOW *win); chtype mvinch(int y, int x); chtype mvwinch(WINDOW *win, int y, int x); bool mouse_trafo(int* pY, int* pX, bool to_screen); bool wmouse_trafo(const WINDOW* win, int* pY, int* pX, bool to_screen); int notimeout(WINDOW *win, bool bf); int overlay(const WINDOW *srcwin, WINDOW *dstwin); int raw(void); int noraw(void); int ungetch(int ch); int untouchwin(WINDOW *win); int vline(chtype ch, int n);