| Top |
| CtkWidget * | ctk_progress_bar_new () |
| void | ctk_progress_bar_pulse () |
| void | ctk_progress_bar_set_fraction () |
| gdouble | ctk_progress_bar_get_fraction () |
| void | ctk_progress_bar_set_inverted () |
| gboolean | ctk_progress_bar_get_inverted () |
| void | ctk_progress_bar_set_show_text () |
| gboolean | ctk_progress_bar_get_show_text () |
| void | ctk_progress_bar_set_text () |
| const gchar * | ctk_progress_bar_get_text () |
| void | ctk_progress_bar_set_ellipsize () |
| PangoEllipsizeMode | ctk_progress_bar_get_ellipsize () |
| void | ctk_progress_bar_set_pulse_step () |
| gdouble | ctk_progress_bar_get_pulse_step () |
CtkProgressBar implements AtkImplementorIface, CtkBuildable and CtkOrientable.
The CtkProgressBar is typically used to display the progress of a long running operation. It provides a visual clue that processing is underway. The CtkProgressBar can be used in two different modes: percentage mode and activity mode.
When an application can determine how much work needs to take place
(e.g. read a fixed number of bytes from a file) and can monitor its
progress, it can use the CtkProgressBar in percentage mode and the
user sees a growing bar indicating the percentage of the work that
has been completed. In this mode, the application is required to call
ctk_progress_bar_set_fraction() periodically to update the progress bar.
When an application has no accurate way of knowing the amount of work
to do, it can use the CtkProgressBar in activity mode, which shows
activity by a block moving back and forth within the progress area. In
this mode, the application is required to call ctk_progress_bar_pulse()
periodically to update the progress bar.
There is quite a bit of flexibility provided to control the appearance of the CtkProgressBar. Functions are provided to control the orientation of the bar, optional text can be displayed along with the bar, and the step size used in activity mode can be set.
1 2 3 4 |
progressbar[.osd] ├── [text] ╰── trough[.empty][.full] ╰── progress[.pulse] |
CtkProgressBar has a main CSS node with name progressbar and subnodes with names text and trough, of which the latter has a subnode named progress. The text subnode is only present if text is shown. The progress subnode has the style class .pulse when in activity mode. It gets the style classes .left, .right, .top or .bottom added when the progress 'touches' the corresponding end of the CtkProgressBar. The .osd class on the progressbar node is for use in overlays like the one Epiphany has for page loading progress.
void
ctk_progress_bar_pulse (CtkProgressBar *pbar);
Indicates that some progress has been made, but you don’t know how much.
Causes the progress bar to enter “activity mode,” where a block
bounces back and forth. Each call to ctk_progress_bar_pulse()
causes the block to move by a little bit (the amount of movement
per pulse is determined by ctk_progress_bar_set_pulse_step()).
void ctk_progress_bar_set_fraction (CtkProgressBar *pbar,gdouble fraction);
Causes the progress bar to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.
gdouble
ctk_progress_bar_get_fraction (CtkProgressBar *pbar);
Returns the current fraction of the task that’s been completed.
void ctk_progress_bar_set_inverted (CtkProgressBar *pbar,gboolean inverted);
Progress bars normally grow from top to bottom or left to right. Inverted progress bars grow in the opposite direction.
gboolean
ctk_progress_bar_get_inverted (CtkProgressBar *pbar);
Gets the value set by ctk_progress_bar_set_inverted().
void ctk_progress_bar_set_show_text (CtkProgressBar *pbar,gboolean show_text);
Sets whether the progress bar will show text next to the bar.
The shown text is either the value of the “text”
property or, if that is NULL, the “fraction” value,
as a percentage.
To make a progress bar that is styled and sized suitably for containing
text (even if the actual text is blank), set “show-text” to
TRUE and “text” to the empty string (not NULL).
Since: 3.0
gboolean
ctk_progress_bar_get_show_text (CtkProgressBar *pbar);
Gets the value of the “show-text” property.
See ctk_progress_bar_set_show_text().
Since: 3.0
void ctk_progress_bar_set_text (CtkProgressBar *pbar,const gchar *text);
Causes the given text
to appear next to the progress bar.
If text
is NULL and “show-text” is TRUE, the current
value of “fraction” will be displayed as a percentage.
If text
is non-NULL and “show-text” is TRUE, the text
will be displayed. In this case, it will not display the progress
percentage. If text
is the empty string, the progress bar will still
be styled and sized suitably for containing text, as long as
“show-text” is TRUE.
const gchar *
ctk_progress_bar_get_text (CtkProgressBar *pbar);
Retrieves the text that is displayed with the progress bar,
if any, otherwise NULL. The return value is a reference
to the text, not a copy of it, so will become invalid
if you change the text in the progress bar.
void ctk_progress_bar_set_ellipsize (CtkProgressBar *pbar,PangoEllipsizeMode mode);
Sets the mode used to ellipsize (add an ellipsis: "...") the text if there is not enough space to render the entire string.
Since: 2.6
PangoEllipsizeMode
ctk_progress_bar_get_ellipsize (CtkProgressBar *pbar);
Returns the ellipsizing position of the progress bar.
See ctk_progress_bar_set_ellipsize().
Since: 2.6
void ctk_progress_bar_set_pulse_step (CtkProgressBar *pbar,gdouble fraction);
Sets the fraction of total progress bar length to move the
bouncing block for each call to ctk_progress_bar_pulse().
gdouble
ctk_progress_bar_get_pulse_step (CtkProgressBar *pbar);
Retrieves the pulse step set with ctk_progress_bar_set_pulse_step().
“ellipsize” property “ellipsize” PangoEllipsizeMode
The preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, specified as a PangoEllipsizeMode.
Note that setting this property to a value other than
PANGO_ELLIPSIZE_NONE has the side-effect that the progress bar requests
only enough space to display the ellipsis ("..."). Another means to set a
progress bar's width is ctk_widget_set_size_request().
Owner: CtkProgressBar
Flags: Read / Write
Default value: PANGO_ELLIPSIZE_NONE
Since: 2.6
“fraction” property “fraction” double
The fraction of total work that has been completed.
Owner: CtkProgressBar
Flags: Read / Write
Allowed values: [0,1]
Default value: 0
“inverted” property “inverted” gboolean
Invert the direction in which the progress bar grows.
Owner: CtkProgressBar
Flags: Read / Write
Default value: FALSE
“pulse-step” property “pulse-step” double
The fraction of total progress to move the bouncing block when pulsed.
Owner: CtkProgressBar
Flags: Read / Write
Allowed values: [0,1]
Default value: 0.1
“show-text” property “show-text” gboolean
Sets whether the progress bar will show a text in addition
to the bar itself. The shown text is either the value of
the “text” property or, if that is NULL,
the “fraction” value, as a percentage.
To make a progress bar that is styled and sized suitably for
showing text (even if the actual text is blank), set
“show-text” to TRUE and “text”
to the empty string (not NULL).
Owner: CtkProgressBar
Flags: Read / Write
Default value: FALSE
Since: 3.0