Documentation ¶
Index ¶
- Constants
- Variables
- func AsKey(evt *tcell.EventKey) tcell.Key
- func GetInputValues[T AvailableInputTypes](input InputFace, sep string) ([]T, error)
- func GetInputValuesByType[T AvailableInputTypes](input InputFace, sep string, Type ...T) ([]T, error)
- func LayoutWithAlign(align int) layoutOptions
- func LayoutWithBorder() layoutOptions
- func LayoutWithTitle(title string) layoutOptions
- func NewColumns(cols ...GridItems) *tview.Flex
- func NewRows(rows ...GridItems) *tview.Flex
- func SetInputValues[T AvailableInputTypes](input InputFace, values ...T) error
- type ActionHandler
- type App
- type AvailableInputTypes
- type ButtonHandlerFunc
- type GridItems
- type Input
- type InputFace
- type InputOPtions
- type KeyAction
- type KeyActions
- func (a *KeyActions) Add(k tcell.Key, ka KeyAction)
- func (a *KeyActions) AddActions(aa *KeyActions)
- func (a *KeyActions) Bulk(aa KeyMap)
- func (a *KeyActions) Clear()
- func (a *KeyActions) Delete(kk ...tcell.Key)
- func (a *KeyActions) Get(key tcell.Key) (KeyAction, bool)
- func (a *KeyActions) GetActions() *KeyActions
- func (a *KeyActions) HasAction(key tcell.Key) (KeyAction, bool)
- func (a *KeyActions) Len() int
- func (a *KeyActions) Merge(aa *KeyActions)
- func (a *KeyActions) Range(f RangeFn)
- func (a *KeyActions) Reset(aa *KeyActions)
- func (a *KeyActions) Set(aa *KeyActions)
- type KeyMap
- type Layout
- type LayoutParams
- type Modal
- type ModalOptions
- type NextPrimitive
- type Pages
- type Panel
- type PanelOption
- type Primitive
- type PrimitiveName
- type RangeFn
Constants ¶
const ( Key0 tcell.Key = iota + 48 Key1 Key2 Key3 Key4 Key5 Key6 Key7 Key8 Key9 )
Defines numeric keys for container actions.
const ( KeyShift0 tcell.Key = 41 KeyShift1 tcell.Key = 33 KeyShift2 tcell.Key = 64 KeyShift3 tcell.Key = 35 KeyShift4 tcell.Key = 36 KeyShift5 tcell.Key = 37 KeyShift6 tcell.Key = 94 KeyShift7 tcell.Key = 38 KeyShift8 tcell.Key = 42 KeyShift9 tcell.Key = 40 )
Defines numeric keys for container actions.
const ( KeyA tcell.Key = iota + 97 KeyB KeyC KeyD KeyE KeyF KeyG KeyH KeyI KeyJ KeyK KeyL KeyM KeyN KeyO KeyP KeyQ KeyR KeyS KeyT KeyU KeyV KeyW KeyX KeyY KeyZ KeyHelp = 63 KeySlash = 47 KeyColon = 58 KeySpace = 32 )
Defines char keystrokes.
const ( KeyShiftA tcell.Key = iota + 65 KeyShiftB KeyShiftC KeyShiftD KeyShiftE KeyShiftF KeyShiftG KeyShiftH KeyShiftI KeyShiftJ KeyShiftK KeyShiftL KeyShiftM KeyShiftN KeyShiftO KeyShiftP KeyShiftQ KeyShiftR KeyShiftS KeyShiftT KeyShiftU KeyShiftV KeyShiftW KeyShiftX KeyShiftY KeyShiftZ )
Define Shift Keys.
Variables ¶
var NumKeys = map[int]tcell.Key{ 0: Key0, 1: Key1, 2: Key2, 3: Key3, 4: Key4, 5: Key5, 6: Key6, 7: Key7, 8: Key8, 9: Key9, }
NumKeys tracks number keys.
Functions ¶
func GetInputValues ¶
func GetInputValues[T AvailableInputTypes](input InputFace, sep string) ([]T, error)
GetInputValues - get values from inputs separated by character
func GetInputValuesByType ¶
func GetInputValuesByType[T AvailableInputTypes](input InputFace, sep string, Type ...T) ([]T, error)
GetInputValuesByType - get values from inputs using auto instantiation
func LayoutWithAlign ¶
func LayoutWithAlign(align int) layoutOptions
LayoutWithAlign - set align for layout
func LayoutWithBorder ¶
func LayoutWithBorder() layoutOptions
LayoutWithBorder - set border for layout
func LayoutWithTitle ¶
func LayoutWithTitle(title string) layoutOptions
LayoutWithTitle - set title for layout
func SetInputValues ¶
func SetInputValues[T AvailableInputTypes](input InputFace, values ...T) error
SetInputValues - set values into input field
Types ¶
type ActionHandler ¶
type ActionHandler func(*tcell.EventKey) *tcell.EventKey
ActionHandler handles a keyboard command.
type App ¶
type App struct { *tview.Application *KeyActions Page *Pages }
App represents an application.
func (*App) QueueUpdateDraw ¶
func (a *App) QueueUpdateDraw(f func())
QueueUpdateDraw queues up a ui action and redraw the ui.
type AvailableInputTypes ¶
type ButtonHandlerFunc ¶
type Input ¶
type Input[T AvailableInputTypes] struct { *tview.InputField PrimitiveName }
func NewInput ¶
func NewInput[T AvailableInputTypes](opt InputOPtions) *Input[T]
NewInput - create new input object of type
func NewInputByType ¶
func NewInputByType[T AvailableInputTypes](opt InputOPtions, Type ...T) *Input[T]
NewInputByType - create new input object using auto instantiation
func (*Input[T]) GetInputValues ¶
GetInputValues - get values from inputs separated by character
func (*Input[T]) SetInputValues ¶
func (i *Input[T]) SetInputValues(values ...T)
type InputFace ¶
type InputFace interface { Primitive SetText(text string) *tview.InputField GetText() string }
type InputOPtions ¶
type KeyAction ¶
type KeyAction struct { Description string Action ActionHandler }
KeyAction represents a keyboard action.
func NewKeyActionWithOpts ¶
func NewKeyActionWithOpts(d string, a ActionHandler) KeyAction
NewKeyActionWithOpts returns a new keyboard action.
type KeyActions ¶
type KeyActions struct {
// contains filtered or unexported fields
}
KeyActions tracks mappings between keystrokes and actions.
func NewKeyActionsFromMap ¶
func NewKeyActionsFromMap(mm KeyMap) *KeyActions
NewKeyActionsFromMap construct actions from key map.
func (*KeyActions) Add ¶
func (a *KeyActions) Add(k tcell.Key, ka KeyAction)
Add adds a new key action.
func (*KeyActions) AddActions ¶
func (a *KeyActions) AddActions(aa *KeyActions)
AddActions returns the application actions.
func (*KeyActions) Delete ¶
func (a *KeyActions) Delete(kk ...tcell.Key)
Delete deletes actions by the given keys.
func (*KeyActions) Get ¶
func (a *KeyActions) Get(key tcell.Key) (KeyAction, bool)
Get fetches an action given a key.
func (*KeyActions) GetActions ¶
func (a *KeyActions) GetActions() *KeyActions
GetActions returns a collection of actions.
func (*KeyActions) HasAction ¶
func (a *KeyActions) HasAction(key tcell.Key) (KeyAction, bool)
HasAction checks if key matches a registered binding.
func (*KeyActions) Merge ¶
func (a *KeyActions) Merge(aa *KeyActions)
Merge merges given actions into existing set.
func (*KeyActions) Range ¶
func (a *KeyActions) Range(f RangeFn)
Range ranges over all actions and triggers a given function.
func (*KeyActions) Set ¶
func (a *KeyActions) Set(aa *KeyActions)
Set replace actions with new ones.
type Layout ¶
type Layout struct { *tview.Flex *KeyActions PrimitiveName }
type Modal ¶
type Modal struct { *tview.Modal PrimitiveName }
func NewModalWindow ¶
func NewModalWindow(opt ModalOptions) *Modal
type ModalOptions ¶
type ModalOptions struct { Name string Description string Title string ButtonsNames []string ButtonAction ButtonHandlerFunc }
type NextPrimitive ¶
type NextPrimitive func() Primitive
Primitive represents a UI primitive.
func NewNextPrimitive ¶
func NewNextPrimitive(primitives ...Primitive) NextPrimitive
NextPrimitive - circular loop through primitives
type Panel ¶
type Panel struct { *tview.TextView *KeyActions CacheLine cacheLine PrimitiveName // contains filtered or unexported fields }