Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
Language | Haskell2010 |
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.
- newtype ProgressBar = ProgressBar (ManagedPtr ProgressBar)
- class GObject o => IsProgressBar o
- toProgressBar :: IsProgressBar o => o -> IO ProgressBar
- noProgressBar :: Maybe ProgressBar
- data ProgressBarGetEllipsizeMethodInfo
- progressBarGetEllipsize :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m EllipsizeMode
- data ProgressBarGetFractionMethodInfo
- progressBarGetFraction :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Double
- data ProgressBarGetInvertedMethodInfo
- progressBarGetInverted :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Bool
- data ProgressBarGetPulseStepMethodInfo
- progressBarGetPulseStep :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Double
- data ProgressBarGetShowTextMethodInfo
- progressBarGetShowText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Bool
- data ProgressBarGetTextMethodInfo
- progressBarGetText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m (Maybe Text)
- progressBarNew :: (HasCallStack, MonadIO m) => m ProgressBar
- data ProgressBarPulseMethodInfo
- progressBarPulse :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m ()
- data ProgressBarSetEllipsizeMethodInfo
- progressBarSetEllipsize :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> EllipsizeMode -> m ()
- data ProgressBarSetFractionMethodInfo
- progressBarSetFraction :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Double -> m ()
- data ProgressBarSetInvertedMethodInfo
- progressBarSetInverted :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Bool -> m ()
- data ProgressBarSetPulseStepMethodInfo
- progressBarSetPulseStep :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Double -> m ()
- data ProgressBarSetShowTextMethodInfo
- progressBarSetShowText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Bool -> m ()
- data ProgressBarSetTextMethodInfo
- progressBarSetText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Maybe Text -> m ()
- data ProgressBarEllipsizePropertyInfo
- constructProgressBarEllipsize :: IsProgressBar o => EllipsizeMode -> IO (GValueConstruct o)
- getProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> m EllipsizeMode
- progressBarEllipsize :: AttrLabelProxy "ellipsize"
- setProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> EllipsizeMode -> m ()
- data ProgressBarFractionPropertyInfo
- constructProgressBarFraction :: IsProgressBar o => Double -> IO (GValueConstruct o)
- getProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> m Double
- progressBarFraction :: AttrLabelProxy "fraction"
- setProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> Double -> m ()
- data ProgressBarInvertedPropertyInfo
- constructProgressBarInverted :: IsProgressBar o => Bool -> IO (GValueConstruct o)
- getProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> m Bool
- progressBarInverted :: AttrLabelProxy "inverted"
- setProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> Bool -> m ()
- data ProgressBarPulseStepPropertyInfo
- constructProgressBarPulseStep :: IsProgressBar o => Double -> IO (GValueConstruct o)
- getProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> m Double
- progressBarPulseStep :: AttrLabelProxy "pulseStep"
- setProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> Double -> m ()
- data ProgressBarShowTextPropertyInfo
- constructProgressBarShowText :: IsProgressBar o => Bool -> IO (GValueConstruct o)
- getProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> m Bool
- progressBarShowText :: AttrLabelProxy "showText"
- setProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> Bool -> m ()
- data ProgressBarTextPropertyInfo
- clearProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m ()
- constructProgressBarText :: IsProgressBar o => Text -> IO (GValueConstruct o)
- getProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m (Maybe Text)
- progressBarText :: AttrLabelProxy "text"
- setProgressBarText :: (MonadIO m, IsProgressBar o) => o -> Text -> m ()
Exported types
newtype ProgressBar Source #
GObject ProgressBar Source # | |
IsImplementorIface ProgressBar Source # | |
IsObject ProgressBar Source # | |
IsWidget ProgressBar Source # | |
IsOrientable ProgressBar Source # | |
IsBuildable ProgressBar Source # | |
IsProgressBar ProgressBar Source # | |
((~) * info (ResolveProgressBarMethod t ProgressBar), MethodInfo * info ProgressBar p) => IsLabel t (ProgressBar -> p) Source # | |
((~) * info (ResolveProgressBarMethod t ProgressBar), MethodInfo * info ProgressBar p) => IsLabelProxy t (ProgressBar -> p) Source # | |
HasAttributeList * ProgressBar Source # | |
type AttributeList ProgressBar Source # | |
type SignalList ProgressBar Source # | |
class GObject o => IsProgressBar o Source #
toProgressBar :: IsProgressBar o => o -> IO ProgressBar Source #
Methods
getEllipsize
data ProgressBarGetEllipsizeMethodInfo Source #
((~) * signature (m EllipsizeMode), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarGetEllipsizeMethodInfo a signature Source # | |
progressBarGetEllipsize Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m EllipsizeMode | Returns: |
Returns the ellipsizing position of the progress bar.
See progressBarSetEllipsize
.
Since: 2.6
getFraction
data ProgressBarGetFractionMethodInfo Source #
((~) * signature (m Double), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarGetFractionMethodInfo a signature Source # | |
progressBarGetFraction Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m Double | Returns: a fraction from 0.0 to 1.0 |
Returns the current fraction of the task that’s been completed.
getInverted
data ProgressBarGetInvertedMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarGetInvertedMethodInfo a signature Source # | |
progressBarGetInverted Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m Bool | Returns: |
Gets the value set by progressBarSetInverted
.
getPulseStep
data ProgressBarGetPulseStepMethodInfo Source #
((~) * signature (m Double), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarGetPulseStepMethodInfo a signature Source # | |
progressBarGetPulseStep Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m Double | Returns: a fraction from 0.0 to 1.0 |
Retrieves the pulse step set with progressBarSetPulseStep
.
getShowText
data ProgressBarGetShowTextMethodInfo Source #
((~) * signature (m Bool), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarGetShowTextMethodInfo a signature Source # | |
progressBarGetShowText Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m Bool | Returns: |
Gets the value of the ProgressBar
:show-text
property.
See progressBarSetShowText
.
Since: 3.0
getText
data ProgressBarGetTextMethodInfo Source #
((~) * signature (m (Maybe Text)), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarGetTextMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m (Maybe Text) | Returns: text, or |
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
:: (HasCallStack, MonadIO m) | |
=> m ProgressBar | Returns: a |
Creates a new ProgressBar
.
pulse
data ProgressBarPulseMethodInfo Source #
((~) * signature (m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarPulseMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> 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
data ProgressBarSetEllipsizeMethodInfo Source #
((~) * signature (EllipsizeMode -> m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarSetEllipsizeMethodInfo a signature Source # | |
progressBarSetEllipsize Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> 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
data ProgressBarSetFractionMethodInfo Source #
((~) * signature (Double -> m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarSetFractionMethodInfo a signature Source # | |
progressBarSetFraction Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> Double |
|
-> 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
data ProgressBarSetInvertedMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarSetInvertedMethodInfo a signature Source # | |
progressBarSetInverted Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> Bool |
|
-> m () |
Progress bars normally grow from top to bottom or left to right. Inverted progress bars grow in the opposite direction.
setPulseStep
data ProgressBarSetPulseStepMethodInfo Source #
((~) * signature (Double -> m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarSetPulseStepMethodInfo a signature Source # | |
progressBarSetPulseStep Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> Double |
|
-> m () |
Sets the fraction of total progress bar length to move the
bouncing block for each call to progressBarPulse
.
setShowText
data ProgressBarSetShowTextMethodInfo Source #
((~) * signature (Bool -> m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarSetShowTextMethodInfo a signature Source # | |
progressBarSetShowText Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> Bool |
|
-> 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
data ProgressBarSetTextMethodInfo Source #
((~) * signature (Maybe Text -> m ()), MonadIO m, IsProgressBar a) => MethodInfo * ProgressBarSetTextMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> Maybe Text |
|
-> 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 #
constructProgressBarEllipsize :: IsProgressBar o => EllipsizeMode -> IO (GValueConstruct o) Source #
getProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> m EllipsizeMode Source #
progressBarEllipsize :: AttrLabelProxy "ellipsize" Source #
setProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> EllipsizeMode -> m () Source #
fraction
data ProgressBarFractionPropertyInfo Source #
constructProgressBarFraction :: IsProgressBar o => Double -> IO (GValueConstruct o) Source #
getProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> m Double Source #
progressBarFraction :: AttrLabelProxy "fraction" Source #
setProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> Double -> m () Source #
inverted
data ProgressBarInvertedPropertyInfo Source #
constructProgressBarInverted :: IsProgressBar o => Bool -> IO (GValueConstruct o) Source #
getProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> m Bool Source #
progressBarInverted :: AttrLabelProxy "inverted" Source #
setProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> Bool -> m () Source #
pulseStep
data ProgressBarPulseStepPropertyInfo Source #
constructProgressBarPulseStep :: IsProgressBar o => Double -> IO (GValueConstruct o) Source #
getProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> m Double Source #
progressBarPulseStep :: AttrLabelProxy "pulseStep" Source #
setProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> Double -> m () Source #
showText
data ProgressBarShowTextPropertyInfo Source #
constructProgressBarShowText :: IsProgressBar o => Bool -> IO (GValueConstruct o) Source #
getProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> m Bool Source #
progressBarShowText :: AttrLabelProxy "showText" Source #
setProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> Bool -> m () Source #
text
data ProgressBarTextPropertyInfo Source #
clearProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m () Source #
constructProgressBarText :: IsProgressBar o => Text -> IO (GValueConstruct o) Source #
getProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m (Maybe Text) Source #
progressBarText :: AttrLabelProxy "text" Source #
setProgressBarText :: (MonadIO m, IsProgressBar o) => o -> Text -> m () Source #