diff options
Diffstat (limited to 'pkg/gui/types/context.go')
-rw-r--r-- | pkg/gui/types/context.go | 52 |
1 files changed, 28 insertions, 24 deletions
diff --git a/pkg/gui/types/context.go b/pkg/gui/types/context.go index 7b9f47001..2f59b15f5 100644 --- a/pkg/gui/types/context.go +++ b/pkg/gui/types/context.go @@ -24,6 +24,7 @@ type ParentContexter interface { } type IBaseContext interface { + HasKeybindings ParentContexter GetKind() ContextKind @@ -35,9 +36,7 @@ type IBaseContext interface { GetOptionsMap() map[string]string - GetKeybindings(opts KeybindingsOpts) []*Binding AddKeybindingsFn(KeybindingsFn) - GetMouseKeybindings(opts KeybindingsOpts) []*gocui.ViewMouseBinding AddMouseKeybindingsFn(MouseKeybindingsFn) } @@ -50,6 +49,33 @@ type Context interface { HandleRenderToMain() error } +type IListContext interface { + Context + + GetSelectedItemId() string + + GetList() IList + + OnSearchSelect(selectedLineIdx int) error + FocusLine() + + GetPanelState() IListPanelState + GetViewTrait() IViewTrait +} + +type IViewTrait interface { + FocusPoint(yIdx int) + SetViewPortContent(content string) + SetContent(content string) + SetFooter(value string) + SetOriginX(value int) + ViewPortYBounds() (int, int) + ScrollLeft() + ScrollRight() + PageDelta() int + SelectedLineIdx() int +} + type OnFocusOpts struct { ClickedViewName string ClickedViewLineIdx int @@ -76,28 +102,6 @@ type IController interface { Context() Context } -type IListContext interface { - HasKeybindings - - GetSelectedItemId() string - HandlePrevLine() error - HandleNextLine() error - HandleScrollLeft() error - HandleScrollRight() error - HandlePrevPage() error - HandleNextPage() error - HandleGotoTop() error - HandleGotoBottom() error - HandleClick(onClick func() error) error - - OnSearchSelect(selectedLineIdx int) error - FocusLine() - - GetPanelState() IListPanelState - - Context -} - type IList interface { IListCursor GetItemsLength() int |