radio

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

Documentation

Overview

Package radio provides radio button widgets where one can be selected among many.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Select

func Select(w IWidget, app gowid.IApp)

Types

type IWidget

type IWidget interface {
	gowid.IWidget
	gowid.ICallbacks
	IsChecked() bool
	Group() *[]IWidget
	SetStateInternal(selected bool)
}

type RadioButtonTester

type RadioButtonTester struct {
	State bool
}

This is here to avoid import cycles

func (*RadioButtonTester) Changed

func (f *RadioButtonTester) Changed(app gowid.IApp, w gowid.IWidget, data ...interface{})

func (*RadioButtonTester) ID

func (f *RadioButtonTester) ID() interface{}

type Widget

type Widget struct {
	Selected bool

	*gowid.Callbacks
	gowid.ClickCallbacks
	checkbox.Decoration
	gowid.AddressProvidesID
	gowid.IsSelectable
	// contains filtered or unexported fields
}

func New

func New(group *[]IWidget) *Widget

If the group supplied is empty, this radio button will be marked as selected, regardless of the isChecked parameter.

func NewDecorated

func NewDecorated(group *[]IWidget, decoration checkbox.Decoration) *Widget

func (*Widget) Click

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

func (*Widget) Group

func (w *Widget) Group() *[]IWidget

func (*Widget) IsChecked

func (w *Widget) IsChecked() 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) Select

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

func (*Widget) SetStateInternal

func (w *Widget) SetStateInternal(selected bool)

Don't ensure consistency of other widgets, but do issue callbacks for state change. TODO - need to do callbacks here to capture losing selection

func (*Widget) String

func (w *Widget) String() string

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