Documentation ¶
Overview ¶
Package menu is a widget that presents a drop-down menu.
Index ¶
- Variables
- func OpenSimple(open bool, mu *Widget, site ISite, app gowid.IApp) bool
- func Render(w IWidget, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas
- func UserInput(w IWidget, ev interface{}, size gowid.IRenderSize, focus gowid.Selector, ...) bool
- type AutoCloserWidget
- type CachedOverlay
- type CachedWidget
- type IOpener
- type ISite
- type ISiteName
- type IWidget
- type NavWrapperWidget
- type OpenerFunc
- type Options
- type SiteOptions
- type SiteWidget
- type Widget
- func (w *Widget) AutoClose() bool
- func (w *Widget) Close(app gowid.IApp)
- func (w *Widget) CloseImpl(app gowid.IApp)
- func (w *Widget) CloseKeys() []gowid.IKey
- func (w *Widget) Height() gowid.IWidgetDimension
- func (w *Widget) IgnoreKeys() []gowid.IKey
- func (w *Widget) IsOpen() bool
- func (w *Widget) Name() string
- func (w *Widget) Open(site ISite, app gowid.IApp)
- func (w *Widget) OpenImpl(site ISite, app gowid.IApp)
- func (w *Widget) Overlay() overlay.IWidgetSettable
- func (w *Widget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas
- func (w *Widget) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox
- func (w *Widget) Selectable() bool
- func (w *Widget) SetAutoClose(autoClose bool, app gowid.IApp)
- func (w *Widget) SetHeight(width gowid.IWidgetDimension, app gowid.IApp)
- func (w *Widget) SetSubWidget(widget gowid.IWidget, app gowid.IApp)
- func (w *Widget) SetWidth(width gowid.IWidgetDimension, app gowid.IApp)
- func (w *Widget) String() string
- func (w *Widget) SubWidget() gowid.IWidget
- func (w *Widget) SubWidgetSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderSize
- func (w *Widget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool
- func (w *Widget) Width() gowid.IWidgetDimension
Constants ¶
This section is empty.
Variables ¶
var ( DefaultIgnoreKeys = []gowid.IKey{ gowid.MakeKeyExt(tcell.KeyLeft), gowid.MakeKeyExt(tcell.KeyRight), gowid.MakeKeyExt(tcell.KeyUp), gowid.MakeKeyExt(tcell.KeyDown), } DefaultCloseKeys = []gowid.IKey{ gowid.MakeKeyExt(tcell.KeyLeft), gowid.MakeKeyExt(tcell.KeyEscape), } )
Functions ¶
func OpenSimple ¶ added in v1.3.0
Types ¶
type AutoCloserWidget ¶
AutoCloserWidget is used to detect if a given menu is open when a widget responds to user input. Then some action can be taken after that user input (e.g. closing the menu)
func (*AutoCloserWidget) UserInput ¶
func (w *AutoCloserWidget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool
type CachedOverlay ¶
func (*CachedOverlay) Bottom ¶
func (w *CachedOverlay) Bottom() gowid.IWidget
type CachedWidget ¶
type IWidget ¶
type IWidget interface { gowid.ICompositeWidget Overlay() overlay.IWidgetSettable Open(ISite, gowid.IApp) Close(gowid.IApp) IsOpen() bool CloseKeys() []gowid.IKey // Keys that should close the current submenu (e.g. left arrow) IgnoreKeys() []gowid.IKey // Keys that shouldn't close submenu but should be passed back to main app AutoClose() bool SetAutoClose(bool, gowid.IApp) Width() gowid.IWidgetDimension SetWidth(gowid.IWidgetDimension, gowid.IApp) Name() string }
type NavWrapperWidget ¶
type NavWrapperWidget struct { // contains filtered or unexported fields }
NavWrapperWidget is used to detect if a given menu is open when a widget responds to user input. Then some action can be taken after that user input (e.g. closing the menu)
func (*NavWrapperWidget) UserInput ¶
func (w *NavWrapperWidget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool
type OpenerFunc ¶ added in v1.3.0
Return false if it was already open
type SiteOptions ¶
type SiteWidget ¶
type SiteWidget struct { gowid.IWidget Options SiteOptions }
SiteWidget is a zero-width widget which acts as the coordinates at which a submenu will open
func NewSite ¶
func NewSite(opts ...SiteOptions) *SiteWidget
func (*SiteWidget) Namer ¶
func (w *SiteWidget) Namer() ISiteName
func (*SiteWidget) Render ¶
func (w *SiteWidget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas
func (*SiteWidget) Selectable ¶
func (w *SiteWidget) Selectable() bool
func (*SiteWidget) String ¶
func (w *SiteWidget) String() string
type Widget ¶
Widget overlays one widget on top of another. The bottom widget is rendered without the focus at full size. The bottom widget is rendered between a horizontal and vertical padding widget set up with the sizes provided.
func New ¶
New takes a widget, rather than a menu model, so that I can potentially style the menu. TODO - consider adding styling to menu model?
func (*Widget) Height ¶ added in v1.3.0
func (w *Widget) Height() gowid.IWidgetDimension
func (*Widget) IgnoreKeys ¶
func (*Widget) Overlay ¶
func (w *Widget) Overlay() overlay.IWidgetSettable
func (*Widget) RenderSize ¶
func (w *Widget) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox
func (*Widget) Selectable ¶
func (*Widget) SetHeight ¶ added in v1.3.0
func (w *Widget) SetHeight(width gowid.IWidgetDimension, app gowid.IApp)
func (*Widget) SubWidgetSize ¶
func (w *Widget) SubWidgetSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderSize
func (*Widget) Width ¶
func (w *Widget) Width() gowid.IWidgetDimension