Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
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] ├── [text] ╰── trough[.empty][.full] ╰── progress[.pulse]
GtkProgressBar 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.
Synopsis
- newtype ProgressBar = ProgressBar (ManagedPtr ProgressBar)
- class (GObject o, IsDescendantOf ProgressBar o) => IsProgressBar o
- toProgressBar :: (MonadIO m, IsProgressBar o) => o -> m ProgressBar
- progressBarGetEllipsize :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m EllipsizeMode
- progressBarGetFraction :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Double
- progressBarGetInverted :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Bool
- progressBarGetPulseStep :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Double
- progressBarGetShowText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m Bool
- progressBarGetText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m (Maybe Text)
- progressBarNew :: (HasCallStack, MonadIO m) => m ProgressBar
- progressBarPulse :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> m ()
- progressBarSetEllipsize :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> EllipsizeMode -> m ()
- progressBarSetFraction :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Double -> m ()
- progressBarSetInverted :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Bool -> m ()
- progressBarSetPulseStep :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Double -> m ()
- progressBarSetShowText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Bool -> m ()
- progressBarSetText :: (HasCallStack, MonadIO m, IsProgressBar a) => a -> Maybe Text -> m ()
- constructProgressBarEllipsize :: (IsProgressBar o, MonadIO m) => EllipsizeMode -> m (GValueConstruct o)
- getProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> m EllipsizeMode
- setProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> EllipsizeMode -> m ()
- constructProgressBarFraction :: (IsProgressBar o, MonadIO m) => Double -> m (GValueConstruct o)
- getProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> m Double
- setProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> Double -> m ()
- constructProgressBarInverted :: (IsProgressBar o, MonadIO m) => Bool -> m (GValueConstruct o)
- getProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> m Bool
- setProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> Bool -> m ()
- constructProgressBarPulseStep :: (IsProgressBar o, MonadIO m) => Double -> m (GValueConstruct o)
- getProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> m Double
- setProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> Double -> m ()
- constructProgressBarShowText :: (IsProgressBar o, MonadIO m) => Bool -> m (GValueConstruct o)
- getProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> m Bool
- setProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> Bool -> m ()
- clearProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m ()
- constructProgressBarText :: (IsProgressBar o, MonadIO m) => Text -> m (GValueConstruct o)
- getProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m (Maybe Text)
- setProgressBarText :: (MonadIO m, IsProgressBar o) => o -> Text -> m ()
Exported types
newtype ProgressBar Source #
Memory-managed wrapper type.
ProgressBar (ManagedPtr ProgressBar) |
Instances
Eq ProgressBar Source # | |
Defined in GI.Gtk.Objects.ProgressBar (==) :: ProgressBar -> ProgressBar -> Bool # (/=) :: ProgressBar -> ProgressBar -> Bool # | |
GObject ProgressBar Source # | |
Defined in GI.Gtk.Objects.ProgressBar | |
ManagedPtrNewtype ProgressBar Source # | |
Defined in GI.Gtk.Objects.ProgressBar toManagedPtr :: ProgressBar -> ManagedPtr ProgressBar | |
TypedObject ProgressBar Source # | |
Defined in GI.Gtk.Objects.ProgressBar | |
HasParentTypes ProgressBar Source # | |
Defined in GI.Gtk.Objects.ProgressBar | |
IsGValue (Maybe ProgressBar) Source # | Convert |
Defined in GI.Gtk.Objects.ProgressBar gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe ProgressBar -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe ProgressBar) | |
type ParentTypes ProgressBar Source # | |
Defined in GI.Gtk.Objects.ProgressBar |
class (GObject o, IsDescendantOf ProgressBar o) => IsProgressBar o Source #
Type class for types which can be safely cast to ProgressBar
, for instance with toProgressBar
.
Instances
(GObject o, IsDescendantOf ProgressBar o) => IsProgressBar o Source # | |
Defined in GI.Gtk.Objects.ProgressBar |
toProgressBar :: (MonadIO m, IsProgressBar o) => o -> m ProgressBar Source #
Cast to ProgressBar
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
activate, addAccelerator, addChild, addDeviceEvents, addEvents, addMnemonicLabel, addTickCallback, bindProperty, bindPropertyFull, canActivateAccel, childFocus, childNotify, classPath, computeExpand, constructChild, createPangoContext, createPangoLayout, customFinished, customTagEnd, customTagStart, destroy, destroyed, deviceIsShadowed, dragBegin, dragBeginWithCoordinates, dragCheckThreshold, dragDestAddImageTargets, dragDestAddTextTargets, dragDestAddUriTargets, dragDestFindTarget, dragDestGetTargetList, dragDestGetTrackMotion, dragDestSet, dragDestSetProxy, dragDestSetTargetList, dragDestSetTrackMotion, dragDestUnset, dragGetData, dragHighlight, dragSourceAddImageTargets, dragSourceAddTextTargets, dragSourceAddUriTargets, dragSourceGetTargetList, dragSourceSet, dragSourceSetIconGicon, dragSourceSetIconName, dragSourceSetIconPixbuf, dragSourceSetIconStock, dragSourceSetTargetList, dragSourceUnset, dragUnhighlight, draw, ensureStyle, errorBell, event, forceFloating, freezeChildNotify, freezeNotify, getv, grabAdd, grabDefault, grabFocus, grabRemove, hasDefault, hasFocus, hasGrab, hasRcStyle, hasScreen, hasVisibleFocus, hide, hideOnDelete, inDestruction, initTemplate, inputShapeCombineRegion, insertActionGroup, intersect, isAncestor, isComposited, isDrawable, isFloating, isFocus, isSensitive, isToplevel, isVisible, keynavFailed, listAccelClosures, listActionPrefixes, listMnemonicLabels, map, mnemonicActivate, modifyBase, modifyBg, modifyCursor, modifyFg, modifyFont, modifyStyle, modifyText, notify, notifyByPspec, overrideBackgroundColor, overrideColor, overrideCursor, overrideFont, overrideSymbolicColor, parserFinished, path, pulse, queueAllocate, queueComputeExpand, queueDraw, queueDrawArea, queueDrawRegion, queueResize, queueResizeNoRedraw, realize, ref, refSink, regionIntersect, registerWindow, removeAccelerator, removeMnemonicLabel, removeTickCallback, renderIcon, renderIconPixbuf, reparent, resetRcStyles, resetStyle, runDispose, sendExpose, sendFocusChange, shapeCombineRegion, show, showAll, showNow, sizeAllocate, sizeAllocateWithBaseline, sizeRequest, stealData, stealQdata, styleAttach, styleGetProperty, thawChildNotify, thawNotify, translateCoordinates, triggerTooltipQuery, unmap, unparent, unrealize, unref, unregisterWindow, unsetStateFlags, watchClosure.
Getters
getAccessible, getActionGroup, getAllocatedBaseline, getAllocatedHeight, getAllocatedSize, getAllocatedWidth, getAllocation, getAncestor, getAppPaintable, getCanDefault, getCanFocus, getChildRequisition, getChildVisible, getClip, getClipboard, getCompositeName, getData, getDeviceEnabled, getDeviceEvents, getDirection, getDisplay, getDoubleBuffered, getEllipsize, getEvents, getFocusOnClick, getFontMap, getFontOptions, getFraction, getFrameClock, getHalign, getHasTooltip, getHasWindow, getHexpand, getHexpandSet, getInternalChild, getInverted, getMapped, getMarginBottom, getMarginEnd, getMarginLeft, getMarginRight, getMarginStart, getMarginTop, getModifierMask, getModifierStyle, getName, getNoShowAll, getOpacity, getOrientation, getPangoContext, getParent, getParentWindow, getPath, getPointer, getPreferredHeight, getPreferredHeightAndBaselineForWidth, getPreferredHeightForWidth, getPreferredSize, getPreferredWidth, getPreferredWidthForHeight, getProperty, getPulseStep, getQdata, getRealized, getReceivesDefault, getRequestMode, getRequisition, getRootWindow, getScaleFactor, getScreen, getSensitive, getSettings, getShowText, getSizeRequest, getState, getStateFlags, getStyle, getStyleContext, getSupportMultidevice, getTemplateChild, getText, getTooltipMarkup, getTooltipText, getTooltipWindow, getToplevel, getValign, getValignWithBaseline, getVexpand, getVexpandSet, getVisible, getVisual, getWindow.
Setters
setAccelPath, setAllocation, setAppPaintable, setBuildableProperty, setCanDefault, setCanFocus, setChildVisible, setClip, setCompositeName, setData, setDataFull, setDeviceEnabled, setDeviceEvents, setDirection, setDoubleBuffered, setEllipsize, setEvents, setFocusOnClick, setFontMap, setFontOptions, setFraction, setHalign, setHasTooltip, setHasWindow, setHexpand, setHexpandSet, setInverted, setMapped, setMarginBottom, setMarginEnd, setMarginLeft, setMarginRight, setMarginStart, setMarginTop, setName, setNoShowAll, setOpacity, setOrientation, setParent, setParentWindow, setProperty, setPulseStep, setRealized, setReceivesDefault, setRedrawOnAllocate, setSensitive, setShowText, setSizeRequest, setState, setStateFlags, setStyle, setSupportMultidevice, setText, setTooltipMarkup, setTooltipText, setTooltipWindow, setValign, setVexpand, setVexpandSet, setVisible, setVisual, setWindow.
getEllipsize
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
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
progressBarGetInverted Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m Bool | Returns: |
Gets the value set by progressBarSetInverted
.
getPulseStep
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
progressBarGetShowText Source #
:: (HasCallStack, MonadIO m, IsProgressBar a) | |
=> a |
|
-> m Bool | Returns: |
Gets the value of the ProgressBar:showText property.
See progressBarSetShowText
.
Since: 3.0
getText
:: (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
:: (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
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
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
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
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
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:showText to
True
and ProgressBar:text to the empty string (not Nothing
).
Since: 3.0
setText
:: (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:showText is True
, the current
value of ProgressBar:fraction will be displayed as a percentage.
If text
is non-Nothing
and ProgressBar:showText 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:showText is True
.
Properties
ellipsize
The preferred place to ellipsize the string, if the progress bar does
not have enough room to display the entire string, specified as a
EllipsizeMode
.
Note that setting this property to a value other than
EllipsizeModeNone
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 widgetSetSizeRequest
.
Since: 2.6
constructProgressBarEllipsize :: (IsProgressBar o, MonadIO m) => EllipsizeMode -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ellipsize
” property. This is rarely needed directly, but it is used by new
.
getProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> m EllipsizeMode Source #
Get the value of the “ellipsize
” property.
When overloading is enabled, this is equivalent to
get
progressBar #ellipsize
setProgressBarEllipsize :: (MonadIO m, IsProgressBar o) => o -> EllipsizeMode -> m () Source #
Set the value of the “ellipsize
” property.
When overloading is enabled, this is equivalent to
set
progressBar [ #ellipsize:=
value ]
fraction
No description available in the introspection data.
constructProgressBarFraction :: (IsProgressBar o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “fraction
” property. This is rarely needed directly, but it is used by new
.
getProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> m Double Source #
Get the value of the “fraction
” property.
When overloading is enabled, this is equivalent to
get
progressBar #fraction
setProgressBarFraction :: (MonadIO m, IsProgressBar o) => o -> Double -> m () Source #
Set the value of the “fraction
” property.
When overloading is enabled, this is equivalent to
set
progressBar [ #fraction:=
value ]
inverted
No description available in the introspection data.
constructProgressBarInverted :: (IsProgressBar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “inverted
” property. This is rarely needed directly, but it is used by new
.
getProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> m Bool Source #
Get the value of the “inverted
” property.
When overloading is enabled, this is equivalent to
get
progressBar #inverted
setProgressBarInverted :: (MonadIO m, IsProgressBar o) => o -> Bool -> m () Source #
Set the value of the “inverted
” property.
When overloading is enabled, this is equivalent to
set
progressBar [ #inverted:=
value ]
pulseStep
No description available in the introspection data.
constructProgressBarPulseStep :: (IsProgressBar o, MonadIO m) => Double -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “pulse-step
” property. This is rarely needed directly, but it is used by new
.
getProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> m Double Source #
Get the value of the “pulse-step
” property.
When overloading is enabled, this is equivalent to
get
progressBar #pulseStep
setProgressBarPulseStep :: (MonadIO m, IsProgressBar o) => o -> Double -> m () Source #
Set the value of the “pulse-step
” property.
When overloading is enabled, this is equivalent to
set
progressBar [ #pulseStep:=
value ]
showText
Sets whether the progress bar will show a text in addition
to the bar itself. 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
showing text (even if the actual text is blank), set
ProgressBar:showText to True
and ProgressBar:text
to the empty string (not Nothing
).
Since: 3.0
constructProgressBarShowText :: (IsProgressBar o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “show-text
” property. This is rarely needed directly, but it is used by new
.
getProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> m Bool Source #
Get the value of the “show-text
” property.
When overloading is enabled, this is equivalent to
get
progressBar #showText
setProgressBarShowText :: (MonadIO m, IsProgressBar o) => o -> Bool -> m () Source #
Set the value of the “show-text
” property.
When overloading is enabled, this is equivalent to
set
progressBar [ #showText:=
value ]
text
No description available in the introspection data.
clearProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m () Source #
Set the value of the “text
” property to Nothing
.
When overloading is enabled, this is equivalent to
clear
#text
constructProgressBarText :: (IsProgressBar o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “text
” property. This is rarely needed directly, but it is used by new
.
getProgressBarText :: (MonadIO m, IsProgressBar o) => o -> m (Maybe Text) Source #
Get the value of the “text
” property.
When overloading is enabled, this is equivalent to
get
progressBar #text
setProgressBarText :: (MonadIO m, IsProgressBar o) => o -> Text -> m () Source #
Set the value of the “text
” property.
When overloading is enabled, this is equivalent to
set
progressBar [ #text:=
value ]