tgui

package module
v0.0.0-...-249496f Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2018 License: MIT Imports: 5 Imported by: 0

README

tgui

Text Go User Interface

A terminal based user interface written in Go

To install:

go get github.com/herth/tgui

To build the sample dt Application:

go install github.com/herth/tgui/dt

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Clock

func Clock(s tcell.Screen)

func DrawBorder

func DrawBorder(s tcell.Screen, b Box, style tcell.Style)

func DrawBox

func DrawBox(s tcell.Screen, b Box, r rune, style tcell.Style)

func EventHandle

func EventHandle(app *App)

func Print

func Print(s tcell.Screen, x, y int, text string, st tcell.Style)

print the text to the (x,y) coordinates of the screen.

func PrintM

func PrintM(s tcell.Screen, x, y int, maxX int, text string, st tcell.Style)

Print the text up to a maximum X coordinate.

Types

type App

type App struct {
	MB     *MenuBar
	Screen tcell.Screen

	Background  tcell.Style
	RuneHandler func(r rune)
	KeyHandler  func(k tcell.Key)
	// contains filtered or unexported fields
}

func (*App) AddWindow

func (a *App) AddWindow(w Window)

func (*App) ButtonEvent

func (app *App) ButtonEvent(nr, x, y int)

func (*App) Drag

func (app *App) Drag(px, py, x, y int)

handle a pressed mouse move from pxy to xy

func (*App) Draw

func (a *App) Draw()

func (*App) FindWin

func (app *App) FindWin(x, y int) Window

func (*App) MMove

func (app *App) MMove(x, y int)

func (*App) NewTextWin

func (a *App) NewTextWin(title string, x, y, w, h int, text string, st tcell.Style) *TextWin

func (*App) Quit

func (a *App) Quit()

func (*App) Raise

func (app *App) Raise(w Window)

type Box

type Box struct {
	X0, Y0, X1, Y1 int
}

func (Box) Inside

func (b Box) Inside(x, y int) bool

type DecoratedWin

type DecoratedWin struct {
	SimpleWin
	Title string
}

func (*DecoratedWin) Draw

func (w *DecoratedWin) Draw()
type Menu struct {
	Name string
	X    int
	Y    int
	W    int
	// contains filtered or unexported fields
}
type MenuBar struct {
	Screen tcell.Screen
	// contains filtered or unexported fields
}
func (m *MenuBar) AddMenu(menu Menu)
func (m *MenuBar) Draw()

type SimpleWin

type SimpleWin struct {
	*App
	Box
	Fill  rune
	Style tcell.Style
}

func (*SimpleWin) Click

func (w *SimpleWin) Click(x, y int)

func (*SimpleWin) Draw

func (w *SimpleWin) Draw()

func (*SimpleWin) GetBox

func (w *SimpleWin) GetBox() Box

func (*SimpleWin) MMove

func (w *SimpleWin) MMove(x, y int)

func (*SimpleWin) SetBox

func (w *SimpleWin) SetBox(b Box)

func (*SimpleWin) Size

func (w *SimpleWin) Size() (int, int)

type TextWin

type TextWin struct {
	DecoratedWin
	Text string
	Tail bool
}

func (*TextWin) Draw

func (w *TextWin) Draw()

func (*TextWin) Write

func (w *TextWin) Write(b []byte) (n int, err error)

type Window

type Window interface {
	Draw()
	Size() (w int, h int)
	GetBox() Box
	SetBox(b Box)
	Click(x, y int)
	MMove(x, y int)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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