box

package
v0.0.0-...-2c82300 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 4, 2017 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LineEmpty        LineType = 0
	LineSingleBorder          = 1 << iota
	LineDoubleBorder
)

Variables

View Source
var BorderTheme = map[uint]*BorderDefinitions{
	uint(LineEmpty):        &BorderDefinitions{hc: ' ', vc: ' ', luc: ' ', ruc: ' ', lbc: ' ', rbc: ' '},
	uint(LineSingleBorder): &BorderDefinitions{hc: '─', vc: '│', luc: '┌', ruc: '┐', lbc: '└', rbc: '┘'},
	uint(LineDoubleBorder): &BorderDefinitions{hc: '═', vc: '║', luc: '╔', ruc: '╗', lbc: '╚', rbc: '╝'},
}

Functions

This section is empty.

Types

type Align

type Align uint
const (
	AlignNone Align = 0
	AlignLeft Align = 1 << iota
	AlignRight
	AlignHCenter
	AlignTop
	AlignBottom
	AlignVCenter
	AlignCenter = AlignHCenter | AlignVCenter
)

type BorderDefinitions

type BorderDefinitions struct {
	// contains filtered or unexported fields
}

type Frame

type Frame struct {
	*tl.Rectangle

	*BorderDefinitions

	*TextArea
	// contains filtered or unexported fields
}

A type representing a 2D rectangle, with position, size and colof.

func NewFrame

func NewFrame(x, y, w, h int, bgcolor tl.Attr, fgcolor tl.Attr, frametype LineType, signmode bool) *Frame

NewFrame creates a new Rectangle at position (x, y), with size (width, height) and color colof. Returns a pointer to the new NewFrame.

func (*Frame) BgColor

func (f *Frame) BgColor() tl.Attr

Color returns the color of the Rectangle.

func (*Frame) Draw

func (f *Frame) Draw(s *tl.Screen)

Draws the Frame r onto Screen s.

func (*Frame) FgColor

func (f *Frame) FgColor() tl.Attr

func (*Frame) LevelFollow

func (f *Frame) LevelFollow(level *tl.BaseLevel)

Level follow

func (*Frame) Position

func (f *Frame) Position() (int, int)

Position returns the x and y coordinates of the Rectangle.

func (*Frame) SetBgColor

func (f *Frame) SetBgColor(color tl.Attr)

SetColor sets the color of the Rectangle.

func (*Frame) SetFgColor

func (f *Frame) SetFgColor(color tl.Attr)

func (*Frame) SetPosition

func (f *Frame) SetPosition(x, y int)

SetPosition sets the coordinates of the Rectangle to be x and y.

func (*Frame) SetSize

func (f *Frame) SetSize(w, h int)

SetSize sets the width and height of the Rectangle to be w and h.

func (*Frame) SetTitle

func (f *Frame) SetTitle(text string, align Align)

Set Title

func (*Frame) Size

func (f *Frame) Size() (int, int)

Size returns the width and height in characters of the Rectangle.

func (*Frame) Tick

func (f *Frame) Tick(ev tl.Event)

type HLine

type HLine struct {
	*BorderDefinitions
	// contains filtered or unexported fields
}

A type representing a 2D horizontal Line

func NewHLine

func NewHLine(x, y, s int, bgcolor, fgcolor tl.Attr, linetype LineType) *HLine

NewHLine creates a new HLine at position (x, y)

func (*HLine) BgColor

func (l *HLine) BgColor() tl.Attr

Color returns the color of the horizontal line .

func (*HLine) Draw

func (l *HLine) Draw(s *tl.Screen)

Draws the Horizontal line

func (*HLine) FgColor

func (l *HLine) FgColor() tl.Attr

Color returns the color of the horizontal line .

func (*HLine) LevelFollow

func (f *HLine) LevelFollow(level *tl.BaseLevel)

Level Follow

func (*HLine) Position

func (l *HLine) Position() (int, int)

Position returns the x and y coordinates of the horizontal line.

func (*HLine) SetBGColor

