gtk.progress_bar

Module for [ProgressBar] class

Types 3

gtk.progress_bar.ProgressBar is typically used to display the progress of a long running operation.

It provides a visual clue that processing is underway. gtk.progress_bar.ProgressBar can be used in two different modes: percentage mode and activity mode.

!An example GtkProgressBar

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 gtk.progress_bar.ProgressBar 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 gtk.progress_bar.ProgressBar.setFraction 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 gtk.progress_bar.ProgressBar 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 gtk.progress_bar.ProgressBar.pulse periodically to update the progress bar.

There is quite a bit of flexibility provided to control the appearance of the gtk.progress_bar.ProgressBar. 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.

CSS nodes

progressbar[.osd]
├── [text]
╰── trough[.empty][.full]
    ╰── progress[.pulse]

gtk.progress_bar.ProgressBar 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 GtkProgressBar. The .osd class on the progressbar node is for use in overlays like the one Epiphany has for page loading progress.

Accessibility

gtk.progress_bar.ProgressBar uses the gtk.types.AccessibleRole.ProgressBar role.

Methods
GType _getGType() static nothrow
GType _gType() @property nothrow
ProgressBar self() nothrowReturns `this`, for use in `with` statements.
ProgressBarGidBuilder builder() static nothrowGet builder for [gtk.progress_bar.ProgressBar] Returns: New builder object
pango.types.EllipsizeMode ellipsize() @property nothrowGet `ellipsize` property. Returns: The preferred place to ellipsize the string.
void ellipsize(pango.types.EllipsizeMode propval) @property nothrowSet `ellipsize` property. Params: propval = The preferred place to ellipsize the string.
double fraction() @property nothrowGet `fraction` property. Returns: The fraction of total work that has been completed.
void fraction(double propval) @property nothrowSet `fraction` property. Params: propval = The fraction of total work that has been completed.
bool inverted() @property nothrowGet `inverted` property. Returns: Invert the direction in which the progress bar grows.
void inverted(bool propval) @property nothrowSet `inverted` property. Params: propval = Invert the direction in which the progress bar grows.
double pulseStep() @property nothrowGet `pulseStep` property. Returns: The fraction of total progress to move the bounding block when pulsed.
void pulseStep(double propval) @property nothrowSet `pulseStep` property. Params: propval = The fraction of total progress to move the bounding block when pulsed.
bool showText() @property nothrowGet `showText` property. Returns: Sets whether the progress bar will show a text in addition to the bar itself.
void showText(bool propval) @property nothrowSet `showText` property. Params: propval = Sets whether the progress bar will show a text in addition to the bar itself.
string text() @property nothrowGet `text` property. Returns: Text to be displayed in the progress bar.
void text(string propval) @property nothrowSet `text` property. Params: propval = Text to be displayed in the progress bar.
pango.types.EllipsizeMode getEllipsize() nothrowReturns the ellipsizing position of the progress bar.
double getFraction() nothrowReturns the current fraction of the task that’s been completed. Returns: a fraction from 0.0 to 1.0
bool getInverted() nothrowReturns whether the progress bar is inverted. Returns: true if the progress bar is inverted
double getPulseStep() nothrowRetrieves the pulse step.
bool getShowText() nothrowReturns whether the [gtk.progress_bar.ProgressBar] shows text.
string getText() nothrowRetrieves the text that is displayed with the progress bar.
void pulse() nothrowIndicates that some progress has been made, but you don’t know how much.
void setEllipsize(pango.types.EllipsizeMode mode) nothrowSets the mode used to ellipsize the text.
void setFraction(double fraction) nothrowCauses the progress bar to “fill in” the given fraction of the bar.
void setInverted(bool inverted) nothrowSets whether the progress bar is inverted.
void setPulseStep(double fraction) nothrowSets the fraction of total progress bar length to move the bouncing block.
void setShowText(bool showText) nothrowSets whether the progress bar will show text next to the bar.
void setText(string text = null) nothrowCauses the given text to appear next to the progress bar.
Constructors
this(void * ptr, Flag!"Take" take)
this()Creates a new [gtk.progress_bar.ProgressBar]. Returns: a [gtk.progress_bar.ProgressBar].

Fluent builder implementation template for gtk.progress_bar.ProgressBar

Methods
T ellipsize(pango.types.EllipsizeMode propval) nothrowSet `ellipsize` property. Params: propval = The preferred place to ellipsize the string.
T fraction(double propval) nothrowSet `fraction` property. Params: propval = The fraction of total work that has been completed. Returns: Builder instance for fluent chaining
T inverted(bool propval) nothrowSet `inverted` property. Params: propval = Invert the direction in which the progress bar grows. Returns: Builder instance for fluent chaining
T pulseStep(double propval) nothrowSet `pulseStep` property. Params: propval = The fraction of total progress to move the bounding block when pulsed. Returns: Builder instance for fluent chaining
T showText(bool propval) nothrowSet `showText` property. Params: propval = Sets whether the progress bar will show a text in addition to the bar itself.
T text(string propval) nothrowSet `text` property. Params: propval = Text to be displayed in the progress bar. Returns: Builder instance for fluent chaining

Fluent builder for gtk.progress_bar.ProgressBar

Methods
ProgressBar build() nothrowCreate object from builder. Returns: New object