gi-gtk-3.0.11: Gtk bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Gtk.Objects.ProgressBar

Contents

Description

The ProgressBar is typically used to display the progress of a long running operation. It provides a visual clue that processing is underway. The GtkProgressBar 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 GtkProgressBar 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 progressBarSetFraction 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 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 progressBarPulse periodically to update the progress bar.

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

plain code

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

GtkProgressBar has a main CSS node with name progressbar and subnodes with names text, trough and 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.

Synopsis

Exported types

Methods

getEllipsize

progressBarGetEllipsize Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> m EllipsizeMode

Returns: EllipsizeMode

Returns the ellipsizing position of the progress bar. See progressBarSetEllipsize.

Since: 2.6

getFraction

progressBarGetFraction Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> m Double

Returns: a fraction from 0.0 to 1.0

Returns the current fraction of the task that’s been completed.

getInverted

progressBarGetInverted Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> m Bool

Returns: True if the progress bar is inverted

Gets the value set by progressBarSetInverted.

getPulseStep

progressBarGetPulseStep Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> m Double

Returns: a fraction from 0.0 to 1.0

Retrieves the pulse step set with progressBarSetPulseStep.

getShowText

progressBarGetShowText Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> m Bool

Returns: True if text is shown in the progress bar

Gets the value of the ProgressBar:show-text property. See progressBarSetShowText.

Since: 3.0

getText

progressBarGetText Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> m (Maybe Text)

Returns: text, or Nothing; this string is owned by the widget and should not be modified or freed.

Retrieves the text that is displayed with the progress bar, if any, otherwise Nothing. 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.

new

progressBarNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> m ProgressBar

Returns: a ProgressBar.

Creates a new ProgressBar.

pulse

data ProgressBarPulseMethodInfo Source #

Instances

((~) * signature (m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarPulseMethodInfo a signature Source # 

progressBarPulse Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> m () 

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 progressBarPulse causes the block to move by a little bit (the amount of movement per pulse is determined by progressBarSetPulseStep).

setEllipsize

progressBarSetEllipsize Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> EllipsizeMode

mode: a EllipsizeMode

-> m () 

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

setFraction

progressBarSetFraction Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> Double

fraction: fraction of the task that’s been completed

-> m () 

Causes the progress bar to “fill in” the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.

setInverted

progressBarSetInverted Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> Bool

inverted: True to invert the progress bar

-> m () 

Progress bars normally grow from top to bottom or left to right. Inverted progress bars grow in the opposite direction.

setPulseStep

progressBarSetPulseStep Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> Double

fraction: fraction between 0.0 and 1.0

-> m () 

Sets the fraction of total progress bar length to move the bouncing block for each call to progressBarPulse.

setShowText

progressBarSetShowText Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> Bool

showText: whether to show superimposed text

-> m () 

Sets whether the progress bar will show text next to the bar. The shown text is either the value of the ProgressBar:text property or, if that is Nothing, the ProgressBar: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 ProgressBar:show-text to True and ProgressBar:text to the empty string (not Nothing).

Since: 3.0

setText

progressBarSetText Source #

Arguments

:: (HasCallStack, MonadIO m, IsProgressBar a) 
=> a

pbar: a ProgressBar

-> Maybe Text

text: a UTF-8 string, or Nothing

-> m () 

Causes the given text to appear next to the progress bar.

If text is Nothing and ProgressBar:show-text is True, the current value of ProgressBar:fraction will be displayed as a percentage.

If text is non-Nothing and ProgressBar: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 ProgressBar:show-text is True.

Properties

ellipsize

data ProgressBarEllipsizePropertyInfo Source #

Instances

AttrInfo ProgressBarEllipsizePropertyInfo Source # 
type AttrOrigin ProgressBarEllipsizePropertyInfo Source # 
type AttrLabel ProgressBarEllipsizePropertyInfo Source # 
type AttrGetType ProgressBarEllipsizePropertyInfo Source # 
type AttrBaseTypeConstraint ProgressBarEllipsizePropertyInfo Source # 
type AttrSetTypeConstraint ProgressBarEllipsizePropertyInfo Source # 
type AttrAllowedOps ProgressBarEllipsizePropertyInfo Source # 

fraction

data ProgressBarFractionPropertyInfo Source #

Instances

AttrInfo ProgressBarFractionPropertyInfo Source # 
type AttrOrigin ProgressBarFractionPropertyInfo Source # 
type AttrLabel ProgressBarFractionPropertyInfo Source # 
type AttrGetType ProgressBarFractionPropertyInfo Source # 
type AttrBaseTypeConstraint ProgressBarFractionPropertyInfo Source # 
type AttrSetTypeConstraint ProgressBarFractionPropertyInfo Source # 
type AttrAllowedOps ProgressBarFractionPropertyInfo Source # 

inverted

data ProgressBarInvertedPropertyInfo Source #

Instances

AttrInfo ProgressBarInvertedPropertyInfo Source # 
type AttrOrigin ProgressBarInvertedPropertyInfo Source # 
type AttrLabel ProgressBarInvertedPropertyInfo Source # 
type AttrGetType ProgressBarInvertedPropertyInfo Source # 
type AttrBaseTypeConstraint ProgressBarInvertedPropertyInfo Source # 
type AttrSetTypeConstraint ProgressBarInvertedPropertyInfo Source # 
type AttrAllowedOps ProgressBarInvertedPropertyInfo Source # 

pulseStep

data ProgressBarPulseStepPropertyInfo Source #

Instances

AttrInfo ProgressBarPulseStepPropertyInfo Source # 
type AttrOrigin ProgressBarPulseStepPropertyInfo Source # 
type AttrLabel ProgressBarPulseStepPropertyInfo Source # 
type AttrGetType ProgressBarPulseStepPropertyInfo Source # 
type AttrBaseTypeConstraint ProgressBarPulseStepPropertyInfo Source # 
type AttrSetTypeConstraint ProgressBarPulseStepPropertyInfo Source # 
type AttrAllowedOps ProgressBarPulseStepPropertyInfo Source # 

showText

data ProgressBarShowTextPropertyInfo Source #

Instances

AttrInfo ProgressBarShowTextPropertyInfo Source # 
type AttrOrigin ProgressBarShowTextPropertyInfo Source # 
type AttrLabel ProgressBarShowTextPropertyInfo Source # 
type AttrGetType ProgressBarShowTextPropertyInfo Source # 
type AttrBaseTypeConstraint ProgressBarShowTextPropertyInfo Source # 
type AttrSetTypeConstraint ProgressBarShowTextPropertyInfo Source # 
type AttrAllowedOps ProgressBarShowTextPropertyInfo Source # 

text

data ProgressBarTextPropertyInfo Source #

Instances

AttrInfo ProgressBarTextPropertyInfo Source # 
type AttrOrigin ProgressBarTextPropertyInfo Source # 
type AttrLabel ProgressBarTextPropertyInfo Source # 
type AttrGetType ProgressBarTextPropertyInfo Source # 
type AttrBaseTypeConstraint ProgressBarTextPropertyInfo Source # 
type AttrSetTypeConstraint ProgressBarTextPropertyInfo Source # 
type AttrAllowedOps ProgressBarTextPropertyInfo Source #