dialog

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: 14 Imported by: 5

Documentation

Overview

Package dialog provides a modal dialog widget with support for ok/cancel.

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultBackground = gowid.NewUrwidColor("white")
	DefaultButton     = gowid.NewUrwidColor("dark blue")
	DefaultButtonText = gowid.NewUrwidColor("yellow")
	DefaultText       = gowid.NewUrwidColor("black")
)
View Source
var OkCancel, ExitCancel, CloseOnly, NoButtons []Button

Functions

func Close

func Close(w IWidget, app gowid.IApp)

func Open

func Open(w IOpenExt, container gowid.ISettableComposite, width gowid.IWidgetDimension, app gowid.IApp)

func OpenExt

func OpenExt(w IOpenExt, container gowid.ISettableComposite, width gowid.IWidgetDimension, height gowid.IWidgetDimension, app gowid.IApp)

func UserInput

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

Types

type Button

type Button struct {
	Msg    string
	Action gowid.IWidgetChangedCallback
}
var Quit, Exit, CloseD, Cancel Button

type IMaximizer added in v1.2.0

type IMaximizer interface {
	IsMaxed() bool
	Maximize(gowid.IApp)
	Unmaximize(gowid.IApp)
}

type IModal added in v1.3.0

type IModal interface {
	IsModal() bool
}

type IOpenExt

type IOpenExt interface {
	gowid.IWidget
	SetSavedSubWidget(w gowid.IWidget, app gowid.IApp)
	SetSavedContainer(c gowid.ISettableComposite, app gowid.IApp)
	SetOpen(open bool, app gowid.IApp)
	SetContentWidth(w gowid.IWidgetDimension, app gowid.IApp)
}

type ISwitchFocus added in v1.3.0

type ISwitchFocus interface {
	IsSwitchFocus() bool
	SwitchFocus(gowid.IApp)
}

type IWidget

type IWidget interface {
	gowid.IWidget
	gowid.ISettableComposite // Not ICompositeWidget - no SubWidgetSize
	GetNoFunction() gowid.IWidgetChangedCallback
	EscapeCloses() bool
	IsOpen() bool
	SetOpen(open bool, app gowid.IApp)
	SavedSubWidget() gowid.IWidget
	SetSavedSubWidget(w gowid.IWidget, app gowid.IApp)
	SavedContainer() gowid.ISettableComposite
	SetSavedContainer(c gowid.ISettableComposite, app gowid.IApp)
	Width() gowid.IWidgetDimension
	SetWidth(gowid.IWidgetDimension, gowid.IApp)
	Height() gowid.IWidgetDimension
	SetHeight(gowid.IWidgetDimension, gowid.IApp)
}

type Maximizer

type Maximizer struct {
	Maxed  bool
	Width  gowid.IWidgetDimension
	Height gowid.IWidgetDimension
}

func (*Maximizer) Maximize

func (m *Maximizer) Maximize(w IWidget, app gowid.IApp) bool

func (*Maximizer) Unmaximize

func (m *Maximizer) Unmaximize(w IWidget, app gowid.IApp) bool

type OpenCloseCB

type OpenCloseCB struct{}

For callback registration

type Options

type Options struct {
	Buttons         []Button
	NoShadow        bool
	NoEscapeClose   bool
	ButtonStyle     gowid.ICellStyler
	BackgroundStyle gowid.ICellStyler
	BorderStyle     gowid.ICellStyler
	FocusOnWidget   bool
	NoFrame         bool
	Modal           bool
	TabToButtons    bool
	StartIdx        int
}

type SavedContainer

type SavedContainer struct{}

type SavedSubWidget

type SavedSubWidget struct{}

type SolidFunction

type SolidFunction func(gowid.Cell, gowid.Selector) gowid.Cell

func (SolidFunction) Transform

func (f SolidFunction) Transform(c gowid.Cell, focus gowid.Selector) gowid.Cell

type Widget

type Widget struct {
	gowid.IWidget
	Options Options

	NoFunction gowid.IWidgetChangedCallback
	Callbacks  *gowid.Callbacks
	// contains filtered or unexported fields
}

Widget - represents a modal dialog. 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(content gowid.IWidget, opts ...Options) *Widget

func (*Widget) Close

func (w *Widget) Close(app gowid.IApp)

func (*Widget) EscapeCloses

func (w *Widget) EscapeCloses() bool

func (*Widget) FocusOnButtons added in v1.3.0

func (w *Widget) FocusOnButtons(app gowid.IApp)

func (*Widget) FocusOnContent added in v1.3.0

func (w *Widget) FocusOnContent(app gowid.IApp)

func (*Widget) GetNoFunction

func (w *Widget) GetNoFunction() gowid.IWidgetChangedCallback

func (*Widget) Height

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

func (*Widget) IsMaxed added in v1.2.0

func (w *Widget) IsMaxed() bool

func (*Widget) IsModal added in v1.3.0

func (w *Widget) IsModal() bool

func (*Widget) IsOpen

func (w *Widget) IsOpen() bool

func (*Widget) IsSwitchFocus added in v1.3.0

func (w *Widget) IsSwitchFocus() bool

func (*Widget) Maximize added in v1.2.0

func (w *Widget) Maximize(app gowid.IApp)

func (*Widget) OnOpenClose

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

func (*Widget) Open

func (w *Widget) Open(container gowid.ISettableComposite, width gowid.IWidgetDimension, app gowid.IApp)

func (*Widget) OpenGlobally

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

Open the dialog at the top-level of the widget hierarchy which is the App - it itself is an IComposite

func (*Widget) RemoveOnOpenClose

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

func (*Widget) SavedContainer

func (w *Widget) SavedContainer() gowid.ISettableComposite

func (*Widget) SavedSubWidget

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

func (*Widget) SetContentWidth

func (w *Widget) SetContentWidth(d gowid.IWidgetDimension, app gowid.IApp)

func (*Widget) SetHeight

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

func (*Widget) SetOpen

func (w *Widget) SetOpen(open bool, app gowid.IApp)

func (*Widget) SetSavedContainer

func (w *Widget) SetSavedContainer(c gowid.ISettableComposite, app gowid.IApp)

func (*Widget) SetSavedSubWidget

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

func (*Widget) SetSubWidget

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

func (*Widget) SetWidth

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

func (*Widget) String

func (w *Widget) String() string

func (*Widget) SubWidget

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

func (*Widget) SwitchFocus added in v1.3.0

func (w *Widget) SwitchFocus(app gowid.IApp)

func (*Widget) Unmaximize added in v1.2.0

func (w *Widget) Unmaximize(app gowid.IApp)

func (*Widget) UserInput

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

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