keypress

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: 3 Imported by: 0

Documentation

Overview

Package keypress provides a widget which responds to keyboard input.

Index

Constants

This section is empty.

Variables

This section is empty.

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 UserInput

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

Types

type ICustomKeys

type ICustomKeys interface {
	CustomSelectKeys() bool
	SelectKeys() []gowid.IKey // can't be nil
}

type IKeyPresser

type IKeyPresser interface {
	gowid.IKeyPress
	ICustomKeys
	gowid.IComposite
}

type IWidget

type IWidget interface {
	gowid.ICompositeWidget
}

IWidget is implemented by any widget that contains exactly one exposed subwidget (ICompositeWidget) and that is decorated on its left and right (IDecoratedAround).

type KeyPressFunction

type KeyPressFunction func(app gowid.IApp, widget gowid.IWidget, key gowid.IKey)

func (KeyPressFunction) Changed

func (f KeyPressFunction) Changed(app gowid.IApp, widget gowid.IWidget, data ...interface{})

type Options

type Options struct {
	Keys []gowid.IKey
}

type Widget

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

func New

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

func (*Widget) CustomSelectKeys

func (w *Widget) CustomSelectKeys() bool

func (*Widget) KeyPress

func (w *Widget) KeyPress(key gowid.IKey, app gowid.IApp)

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

func (w *Widget) SelectKeys() []gowid.IKey

func (*Widget) SetSubWidget

func (w *Widget) SetSubWidget(wi 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

type WidgetCallback

type WidgetCallback struct {
	Name interface{}
	KeyPressFunction
}

WidgetCallback is a simple struct with a name field for IIdentity and that embeds a WidgetChangedFunction to be issued as a callback when a widget property changes.

func MakeCallback

func MakeCallback(name interface{}, fn KeyPressFunction) WidgetCallback

func (WidgetCallback) ID

func (f WidgetCallback) ID() interface{}

Jump to

Keyboard shortcuts

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