components

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const EMPTY_CELL = 0
View Source
const EMPTY_NOTIFICATION = " "
View Source
const MIN_WIDTH = 80
View Source
const NOTIFICATION_MIN_DURATION_IN_SECONDS = 5

Notifications will be cleared upon the first interaction after NOTIFICATION_MIN_DURATION_IN_SECONDS seconds

View Source
const PASSWORD_FIELD_LENGTH = 8

Variables

This section is empty.

Functions

This section is empty.

Types

type AutoComplete

type AutoComplete struct {
	Focusable
	views.BoxLayout
	// contains filtered or unexported fields
}

func NewAutoComplete

func NewAutoComplete(options AutoCompleteOptions) *AutoComplete

func (*AutoComplete) HasFocus

func (ac *AutoComplete) HasFocus() bool

func (*AutoComplete) OnFocus

func (ac *AutoComplete) OnFocus(cb func() bool) func()

func (*AutoComplete) SetFocus

func (ac *AutoComplete) SetFocus(on bool)

type AutoCompleteOptions

type AutoCompleteOptions struct {
	Screen     tcell.Screen
	Entries    []string
	TotalCount int
	MaxX       int
	MaxY       int

	OnSelect func(entry string) bool
	OnFocus  func() bool
}

type Container

type Container struct {
	Orientation views.Orientation

	views.BoxLayout
	// contains filtered or unexported fields
}

func NewContainer

func NewContainer(screen tcell.Screen) *Container

func (*Container) AddWidget

func (c *Container) AddWidget()

func (*Container) Draw

func (c *Container) Draw()

func (*Container) InsertWidget

func (c *Container) InsertWidget()

func (*Container) RemoveWidget

func (c *Container) RemoveWidget()

func (*Container) SetContent

func (c *Container) SetContent(w views.Widget)

type Field

type Field struct {
	Focusable
	views.BoxLayout
	// contains filtered or unexported fields
}

func NewField

func NewField(options *FieldOptions) *Field

func (*Field) GetContent

func (f *Field) GetContent() string

func (*Field) GetInputType

func (f *Field) GetInputType() InputType

func (*Field) HandleEvent

func (f *Field) HandleEvent(ev tcell.Event) bool

func (*Field) HasFocus

func (f *Field) HasFocus() bool

func (*Field) OnFocus

func (f *Field) OnFocus(cb func() bool) func()

func (*Field) OnKeyPress

func (f *Field) OnKeyPress(cb func(ev *tcell.EventKey) bool) func()

func (*Field) SetFocus

func (f *Field) SetFocus(on bool)

func (*Field) SetInputType

func (f *Field) SetInputType(t InputType)

type FieldOptions

type FieldOptions struct {
	Label        string
	InitialValue string
	InputType    InputType
}

type Focusable

type Focusable interface {
	SetFocus(on bool)
	HasFocus() bool
}

type Form

type Form struct {
	WithFocusables
}

func NewForm

func NewForm() *Form

type Input

type Input struct {
	Focusable
	views.CellView
	// contains filtered or unexported fields
}

func NewInput

func NewInput(options *InputOptions) *Input

func (*Input) GetContent

func (i *Input) GetContent() string

func (*Input) GetInputType

func (i *Input) GetInputType() InputType

func (*Input) HandleEvent

func (i *Input) HandleEvent(ev tcell.Event) bool

func (*Input) HasFocus

func (i *Input) HasFocus() bool

func (*Input) Init

func (i *Input) Init()

func (*Input) OnChange

func (i *Input) OnChange(cb func(ev tcell.Event) bool) func()

func (*Input) OnFocus

func (i *Input) OnFocus(cb func() bool) func()

func (*Input) OnKeyPress

func (i *Input) OnKeyPress(cb func(ev *tcell.EventKey) bool) func()

func (*Input) SetContent

func (i *Input) SetContent(text string)

func (*Input) SetFocus

func (i *Input) SetFocus(on bool)

func (*Input) SetInputType

func (i *Input) SetInputType(t InputType)

type InputOptions

type InputOptions struct {
	InitialValue string
	Type         InputType
}

type InputType

type InputType int
const (
	InputTypeText InputType = iota
	InputTypePassword
)

type Status

type Status struct {
	views.BoxLayout
	// contains filtered or unexported fields
}

func NewStatus

func NewStatus() *Status

func (*Status) Confirm

func (s *Status) Confirm(message string, onAccept func(), onReject func())

func (*Status) Notify

func (s *Status) Notify(st string)

type Text

type Text struct {
	views.CellView
	// contains filtered or unexported fields
}

func NewText

func NewText(screen tcell.Screen, pad int) *Text

func (*Text) HandleEvent

func (t *Text) HandleEvent(ev tcell.Event) bool

func (*Text) Init

func (t *Text) Init(pad int)

func (*Text) SetContent

func (t *Text) SetContent(content string)

type Title

type Title struct {
	views.TextBar
}

func NewTitle

func NewTitle(database string) *Title

func (*Title) SetTitle

func (t *Title) SetTitle(s string)

type WithFocusables

type WithFocusables struct {
	views.BoxLayout
}

func (*WithFocusables) Focusables

func (wf *WithFocusables) Focusables() []Focusable

Returns the subset of Widgets that can have focus

func (*WithFocusables) HandleEvent

func (wf *WithFocusables) HandleEvent(ev tcell.Event) bool

func (*WithFocusables) MoveFocus

func (wf *WithFocusables) MoveFocus(offset int)

Moves focus by `offset` focusables

Jump to

Keyboard shortcuts

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