framed

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package framed provides a widget that draws a frame around an inner widget.

Index

Constants

This section is empty.

Variables

View Source
var (
	AsciiFrame       = FrameRunes{'-', '-', '-', '-', '-', '-', '|', '|'}
	UnicodeFrame     = FrameRunes{'┏', '┓', '┗', '┛', '━', '━', '┃', '┃'}
	UnicodeAltFrame  = FrameRunes{'▛', '▜', '▙', '▟', '▀', '▄', '▌', '▐'}
	UnicodeAlt2Frame = FrameRunes{'╔', '╗', '╚', '╝', '═', '═', '║', '║'}
	SpaceFrame       = FrameRunes{' ', ' ', ' ', ' ', ' ', ' ', ' ', ' '}
)

Functions

func Render

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

func RenderSize

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

func SubWidgetSize

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

func UserInput

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

Types

type FrameIfSelectedForCopy

type FrameIfSelectedForCopy struct{}

func (FrameIfSelectedForCopy) AlterWidget

func (r FrameIfSelectedForCopy) AlterWidget(w gowid.IWidget, app gowid.IApp) gowid.IWidget

type FrameRunes

type FrameRunes struct {
	Tl, Tr, Bl, Br rune
	T, B, L, R     rune
}

type IFramed

type IFramed interface {
	Opts() Options
}

type IWidget

type IWidget interface {
	gowid.ICompositeWidget
	IFramed
}

type Options

type Options struct {
	Frame       FrameRunes
	Title       string
	TitleWidget gowid.IWidget
	Style       gowid.ICellStyler
}

type Title

type Title struct{}

For callback identification

type Widget

type Widget struct {
	gowid.IWidget // Embed for Selectable method
	Params        Options
	*gowid.Callbacks
	gowid.SubWidgetCallbacks
}

func New

func New(inner gowid.IWidget, opts ...Options) *Widget

func NewSpace

func NewSpace(inner gowid.IWidget) *Widget

func NewUnicode

func NewUnicode(inner gowid.IWidget) *Widget

func NewUnicodeAlt

func NewUnicodeAlt(inner gowid.IWidget) *Widget

func NewUnicodeAlt2

func NewUnicodeAlt2(inner gowid.IWidget) *Widget

func (*Widget) GetTitle

func (w *Widget) GetTitle() string

func (*Widget) GetTitleWidget

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

func (*Widget) OnSetTitle

func (w *Widget) OnSetTitle(f gowid.IWidgetChangedCallback)

func (*Widget) Opts

func (w *Widget) Opts() Options

func (*Widget) RemoveOnSetAlign

func (w *Widget) RemoveOnSetAlign(f gowid.IIdentity)

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) SetSubWidget

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

func (*Widget) SetTitle

func (w *Widget) SetTitle(title string, app gowid.IApp)

Call from Render thread

func (*Widget) SetTitleWidget

func (w *Widget) SetTitleWidget(widget gowid.IWidget, app gowid.IApp)

func (*Widget) String

func (w *Widget) String() string

func (*Widget) SubWidget

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

func (*Widget) SubWidgetSize

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

func (*Widget) UserInput

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

Jump to

Keyboard shortcuts

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