overlay

package
v1.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 9, 2022 License: MIT Imports: 4 Imported by: 4

Documentation

Overview

Package overlay is a widget that allows one widget to be overlaid on another.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Render

func Render(w IOverlay, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

func UserInput

func UserInput(w IOverlay, ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

Types

type Bottom

type Bottom struct{}

type IIgnoreLowerStyle added in v1.4.0

type IIgnoreLowerStyle interface {
	IgnoreLowerStyle() bool
}

type IOverlay

type IOverlay interface {
	Top() gowid.IWidget
	Bottom() gowid.IWidget
	VAlign() gowid.IVAlignment
	Height() gowid.IWidgetDimension
	HAlign() gowid.IHAlignment
	Width() gowid.IWidgetDimension
	BottomGetsFocus() bool
	TopGetsFocus() bool
	BottomGetsCursor() bool
}

type IWidget

type IWidget interface {
	gowid.IWidget
	IOverlay
}

type IWidgetSettable

type IWidgetSettable interface {
	IWidget
	SetTop(gowid.IWidget, gowid.IApp)
	SetBottom(gowid.IWidget, gowid.IApp)
	SetVAlign(gowid.IVAlignment, gowid.IApp)
	SetHeight(gowid.IWidgetDimension, gowid.IApp)
	SetHAlign(gowid.IHAlignment, gowid.IApp)
	SetWidth(gowid.IWidgetDimension, gowid.IApp)
}

type MouseCheckerWidget

type MouseCheckerWidget struct {
	gowid.IWidget
	ClickWasInBounds func()
}

Utility widget, used only to determine if a user input mouse event is within the bounds of a widget. This is different from whether or not a widget handles an event. In the case of overlay, an overlaid widget may not handle a mouse event, but if it occludes the widget underneath, that lower widget should not accept the mouse event (since it ought to be hidden). So the callback is expected to set a flag in the composite overlay widget to say the click was within bounds of the upper layer.

func NewMouseChecker

func NewMouseChecker(inner gowid.IWidget, clickWasInBounds func()) *MouseCheckerWidget

func (*MouseCheckerWidget) SetSubWidget

func (w *MouseCheckerWidget) SetSubWidget(inner gowid.IWidget, app gowid.IApp)

func (*MouseCheckerWidget) SubWidget

func (w *MouseCheckerWidget) SubWidget() gowid.IWidget

func (*MouseCheckerWidget) SubWidgetSize

func (w *MouseCheckerWidget) SubWidgetSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderSize

func (*MouseCheckerWidget) UserInput

func (w *MouseCheckerWidget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

type Options

type Options struct {
	BottomGetsFocus  bool
	TopGetsNoFocus   bool
	BottomGetsCursor bool
	IgnoreLowerStyle bool
}

type Top

type Top struct{}

For callback registration

type Widget

type Widget struct {
	Callbacks *gowid.Callbacks
	// contains filtered or unexported fields
}

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

func New(top, bottom gowid.IWidget,
	valign gowid.IVAlignment, height gowid.IWidgetDimension,
	halign gowid.IHAlignment, width gowid.IWidgetDimension,
	opts ...Options) *Widget

func (*Widget) Bottom

func (w *Widget) Bottom() gowid.IWidget

func (*Widget) BottomGetsCursor

func (w *Widget) BottomGetsCursor() bool

func (*Widget) BottomGetsFocus

func (w *Widget) BottomGetsFocus() bool

func (*Widget) HAlign

func (w *Widget) HAlign() gowid.IHAlignment

func (*Widget) Height

func (w *Widget) Height() gowid.IWidgetDimension

func (*Widget) IgnoreLowerStyle added in v1.4.0

func (w *Widget) IgnoreLowerStyle() bool

func (*Widget) Render

func (w *Widget) Render(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.ICanvas

func (*Widget) RenderSize

func (w *Widget) RenderSize(size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) gowid.IRenderBox

func (*Widget) Selectable

func (w *Widget) Selectable() bool

func (*Widget) SetBottom

func (w *Widget) SetBottom(w2 gowid.IWidget, app gowid.IApp)

func (*Widget) SetHAlign

func (w *Widget) SetHAlign(halign gowid.IHAlignment, app gowid.IApp)

func (*Widget) SetHeight

func (w *Widget) SetHeight(height gowid.IWidgetDimension, app gowid.IApp)

func (*Widget) SetSubWidget added in v1.1.0

func (w *Widget) SetSubWidget(inner gowid.IWidget, app gowid.IApp)

func (*Widget) SetTop

func (w *Widget) SetTop(w2 gowid.IWidget, app gowid.IApp)

func (*Widget) SetVAlign

func (w *Widget) SetVAlign(valign gowid.IVAlignment, app gowid.IApp)

func (*Widget) SetWidth

func (w *Widget) SetWidth(width gowid.IWidgetDimension, app gowid.IApp)

func (*Widget) String

func (w *Widget) String() string

func (*Widget) SubWidget added in v1.1.0

func (w *Widget) SubWidget() gowid.IWidget

func (*Widget) Top

func (w *Widget) Top() gowid.IWidget

func (*Widget) TopGetsFocus

func (w *Widget) TopGetsFocus() bool

func (*Widget) UserInput

func (w *Widget) UserInput(ev interface{}, size gowid.IRenderSize, focus gowid.Selector, app gowid.IApp) bool

func (*Widget) VAlign

func (w *Widget) VAlign() gowid.IVAlignment

func (*Widget) Width

func (w *Widget) Width() gowid.IWidgetDimension

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL