![]() |
GFXprim
2D bitmap graphics library with emphasis on speed and correctness
|
A progress bar widget. More...
#include <stdint.h>Go to the source code of this file.
Enumerations | |
| enum | gp_widget_pbar_unit { GP_WIDGET_PBAR_NONE , GP_WIDGET_PBAR_PERCENTS , GP_WIDGET_PBAR_SECONDS , GP_WIDGET_PBAR_UNIT_MASK = 0x7f , GP_WIDGET_PBAR_INVERSE = 0x80 } |
| A progress bar widget units. More... | |
| enum | gp_widget_pbar_event_type { GP_WIDGET_PBAR_VAL_CHANGED } |
| A gp_widget_event::sub_type for a progress bar widget. More... | |
Functions | |
| gp_widget * | gp_widget_pbar_new (uint64_t val, uint64_t max, enum gp_widget_pbar_unit unit) |
| Allocate and initialize new progress bar widget. | |
| void | gp_widget_pbar_val_set (gp_widget *self, uint64_t val) |
| Sets a progress bar value. | |
| void | gp_widget_pbar_max_set (gp_widget *self, uint64_t max) |
| Sets a progress bar maximum. | |
| uint64_t | gp_widget_pbar_val_get (gp_widget *self) |
| Returns progressbar value. | |
| uint64_t | gp_widget_pbar_max_get (gp_widget *self) |
| Returns progress bar max value. | |
A progress bar 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 gp_widget::on_event() handler set it's seekable, i.e. the user can change it's value and the handler is called for each value change.
| Attribute | Type | Default | Description |
|---|---|---|---|
| val | uint | 0 | Initial value |
| max | uint | 10000 | Maximal value |
| inverse | bool | false | Inverse progress |
| unit | string | "percents" | Value units |
Definition in file gp_widget_pbar.h.
A gp_widget_event::sub_type for a progress bar widget.
| Enumerator | |
|---|---|
| GP_WIDGET_PBAR_VAL_CHANGED | Emitted when progress bar value is changed. E.g. music player can have a seekable progress showing the time left in a song. |
Definition at line 79 of file gp_widget_pbar.h.
| enum gp_widget_pbar_unit |
A progress bar widget units.
Definition at line 43 of file gp_widget_pbar.h.
| uint64_t gp_widget_pbar_max_get | ( | gp_widget * | self | ) |
Returns progress bar max value.
| self | A progress bar widget. |
| void gp_widget_pbar_max_set | ( | gp_widget * | self, |
| uint64_t | max ) |
Sets a progress bar maximum.
| self | A progress bar widget. |
| max | New maximal progress bar value. |
| gp_widget * gp_widget_pbar_new | ( | uint64_t | val, |
| uint64_t | max, | ||
| enum gp_widget_pbar_unit | unit ) |
Allocate and initialize new progress bar widget.
| val | Initial progress bar value. |
| max | Maximal progress bar value. |
| unit | Progress bar value unit. |
| uint64_t gp_widget_pbar_val_get | ( | gp_widget * | self | ) |
Returns progressbar value.
| self | A progress bar widget. |
| void gp_widget_pbar_val_set | ( | gp_widget * | self, |
| uint64_t | val ) |
Sets a progress bar value.
| self | A progress bar widget. |
| val | New progress bar value. |