Navigation C API Pages Python bindings Applications

Progressbar widget

Progressbar is a widget that shows a progress. The progress is internally stored as a 64-bit integer number that starts at 0 and ends at max.

The value can be associated with a unit currently none, percents and seconds are supported.

Progressbar can also be set to be inverse which means that the value used for unit display will be max - val instead of val.

The default unit is percents.

If progressbar has an event handler set it’s seekable, i.e. the user can change it’s value.

A progressbar widget unit=none

Progressbar widget unit=none

A progressbar widget unit=percents

Progressbar widget unit=percents

A progressbar widget unit=seconds

Progressbar widget unit=seconds

Progress bar attributes can be accessed as widget->pbar.

Progressbar widget constructor
enum gp_widget_pbar_unit {
        GP_WIDGET_PBAR_NONE,
        GP_WIDGET_PBAR_PERCENTS,
        GP_WIDGET_PBAR_SECONDS,
        GP_WIDGET_PBAR_INVERSE = 0x80,
};

gp_widget *gp_widget_pbar_new(uint64_t val, uint64_t max,
                              enum gp_widget_pbar_unit unit);

The unit can be bitwise ored with GP_WIDGET_PBAR_INVERSE to make the progressbar unit display inverse.

void gp_widget_pbar_val_set(gp_widget *self, uint64_t val);

uint64_t gp_widget_pbar_val_get(gp_widget *self);

This function sets and gets a progressbar value, i.e. the progress that is shown on a screen.

void gp_widget_pbar_max_set(gp_widget *self, uint64_t max)

Sets a progress bar maximum.

Table 1. Progressbar JSON attributes
Attribute Type Default Description

val

uint

0

Initial value

max

uint

10000

Maximal value

inverse

bool

false

Inverse progress

unit

string

"percents"

Value units

Table 2. Progressbar widget events
Widget event value Description

0

Emitted when progress bar value has been changed.