Documentation ¶
Index ¶
- type Attributes
- type Button
- func (b *Button) AddHandler(key Key, handler Handler) *Button
- func (b *Button) AddHandlerOnly(key Key, handler Handler)
- func (b *Button) Close()
- func (b *Button) Draw()
- func (b *Button) Focus()
- func (b *Button) GetLabel() string
- func (b *Button) GetPosition() *Position
- func (b *Button) GetType() ComponentType
- func (b *Button) SetHilightColor(fgColor, bgColor gocui.Attribute) *Button
- func (b *Button) SetTextColor(fgColor, bgColor gocui.Attribute) *Button
- func (b *Button) UnFocus()
- type CheckBox
- func (c *CheckBox) AddAttribute(textColor, textBgColor gocui.Attribute) *CheckBox
- func (c *CheckBox) AddHandler(key Key, handler Handler) *CheckBox
- func (c *CheckBox) AddHandlerOnly(key Key, handler Handler)
- func (c *CheckBox) Check(g *gocui.Gui, v *gocui.View) error
- func (c *CheckBox) Close()
- func (c *CheckBox) Draw()
- func (c *CheckBox) Focus()
- func (c *CheckBox) GetLabel() string
- func (c *CheckBox) GetPosition() *Position
- func (c *CheckBox) GetType() ComponentType
- func (c *CheckBox) IsChecked() bool
- func (c *CheckBox) UnFocus()
- type Component
- type ComponentType
- type Field
- type Form
- func (f *Form) AddButton(label string, handler Handler) *Button
- func (f *Form) AddCheckBox(label string, width int) *CheckBox
- func (f *Form) AddCloseFunc(function func() error)
- func (f *Form) AddInputField(label string, labelWidth, fieldWidth int) *InputField
- func (f *Form) AddRadio(label string, width int) *Radio
- func (f *Form) AddSelect(label string, labelWidth, listWidth int) *Select
- func (f *Form) Close(g *gocui.Gui, v *gocui.View) error
- func (f *Form) Draw()
- func (f *Form) GetButtons() []*Button
- func (f *Form) GetCheckBoxState(target string) bool
- func (f *Form) GetCheckBoxStates() map[string]bool
- func (f *Form) GetCheckBoxs() []*CheckBox
- func (f *Form) GetCurrentItem() int
- func (f *Form) GetFieldText(target string) string
- func (f *Form) GetFieldTexts() map[string]string
- func (f *Form) GetFormData() *FormData
- func (f *Form) GetInputs() []*InputField
- func (f *Form) GetItems() []Component
- func (f *Form) GetRadioText() string
- func (f *Form) GetRadios() []*Radio
- func (f *Form) GetSelectedOpt(target string) string
- func (f *Form) GetSelectedOpts() map[string]string
- func (f *Form) GetSelectedRadio(target string) string
- func (f *Form) GetSelectedRadios() map[string]string
- func (f *Form) GetSelects() []*Select
- func (f *Form) NextItem(g *gocui.Gui, v *gocui.View) error
- func (f *Form) PreItem(g *gocui.Gui, v *gocui.View) error
- func (f *Form) SetCurrentItem(index int) *Form
- func (f *Form) Validate() bool
- type FormData
- type Handler
- type Handlers
- type InputField
- func (i *InputField) AddFieldAttribute(textColor, textBgColor, fgColor, bgColor gocui.Attribute) *InputField
- func (i *InputField) AddHandler(key Key, handler Handler) *InputField
- func (i *InputField) AddHandlerOnly(key Key, handler Handler)
- func (i *InputField) AddLabelAttribute(textColor, textBgColor gocui.Attribute) *InputField
- func (i *InputField) AddMarginLeft(left int) *InputField
- func (i *InputField) AddMarginTop(top int) *InputField
- func (i *InputField) AddValidate(errMsg string, validate func(value string) bool) *InputField
- func (i *InputField) Close()
- func (i *InputField) Draw()
- func (i *InputField) Edit(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier)
- func (i *InputField) Focus()
- func (i *InputField) GetFieldText() string
- func (i *InputField) GetLabel() string
- func (i *InputField) GetPosition() *Position
- func (i *InputField) GetType() ComponentType
- func (i *InputField) IsValid() bool
- func (i *InputField) SetCursor(b bool) *InputField
- func (i *InputField) SetEditable(b bool) *InputField
- func (i *InputField) SetFieldBorder() *InputField
- func (i *InputField) SetLabelBorder() *InputField
- func (i *InputField) SetMask() *InputField
- func (i *InputField) SetMaskKeybinding(key Key) *InputField
- func (i *InputField) SetText(text string) *InputField
- func (i *InputField) UnFocus()
- func (i *InputField) Validate() bool
- type Key
- type Label
- type Margin
- type Modal
- type Mode
- type Position
- type Radio
- func (r *Radio) AddHandler(key Key, handler Handler) *Radio
- func (r *Radio) AddHandlerOnly(key Key, handler Handler)
- func (r *Radio) AddOption(name string) *Radio
- func (r *Radio) AddOptions(names ...string) *Radio
- func (r *Radio) Check(g *gocui.Gui, v *gocui.View) error
- func (r *Radio) Close()
- func (r *Radio) Draw()
- func (r *Radio) Focus()
- func (r *Radio) GetLabel() string
- func (r *Radio) GetPosition() *Position
- func (r *Radio) GetSelected() string
- func (r *Radio) GetType() ComponentType
- func (r *Radio) IsChecked() bool
- func (r *Radio) SetMode(mode Mode) *Radio
- func (r *Radio) UnFocus()
- type Select
- func (s *Select) AddAttribute(textColor, textBgColor, fgColor, bgColor gocui.Attribute) *Select
- func (s *Select) AddListHandler(key Key, handler Handler) *Select
- func (s *Select) AddOption(opt string) *Select
- func (s *Select) AddOptions(opts ...string) *Select
- func (s *Select) Close()
- func (s *Select) Draw()
- func (s *Select) Focus()
- func (s *Select) GetSelected() string
- func (s *Select) GetType() ComponentType
- func (s *Select) UnFocus()
- type Validate
- type Validator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes struct {
// contains filtered or unexported fields
}
Attributes text and hilight color
type Button ¶
type Button struct { *gocui.Gui *Position *Attributes // contains filtered or unexported fields }
Button button struct
func (*Button) AddHandler ¶
AddHandler add handler
func (*Button) AddHandlerOnly ¶
func (*Button) GetPosition ¶
GetPosition get button position
func (*Button) SetHilightColor ¶
SetHilightColor add button fg and bg color
func (*Button) SetTextColor ¶
SetTextColor add button fg and bg color
type CheckBox ¶
type CheckBox struct { *gocui.Gui *Position *Attributes // contains filtered or unexported fields }
CheckBox struct
func NewCheckBox ¶
NewCheckBox new checkbox
func (*CheckBox) AddAttribute ¶
AddAttribute add text and bg color
func (*CheckBox) AddHandler ¶
AddHandler add handler
func (*CheckBox) AddHandlerOnly ¶
AddHandlerOnly add handler not retrun
func (*CheckBox) GetPosition ¶
GetPosition get checkbox position
type Component ¶
type Component interface { GetLabel() string GetPosition() *Position GetType() ComponentType Focus() UnFocus() Draw() Close() AddHandlerOnly(Key, Handler) }
Component form component interface
type ComponentType ¶
type ComponentType int
ComponentType component type
const ( // TypeInputField type is input component TypeInputField ComponentType = iota // TypeSelect type is select component TypeSelect // TypeButton type is button component TypeButton // TypeCheckBox type is checkbox component TypeCheckBox // TypeRadio type is radio component TypeRadio // TypeTable type is table component TypeTable )
type Field ¶
type Field struct { *Position *Attributes *Validator // contains filtered or unexported fields }
Field struct
type Form ¶
Form form struct
func (*Form) AddCheckBox ¶
AddCheckBox add checkbox
func (*Form) AddCloseFunc ¶
AddCloseFunc add close function
func (*Form) AddInputField ¶
func (f *Form) AddInputField(label string, labelWidth, fieldWidth int) *InputField
AddInputField add input field to form
func (*Form) GetCheckBoxState ¶
GetCheckBoxState get checkbox states
func (*Form) GetCheckBoxStates ¶
GetCheckBoxStates get checkbox states
func (*Form) GetCurrentItem ¶
GetCurrentItem get current item index
func (*Form) GetFieldText ¶
GetFieldText get form data with field name
func (*Form) GetFieldTexts ¶
GetFieldTexts form data
func (*Form) GetSelectedOpt ¶
GetSelectedOpt get selected options
func (*Form) GetSelectedOpts ¶
GetSelectedOpts get selected options
func (*Form) GetSelectedRadio ¶
GetSelectedRadio get selected radio
func (*Form) GetSelectedRadios ¶
GetSelectedRadios get selected radio
func (*Form) SetCurrentItem ¶
SetCurrentItem set current item index
type FormData ¶
type FormData struct {
// contains filtered or unexported fields
}
FormData form data struct
type InputField ¶
InputField struct
func NewInputField ¶
func NewInputField(gui *gocui.Gui, labelText string, x, y, labelWidth, fieldWidth int) *InputField
NewInputField new input label and field
func (*InputField) AddFieldAttribute ¶
func (i *InputField) AddFieldAttribute(textColor, textBgColor, fgColor, bgColor gocui.Attribute) *InputField
AddFieldAttribute add field colors
func (*InputField) AddHandler ¶
func (i *InputField) AddHandler(key Key, handler Handler) *InputField
AddHandler add keybinding
func (*InputField) AddHandlerOnly ¶
func (i *InputField) AddHandlerOnly(key Key, handler Handler)
AddHandlerOnly add handler not return
func (*InputField) AddLabelAttribute ¶
func (i *InputField) AddLabelAttribute(textColor, textBgColor gocui.Attribute) *InputField
AddLabelAttribute add label colors
func (*InputField) AddMarginLeft ¶
func (i *InputField) AddMarginLeft(left int) *InputField
AddMarginLeft add margin left
func (*InputField) AddMarginTop ¶
func (i *InputField) AddMarginTop(top int) *InputField
AddMarginTop add margin top
func (*InputField) AddValidate ¶
func (i *InputField) AddValidate(errMsg string, validate func(value string) bool) *InputField
AddValidate add input validator
func (*InputField) GetFieldText ¶
func (i *InputField) GetFieldText() string
GetFieldText get input field text
func (*InputField) GetPosition ¶
func (i *InputField) GetPosition() *Position
GetPosition get input field position
func (*InputField) GetType ¶
func (i *InputField) GetType() ComponentType
GetType get component type
func (*InputField) IsValid ¶
func (i *InputField) IsValid() bool
IsValid valid field data will be return true
func (*InputField) SetCursor ¶
func (i *InputField) SetCursor(b bool) *InputField
SetCursor set input field cursor
func (*InputField) SetEditable ¶
func (i *InputField) SetEditable(b bool) *InputField
SetEditable if editmode is true can input
func (*InputField) SetFieldBorder ¶
func (i *InputField) SetFieldBorder() *InputField
SetFieldBorder draw field border
func (*InputField) SetLabelBorder ¶
func (i *InputField) SetLabelBorder() *InputField
SetLabelBorder draw label border
func (*InputField) SetMask ¶
func (i *InputField) SetMask() *InputField
SetMask set input field to mask '*'
func (*InputField) SetMaskKeybinding ¶
func (i *InputField) SetMaskKeybinding(key Key) *InputField
SetMaskKeybinding set or unset input field to mask '*' with key
type Label ¶
type Label struct { *Position *Attributes // contains filtered or unexported fields }
Label struct
type Modal ¶
type Modal struct { *gocui.Gui *Attributes *Position // contains filtered or unexported fields }
Modal struct
type Radio ¶
type Radio struct { *gocui.Gui *Position *Attributes // contains filtered or unexported fields }
Radio struct
func (*Radio) AddHandler ¶
AddHandler add handler
func (*Radio) AddHandlerOnly ¶
AddHandlerOnly add handler only
func (*Radio) AddOptions ¶
AddOptions add options
type Select ¶
type Select struct { *InputField // contains filtered or unexported fields }
Select struct
func (*Select) AddAttribute ¶
AddAttribute add select attribute
func (*Select) AddListHandler ¶
AddListHandler add list handler
func (*Select) AddOptions ¶
AddOptions add select options
type Validator ¶
Validator validate struct
func NewValidator ¶
NewValidator new validator
func (*Validator) AddValidate ¶
AddValidate add validate
func (*Validator) CloseValidateMsg ¶
func (v *Validator) CloseValidateMsg()
CloseValidateMsg close validate error message
func (*Validator) DispValidateMsg ¶
func (v *Validator) DispValidateMsg()
DispValidateMsg display validate error message