ui

package
v0.0.0-...-a8a18e3 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2024 License: Unlicense Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action interface{}

type Button

type Button struct {
	Caption string
	Click   func(form *Form)
}

func (*Button) Focusable

func (button *Button) Focusable() bool

func (*Button) Handle

func (button *Button) Handle(form *Form, action Action)

func (*Button) Render

func (button *Button) Render(form *Form, component *Component)

func (*Button) Serialize

func (button *Button) Serialize() ([]byte, error)

func (*Button) Unserialize

func (button *Button) Unserialize(data []byte) error

type Component

type Component struct {
	Rect
	Focused bool
	Widget  Widget
}

type Form

type Form struct {
	BoundsRect Rect
	ClientRect Rect

	Screen *Screen

	Close bool
	Save  bool

	Record Record

	Components   []*Component
	FocusedIndex int
}

func (*Form) DrawBlock

func (form *Form) DrawBlock(r Rect, cell termbox.Cell)

func (*Form) DrawBorder

func (form *Form) DrawBorder(r Rect)

func (*Form) DrawCell

func (form *Form) DrawCell(x, y int, cell termbox.Cell)

func (*Form) DrawFlush

func (form *Form) DrawFlush()

func (*Form) DrawText

func (form *Form) DrawText(r Rect, t string, active bool)

func (*Form) Erase

func (form *Form) Erase()

func (*Form) Handle

func (form *Form) Handle(action Action)

func (*Form) Init

func (form *Form) Init()

func (*Form) Render

func (form *Form) Render()

func (*Form) Show

func (form *Form) Show()

func (*Form) TabFocus

func (form *Form) TabFocus(delta int)

func (*Form) UpdateLayout

func (form *Form) UpdateLayout()

type Input

type Input struct {
	Format string
	Text   string
}

func (*Input) Focusable

func (input *Input) Focusable() bool

func (*Input) Handle

func (input *Input) Handle(form *Form, action Action)

func (*Input) Render

func (input *Input) Render(form *Form, component *Component)

func (*Input) Serialize

func (input *Input) Serialize() ([]byte, error)

func (*Input) Unserialize

func (input *Input) Unserialize(data []byte) error

type KeyPress

type KeyPress struct {
	Char rune
	Key  termbox.Key
}

type Label

type Label struct {
	Caption string
}

func (*Label) Focusable

func (label *Label) Focusable() bool

func (*Label) Handle

func (label *Label) Handle(form *Form, action Action)

func (*Label) Render

func (label *Label) Render(form *Form, component *Component)

func (*Label) Serialize

func (label *Label) Serialize() ([]byte, error)

func (*Label) Unserialize

func (label *Label) Unserialize(data []byte) error

type Record

type Record interface {
	Caption() string

	Load() error
	Save() error
}

type Rect

type Rect struct {
	Left, Top     int
	Width, Height int
}

func (Rect) Bounds

func (r Rect) Bounds() Rect

type Screen

type Screen struct {
	Forms   []*Form
	Actions chan Action
}

func (*Screen) DrawCell

func (screen *Screen) DrawCell(x, y int, cell termbox.Cell)

func (*Screen) DrawFlush

func (screen *Screen) DrawFlush()

func (*Screen) Listen

func (screen *Screen) Listen()

func (*Screen) NewForm

func (screen *Screen) NewForm() *Form

func (*Screen) Pop

func (screen *Screen) Pop()

func (*Screen) Push

func (screen *Screen) Push(form *Form)

func (*Screen) Start

func (screen *Screen) Start()

func (*Screen) Stop

func (screen *Screen) Stop()

type Widget

type Widget interface {
	Focusable() bool
	Handle(screen *Form, action Action)

	Unserialize(data []byte) error
	Serialize() ([]byte, error)

	Render(screen *Form, component *Component)
}

func ReflectLoadWidgets

func ReflectLoadWidgets(record Record) []Widget

Jump to

Keyboard shortcuts

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