termutil

package module
v0.0.0-...-d0d954b Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2015 License: MIT Imports: 5 Imported by: 0

README

termutil GoDoc

Extension of the package http://github.com/nsf/termbox-go.

Adds ability to easily create and interact with several windows.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func End

func End()

func Focus

func Focus(w *Window)

func Init

func Init(timeout time.Duration) error

func Quit

func Quit()

func Run

func Run() (err error)

Types

type Body

type Body struct {
	Data   [][]string
	Active int

	Fg termbox.Attribute
	Bg termbox.Attribute

	// Colors for the active row
	FgActive termbox.Attribute
	BgActive termbox.Attribute
}

type Cell

type Cell struct {
	C  rune
	Fg termbox.Attribute
	Bg termbox.Attribute
}

type EventFunc

type EventFunc func(termbox.Event)
type Header struct {
	Titles []HeaderTitle

	Fg termbox.Attribute
	Bg termbox.Attribute

	// Colors for the active tab
	FgActive termbox.Attribute
	BgActive termbox.Attribute

	Active   int
	IsActive bool // Is a tab activated
}

type HeaderTitle

type HeaderTitle struct {
	Name string
	// Percentage of size
	// When equal to 0, it takes the bigger space available
	Per int
}

type MainWindow

type MainWindow struct {
	Fg, Bg termbox.Attribute

	EventFunc EventFunc // global event function
	// contains filtered or unexported fields
}

MainWindow controls all windows inside it.

var Screen *MainWindow

type Row

type Row []Cell

func StringToRow

func StringToRow(s string, fg, bg termbox.Attribute) Row

func StringsToRows

func StringsToRows(s []string, fg, bg termbox.Attribute) []Row

type UpdateFunc

type UpdateFunc func() []Row

type Widget

type Widget interface {
	Update(*Window) []string
}

type WidgetTable

type WidgetTable struct {
	Header *Header
	Body   *Body
}

func (*WidgetTable) EventFunc

func (wg *WidgetTable) EventFunc(ev termbox.Event)

func (*WidgetTable) Update

func (wg *WidgetTable) Update(win *Window) []Row

type Window

type Window struct {
	X, Y         int
	SizeX, SizeY int
	// AutoResize does not allow a fix SizeX and SizeY
	AutoResize bool

	UpdateFunc UpdateFunc
	EventFunc  EventFunc

	SubWindows []*Window
	// contains filtered or unexported fields
}

func NewWindow

func NewWindow() *Window

func (*Window) AbsX

func (w *Window) AbsX() int

func (*Window) AbsY

func (w *Window) AbsY() int

func (*Window) NewSubWindow

func (w *Window) NewSubWindow() *Window

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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