gui

package
v0.0.0-...-f747631 Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2021 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const LINE_NO_MIN_SPACE = 1000
View Source
const NEW_LINE = "\n"

Variables

This section is empty.

Functions

func Loop

func Loop(evPS *pubsub.PubSub)

func SprintFunctions

func SprintFunctions(fs []GuiFunction) []string

func SprintLevels

func SprintLevels(levels []GuiLevel) []string

Types

type CharField

type CharField struct {
	ui.Block
	Text       string
	TextColor  ui.Attribute
	WrapLength int
	Alignment  ui.Align
	PaddingTop int
}

func NewCharField

func NewCharField(s string) *CharField

func (*CharField) Buffer

func (d *CharField) Buffer() ui.Buffer

type EvtInput

type EvtInput struct {
	KeyStr         string
	LineText       string
	CursorPosition int
	LineIndex      int
}

EvtInput defines the structure for the /input/* events. The event contains the last keystroke, the full text for the current line, and the position of the cursor in the current line as well as the index of the current line in the full text of the input

type GuiFunction

type GuiFunction struct {
	Label   string
	Set     bool
	SetOnly bool
}

type GuiLevel

type GuiLevel struct {
	Label   string
	Value   float32
	SetOnly bool
}

type Input

type Input struct {
	ui.Block
	TextFgColor  ui.Attribute
	TextBgColor  ui.Attribute
	IsCapturing  bool
	IsMultiLine  bool
	TextBuilder  ui.TextBuilder
	SpecialChars map[string]string
	ShowLineNo   bool
	Name         string
	CursorX      int
	CursorY      int
	// contains filtered or unexported fields
}

Input is the main object for a text input. The object exposes the following public properties: TextFgColor: color for the text. TextBgColor: background color for the text box. IsCapturing: true if the input is currently capturing keyboard events, this is controlled by the StartCapture and

StopCapture methods.

IsMultiline: Whether we should accept multiple lines of input or this is a singe line form field. TextBuilder: An implementation of the TextBuilder interface to customize the look of the text on the screen. SpecialChars: a map[string]string of characters from the /sys/kbd events to actual strings in the content. Name: When specified, the Input uses its name to propagate events, for example /input/<name>/kbd.

func NewInput

func NewInput(s string, isMultiLine bool) *Input

NewInput returns a new, initialized Input object. The method receives the initial content for the input (if any) and whether it should be initialized as a multi-line innput field or not

func (*Input) Buffer

func (i *Input) Buffer() ui.Buffer

Buffer implements Bufferer interface.

func (*Input) Clear

func (i *Input) Clear()

func (*Input) Lines

func (i *Input) Lines() []string

Lines returns the slice of strings with the content of the input field. By default lines are separated by \n

func (*Input) SetText

func (i *Input) SetText(text string)

func (*Input) StartCapture

func (i *Input) StartCapture()

StartCapture begins catching events from the /sys/kbd stream and updates the content of the Input field. While capturing events, the Input field also publishes its own event stream under the /input/kbd path.

func (*Input) StopCapture

func (i *Input) StopCapture()

StopCapture tells the Input field to stop accepting events from the /sys/kbd stream

func (*Input) Text

func (i *Input) Text() string

Text returns the text of the input field as a string

Jump to

Keyboard shortcuts

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