Documentation ¶
Index ¶
- type BaseItem
- func (I *BaseItem) Decode(map[string]any) (widget.Widget, error)
- func (I *BaseItem) Encode() (ItemContext, error)
- func (I *BaseItem) Handle(context map[string]any) (handled bool, err error)
- func (I *BaseItem) Id() string
- func (I *BaseItem) Name() string
- func (I *BaseItem) Parent() *Panel
- func (I *BaseItem) Rebuild() error
- func (I *BaseItem) SetName(name string)
- func (I *BaseItem) SetParent(parent *Panel)
- func (I *BaseItem) SetWidget(w widget.Widget)
- func (I *BaseItem) Widget() widget.Widget
- type Factory
- type ItemContext
- type ItemCreator
- type Panel
- func (I *Panel) Decode(map[string]any) (widget.Widget, error)
- func (P *Panel) Encode() (map[string]any, error)
- func (P *Panel) FlipFlexDirection()
- func (P *Panel) Focus(delegate func(p tview.Primitive))
- func (P *Panel) GetItemById(id string) tview.Primitive
- func (P *Panel) GetItemByName(name string) tview.Primitive
- func (P *Panel) GetMostFocusedPanel() *Panel
- func (P *Panel) GetMostFocusedParent() *Panel
- func (P *Panel) GetParent() *Panel
- func (P *Panel) Id() string
- func (P *Panel) Mount(context map[string]any) error
- func (P *Panel) Name() string
- func (P *Panel) RangeItems(fn func(PanelItem))
- func (P *Panel) Refresh(context map[string]any) error
- func (P *Panel) SetDirection(d int)
- func (P *Panel) SetName(name string)
- func (P *Panel) SetParent(parent *Panel)
- func (P *Panel) SetShowBordersR(showPanel, showOther bool)
- func (P *Panel) TitleString() string
- func (P *Panel) TypeName() string
- func (P *Panel) Unmount() error
- type PanelItem
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseItem ¶
type BaseItem struct { // base item should be a frame with settings for // - the header dropdown // - parent/widget // - save/load *tview.Frame // contains filtered or unexported fields }
BaseItem can be used as a starting point for your custom PanelItems. It wraps a Widget in some metadata and a tview.Frame
func NewBaseItem ¶
func (*BaseItem) Encode ¶
func (I *BaseItem) Encode() (ItemContext, error)
func (*BaseItem) Handle ¶
this is how you can pass data built up in top-level pages, commands, and keybindings and then modify or rebuild the component locally, you decide how to refresh
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
I hope this doesn't trigger you :] It is a default helper for creating interesting CUE widgets and quick actions for them note, you should always add a "default" key, as this is used in panel when CRUD'n items/nested panels
func NewFactory ¶
func NewFactory() *Factory
func (*Factory) Creator ¶
func (F *Factory) Creator(context ItemContext, parent *Panel) (PanelItem, error)
func (*Factory) Register ¶
func (F *Factory) Register(itemKey string, creator ItemCreator)
type ItemContext ¶
the context format is determined by the user of Panel you will need to construct this from user input and then process it in items Panel will handle moving it to the right Item, or use the ItemCreator to make a new one
type ItemCreator ¶
type ItemCreator func(context ItemContext, parent *Panel) (PanelItem, error)
This is a function that builds a new PanelItem from an ItemContext
type Panel ¶
func New ¶
func New(parent *Panel, creator ItemCreator) *Panel
func PanelDecodeMap ¶
func (*Panel) FlipFlexDirection ¶
func (P *Panel) FlipFlexDirection()
func (*Panel) GetMostFocusedPanel ¶
func (*Panel) GetMostFocusedParent ¶
func (*Panel) RangeItems ¶
func (*Panel) SetDirection ¶
func (*Panel) SetShowBordersR ¶
func (*Panel) TitleString ¶
type PanelItem ¶
type PanelItem interface { tview.Primitive // some functions we need to add to primitive SetBorder(show bool) *tview.Box SetTitle(title string) *tview.Box // some metadata Name() string SetName(string) Parent() *Panel SetParent(*Panel) Widget() widget.Widget SetWidget(widget.Widget) // this is how you can pass data built up in top-level pages, commands, and keybindings // and then modify or rebuild the component locally, you decide how to refresh Handle(context map[string]any) (handled bool, err error) // should rebuild the item from the current or latest context Rebuild() error // Encode should turn the PanelItem into ItemContext. // It should contain enough detail to rebuild the item // after serialization to JSON and back. Encode() (ItemContext, error) }