spinner

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

Documentation

Overview

Package spinner provides a simple themable spinner.

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

Render will render a progressbar IWidget.

Types

type ChangeStateCB

type ChangeStateCB struct{}

type IWidget

type IWidget interface {
	gowid.IWidget
	// Text should return the string to be displayed inside the progress bar e.g. "50%"
	Text() string
	// Enabled returns true if spinner is spinning
	Enabled() bool
	// SetEnabled enables or disables the animation/spinning
	SetEnabled(bool, gowid.IApp)
	// Index returns the index at which to start drawing from the spinner characters
	Index() int
	// SpinnerLen returns the length of the set of chars used to draw the spinner
	SpinnerLen() int
	// Styler is used to render the incomplete part of the progress bar.
	Styler() gowid.ICellStyler
}

IWidget - if your widget implements progress.IWidget, you will be able to render it using the progress.Render() function.

type Options

type Options struct {
	Label  string
	Styler gowid.ICellStyler
}

Options is used for passing arguments to the progressbar initializer, New().

type Widget

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

Widget is the concrete type of a progressbar widget.

func New

func New(args Options) *Widget

New will return an initialized spinner

func (*Widget) Enabled

func (w *Widget) Enabled() bool

func (*Widget) Index

func (w *Widget) Index() int

func (*Widget) OnChangeState

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

func (*Widget) RemoveOnChangeState

func (w *Widget) RemoveOnChangeState(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) SetEnabled

func (w *Widget) SetEnabled(enabled bool, app gowid.IApp)

func (*Widget) SpinnerLen

func (w *Widget) SpinnerLen() int

func (*Widget) String

func (w *Widget) String() string

func (*Widget) Styler

func (w *Widget) Styler() gowid.ICellStyler

func (*Widget) Text

func (w *Widget) Text() string

func (*Widget) Update

func (w *Widget) Update()

Jump to

Keyboard shortcuts

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