progress

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

Documentation

Overview

Package progress provides a simple progress bar.

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 IWidget

type IWidget interface {
	gowid.IWidget
	// Text should return the string to be displayed inside the progress bar e.g. "50%"
	Text() string
	// Progress returns the number of units completed.
	Progress() int
	// Target returns the number of units required overall.
	Target() int
	// Normal is used to render the incomplete part of the progress bar.
	Normal() gowid.ICellStyler
	// Complete is used to render the complete part of the progress bar.
	Complete() 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 {
	Normal, Complete gowid.ICellStyler
	Target, Current  int
}

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

type ProgressCB

type ProgressCB struct{}

For callback registration

type TargetCB

type TargetCB struct{}

type Widget

type Widget struct {
	Current, Done int

	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 progressbar Widget/

func (*Widget) Complete

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

func (*Widget) Normal

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

func (*Widget) OnSetProgress

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

func (*Widget) OnSetTarget

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

func (*Widget) Progress

func (w *Widget) Progress() int

func (*Widget) RemoveOnSetProgress

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

func (*Widget) RemoveOnSetTarget

func (w *Widget) RemoveOnSetTarget(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) SetProgress

func (w *Widget) SetProgress(app gowid.IApp, current int)

func (*Widget) SetTarget

func (w *Widget) SetTarget(app gowid.IApp, target int)

func (*Widget) String

func (w *Widget) String() string

func (*Widget) Target

func (w *Widget) Target() int

func (*Widget) Text

func (w *Widget) Text() string

Jump to

Keyboard shortcuts

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