tui

package module
v0.0.0-...-99b2d43 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

README

tui — Go Terminal UI Framework

EXPERIMENTAL This framework is in a very early stage of active development. There are no guarantees of stability or backwards compatibility whatsoever.

tui is based on the excellent https://github.com/jroimartin/gocui which is in turn based on the also excellent https://github.com/nsf/termbox-go

The goal of tui is to be easy to use and to get started with. As development continues, I hope to make many useful and simple to use widgets/components available.

Preview

preview of tui

Run the above example yourself:

go run ./example/main.go

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Logger *log.Logger

Functions

This section is empty.

Types

type CheckList

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

func NewCheckList

func NewCheckList(items []string) *CheckList

func (*CheckList) DeFocus

func (v *CheckList) DeFocus()

func (*CheckList) Focus

func (v *CheckList) Focus()

func (*CheckList) ID

func (v *CheckList) ID() string

func (*CheckList) Parent

func (v *CheckList) Parent() View

func (*CheckList) SetOnCheckChangedListener

func (cl *CheckList) SetOnCheckChangedListener(listener OnCheckChangedListener)

type Container

type Container struct {
	Views  []View
	Border bool
	// contains filtered or unexported fields
}

func NewHorizontalContainer

func NewHorizontalContainer() *Container

func NewVerticalContainer

func NewVerticalContainer() *Container

func (*Container) Add

func (c *Container) Add(views ...View)

func (*Container) DeFocus

func (v *Container) DeFocus()

func (*Container) Focus

func (v *Container) Focus()

func (*Container) ID

func (c *Container) ID() string

func (*Container) Parent

func (c *Container) Parent() View
type Modal struct {
	// contains filtered or unexported fields
}

func NewModal

func NewModal(title string, w int, child View) *Modal

func (*Modal) Hide

func (m *Modal) Hide()

type OnCheckChangedListener

type OnCheckChangedListener func(cl *CheckList, item string, index int, checked bool)

type OnRadioChangedListener

type OnRadioChangedListener func(cl *RadioList, item string, index int, checked bool)

type Paragraph

type Paragraph struct {
	AutoScroll          bool
	DisableLineWrapping bool
	// contains filtered or unexported fields
}

func NewParagraph

func NewParagraph() *Paragraph

func (*Paragraph) Append

func (p *Paragraph) Append(text string)

func (*Paragraph) AppendLine

func (p *Paragraph) AppendLine(text string)

func (*Paragraph) DeFocus

func (v *Paragraph) DeFocus()

func (*Paragraph) Focus

func (v *Paragraph) Focus()

func (*Paragraph) ID

func (p *Paragraph) ID() string

func (*Paragraph) NewLine

func (p *Paragraph) NewLine()

func (*Paragraph) Parent

func (v *Paragraph) Parent() View

func (*Paragraph) SetText

func (p *Paragraph) SetText(text string)

type RadioList

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

func NewRadioList

func NewRadioList(items []string) *RadioList

func (*RadioList) DeFocus

func (v *RadioList) DeFocus()

func (*RadioList) Focus

func (v *RadioList) Focus()

func (*RadioList) ID

func (v *RadioList) ID() string

func (*RadioList) Parent

func (v *RadioList) Parent() View

func (*RadioList) SetOnRadioChangedListener

func (rl *RadioList) SetOnRadioChangedListener(listener OnRadioChangedListener)

type UI

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

func New

func New() (*UI, error)

func (*UI) Close

func (ui *UI) Close()

func (*UI) HideModal

func (ui *UI) HideModal()

func (*UI) Quit

func (ui *UI) Quit()

func (*UI) Redraw

func (ui *UI) Redraw()

func (*UI) ReleaseFocus

func (ui *UI) ReleaseFocus()

func (*UI) Run

func (ui *UI) Run() error

func (*UI) SetDefaultFocus

func (ui *UI) SetDefaultFocus(v View)

func (*UI) SetRoot

func (ui *UI) SetRoot(v View)

func (*UI) ShowModal

func (ui *UI) ShowModal(m *Modal)

type View

type View interface {
	ID() string
	Parent() View
	Focus()
	DeFocus()
	// contains filtered or unexported methods
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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