AG_ProgressBar
—
agar progress bar widget
#include <agar/core.h>
#include <agar/gui.h>
The AG_ProgressBar
widget binds to minimum, maximum and
value integers and displays a progress bar representing the value.
AG_ProgressBar *
AG_ProgressBarNew
(AG_Widget
*parent, enum
ag_progress_bar_type type,
Uint flags);
AG_ProgressBar *
AG_ProgressBarNewInt
(AG_Widget
*parent, enum
ag_progress_bar_type type,
Uint flags,
int *value,
int *min,
int *max);
AG_ProgressBar *
AG_ProgressBarNewHoriz
(AG_Widget
*parent, Uint
flags);
AG_ProgressBar *
AG_ProgressBarNewVert
(AG_Widget
*parent, Uint
flags);
void
AG_ProgressBarSetWidth
(AG_ProgressBar
*pb, int
width);
void
AG_ProgressBarSetLength
(AG_ProgressBar
*pb, int
length);
int
AG_ProgressBarPercent
(AG_ProgressBar
*pb);
The AG_ProgressBarNew
() function
allocates, initializes, and attaches a new
AG_ProgressBar
widget. type
defines the style:
enum ag_progress_bar_type {
AG_PROGRESS_BAR_HORIZ,
AG_PROGRESS_BAR_VERT
};
Acceptable flags include:
- AG_PROGRESS_BAR_SHOW_PCT
- Display text showing the percentage.
- AG_PROGRESS_BAR_EXCL
- Advise that no external changes to the value,
min and max bindings are
expected. By default, the binding values are periodically checked and the
progress bar is redrawn if a change is detected. Note that this setting
only influences redraw -- external changes to the binding values are
handled safely regardless.
- AG_PROGRESS_BAR_HFILL
- Expand horizontally in parent (equivalent to invoking
AG_ExpandHoriz(3)).
If this flag is not used,
AG_ProgressBarSetLength
() should be called
explicitely.
- AG_PROGRESS_BAR_VFILL
- Expand vertically in parent (equivalent to invoking
AG_ExpandVert(3)).
If this flag is not used,
AG_ProgressBarSetLength
() should be called
explicitely.
- AG_PROGRESS_BAR_EXPAND
- Shorthand for
AG_PROGRESS_BAR_HFILL|AG_PROGRESS_BAR_VFILL
.
The AG_ProgressBarNewInt
() variant binds
the ‘value’, ‘min’ and ‘max’
bindings on initialization.
The AG_ProgressBarNewHoriz
() and
AG_ProgressBarNewVert
() variants specify the layout
on initialization.
The AG_ProgressBarSetWidth
() function sets
the width of the bar in pixels.
AG_ProgressBarSetLength
() requests a
preferred length in pixels. Alternatively,
AG_PROGRESS_BAR_HFILL
or
AG_PROGRESS_BAR_VFILL
may be used.
The AG_ProgressBarPercent
() returns the
percentage for the currently bound value and range.
The AG_ProgressBar
widget provides the following
bindings:
- int *value
- Current value
- int *min
- Minimum value
- int *max
- Maximum value
The AG_ProgressBar
widget does not generate any event.
The AG_ProgressBar
widget first appeared in Agar 1.3.