cui

package
v0.0.0-...-466bc1a Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2014 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Box map[string]*Boxchars = map[string]*Boxchars{
	"d": &Boxchars{
		tl: '╔',
		tr: '╗',
		bl: '╚',
		br: '╝',
		v:  '║',
		h:  '═',
	},
	"s": &Boxchars{
		tl: '┌',
		tr: '┐',
		bl: '└',
		br: '┘',
		v:  '│',
		h:  '─',
	},
}
View Source
var Box2 map[string]rune = map[string]rune{
	"shadow": '▒',
}
View Source
var WindowStack []*Window

Functions

func End

func End()

Turns off termbox and breaks out of the input loop

func External

func External(name string, arg ...string)
func Navigate(newwin *Window)

Navigates to a new window, completeley erases the window stack in the process

func NewEventBase

func NewEventBase() events

func PauseTermbox

func PauseTermbox(blank bool)

Pauses the UI. Set blank to true to blank the console out (black) Set blank to false to keep the current screen

func PushWindow

func PushWindow(win *Window)

Push Window onto the window stack. This allows showing windows on top of each other and going backwards again. (Like dialog windows)

func ResumeTermbox

func ResumeTermbox()

Resumes the UI from where it left off.

func StartTermbox

func StartTermbox(window *Window) error

Starts with a window and returns instantly.

func StartTermboxBlocking

func StartTermboxBlocking(window *Window) error

Starts with a window and blocks

func StatusLine

func StatusLine(text string)

Unused

Types

type Boxchars

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

type Button

type Button struct {
	Base   Controlbase
	Text   string
	Events events
	Box    *Boxchars
	Shadow bool
}

func NewButton

func NewButton() Button

func NewButtonB

func NewButtonB(base Controlbase, text string) *Button

func (*Button) B

func (b *Button) B() *Controlbase

func (*Button) Draw

func (b *Button) Draw(win *Window)

func (*Button) E

func (b *Button) E() *events

type Checkbox

type Checkbox struct {
	Base Controlbase

	Events     events
	Box        *Boxchars
	Checkgroup *Checkgroup
	Text       string
	// contains filtered or unexported fields
}

func NewCheckbox

func NewCheckbox() *Checkbox

func NewCheckboxB

func NewCheckboxB(base Controlbase, text string) *Checkbox

func (*Checkbox) B

func (b *Checkbox) B() *Controlbase

func (*Checkbox) Checked

func (c *Checkbox) Checked() bool

func (*Checkbox) Draw

func (b *Checkbox) Draw(win *Window)

func (*Checkbox) E

func (b *Checkbox) E() *events

func (*Checkbox) Toggle

func (c *Checkbox) Toggle()

type Checkgroup

type Checkgroup struct {
	Checkboxes []*Checkbox
	Active     *Checkbox
}

func NewCheckgroup

func NewCheckgroup() *Checkgroup

func (*Checkgroup) AddControl

func (c *Checkgroup) AddControl(chk ...*Checkbox)

type Control

type Control interface {
	B() *Controlbase
	Draw(*Window)
}

type Controlbase

type Controlbase struct {
	X      int
	Y      int
	Width  int
	Height int
	Z      int
}

type Event

type Event struct {
	Termbox termbox.Event
	Value   interface{}
	Window  *Window
	Control Control
}

type Eventcontrol

type Eventcontrol interface {
	Control
	E() *events
}

type Label

type Label struct {
	Base       Controlbase
	Text       string
	Pageoffset int
	// contains filtered or unexported fields
}

func NewLabel

func NewLabel() Label

func NewLabelB

func NewLabelB(base Controlbase, text string) *Label

func (*Label) B

func (b *Label) B() *Controlbase

func (*Label) Draw

func (l *Label) Draw(win *Window)

type Listbox

type Listbox struct {
	Base            Controlbase
	Caption         string
	SelectedElement *list.Element
	SelectedIndex   int
	Events          events
	Box             *Boxchars
	Stuff           *list.List
	Shadow          bool
}

func NewListbox

func NewListbox() *Listbox

func NewListboxB

func NewListboxB(base Controlbase, Caption string) *Listbox

func (*Listbox) Add

func (b *Listbox) Add(text string, value interface{})

func (*Listbox) B

func (b *Listbox) B() *Controlbase

func (*Listbox) Draw

func (b *Listbox) Draw(win *Window)

func (*Listbox) E

func (b *Listbox) E() *events

type Listelement

type Listelement struct {
	Text   string
	Value  interface{}
	Parent *Listbox
}

type Textbox

type Textbox struct {
	Base Controlbase
	Text []rune
	Name string

	Events    events
	Box       *Boxchars
	Cursorpos int
	Maskchar  rune
	// contains filtered or unexported fields
}

func NewTextbox

func NewTextbox() *Textbox

func NewTextboxB

func NewTextboxB(base Controlbase, Name string) *Textbox

func (*Textbox) B

func (b *Textbox) B() *Controlbase

func (*Textbox) Draw

func (b *Textbox) Draw(win *Window)

func (*Textbox) E

func (b *Textbox) E() *events

type Window

type Window struct {
	Controls   []Control
	ControlMap map[string]Control

	DisplayControls      []Control
	SelectedControlindex int
	SelectedControl      Control
	Background           termbox.Attribute
	Foreground           termbox.Attribute
	SelectedBackground   termbox.Attribute
	SelectedForeground   termbox.Attribute
	Events               events

	Caption string
	// contains filtered or unexported fields
}
var CurrentWindow *Window

func NewWindow

func NewWindow() *Window

func PopWindow

func PopWindow() *Window

Pops a window from the window stack. Focuses to the next window on the stack

func (*Window) AddControl

func (win *Window) AddControl(c ...Control)

func (*Window) AddDisplayControl

func (win *Window) AddDisplayControl(c ...Control)

func (*Window) ControlSelected

func (win *Window) ControlSelected() bool

func (*Window) Draw

func (win *Window) Draw()

func (*Window) SetBase

func (win *Window) SetBase(c *Controlbase)

func (*Window) SetCell

func (w *Window) SetCell(x, y int, rn rune, fg, bg termbox.Attribute)

Jump to

Keyboard shortcuts

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