func (l *HLine) SetBGColor(color tl.Attr)

SetBGColor set the background color of the horizontal line .

func (*HLine) SetFGColor

func (l *HLine) SetFGColor(color tl.Attr)

SetFGColor set the background color of the horizontal line .

func (*HLine) SetPosition

func (l *HLine) SetPosition(x, y int)

SetPosition sets the coordinates of the horizontal line to be x and y.

func (*HLine) SetSize

func (l *HLine) SetSize(w, h int)

SetSize sets the width and height of the horizontal line to be w and h.

func (*HLine) Size

func (l *HLine) Size() int

Return size of horizontal line

func (*HLine) Tick

func (l *HLine) Tick(ev tl.Event)

type LineType

type LineType uint

type TextArea

type TextArea struct {
	// contains filtered or unexported fields
}

A type representing a Text with Area dimension

func NewTextArea

func NewTextArea(x, y, w, h int, text string, bgcolor, fgcolor tl.Attr, align Align) *TextArea

NewTextArea creates a new TextArea

func (*TextArea) Color

func (t *TextArea) Color() (tl.Attr, tl.Attr)

Color returns the color of the TextArea.

func (*TextArea) Draw

func (t *TextArea) Draw(s *tl.Screen)

Draws the TextArea r onto Screen s.

func (*TextArea) LevelFollow

func (f *TextArea) LevelFollow(level *tl.BaseLevel)

Level Follow

func (*TextArea) Position

func (t *TextArea) Position() (int, int)

Position returns the x and y coordinates of the TextArea.

func (*TextArea) SetAlign

func (t *TextArea) SetAlign(align Align)

SetPosition sets the coordinates of the TextArea to be x and y.

func (*TextArea) SetColor

func (t *TextArea) SetColor(bg, fg tl.Attr)

func (*TextArea) SetPosition

func (t *TextArea) SetPosition(x, y int)

SetPosition sets the coordinates of the TextArea to be x and y.

func (*TextArea) SetText

func (t *TextArea) SetText(text string, align Align)

Set Text

func (*TextArea) SetTypewriterDuration

func (t *TextArea) SetTypewriterDuration(typewriterduration int64)

Set typewriter speed

func (*TextArea) Size

func (t *TextArea) Size() (int, int)

Size returns the width and height in characters of the TextArea.

func (*TextArea) Tick

func (t *TextArea) Tick(ev tl.Event)

type VLine

type VLine struct {
	*BorderDefinitions
	// contains filtered or unexported fields
}

func NewVLine

func NewVLine(x, y, s int, bgcolor, fgcolor tl.Attr, linetype LineType) *VLine

NewVLine creates a new VLine at position (x, y)

func (*VLine) BgColor

func (l *VLine) BgColor() tl.Attr

Color returns the color of the horizontal line .

func (*VLine) Draw

func (l *VLine) Draw(s *tl.Screen)

Draws the Horizontal line

func (*VLine) FgColor

func (l *VLine) FgColor() tl.Attr

Color returns the color of the horizontal line .

func (*VLine) LevelFollow

func (f *VLine) LevelFollow(level *tl.BaseLevel)

Level Follow

func (*VLine) Position

func (l *VLine) Position() (int, int)

Position returns the x and y coordinates of the horizontal line.

func (*VLine) SetBGColor

func (l *VLine) SetBGColor(color tl.Attr)

SetBGColor set the background color of the horizontal line .

func (*VLine) SetFGColor

func (l *VLine) SetFGColor(color tl.Attr)

SetFGColor set the background color of the horizontal line .

func (*VLine) SetPosition

func (l *VLine) SetPosition(x, y int)

SetPosition sets the coordinates of the horizontal line to be x and y.

func (*VLine) SetWidth

func (l *VLine) SetWidth(w, h int)

SetSize sets the height and height of the horizontal line to be w and h.

func (*VLine) Size

func (l *VLine) Size() int

Return size of vertical line

func (*VLine) Tick

func (l *VLine) Tick(ev tl.Event)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL