ProgressBarProtocol

public protocol ProgressBarProtocol : OrientableProtocol, WidgetProtocol

The GtkProgressBar 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 gtk_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 GtkProgressBar 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_pulse() periodically to update the progress bar.

There is quite a bit of flexibility provided to control the appearance of the GtkProgressBar. 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 Language Example):

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.

The ProgressBarProtocol protocol exposes the methods and properties of an underlying GtkProgressBar instance. The default implementation of these can be found in the protocol extension below. For a concrete class that implements these methods and properties, see ProgressBar. Alternatively, use ProgressBarRef as a lighweight, unowned reference if you already have an instance you just want to use.

  • ptr

    Untyped pointer to the underlying GtkProgressBar instance.

    Declaration

    Swift

    var ptr: UnsafeMutableRawPointer! { get }
  • progress_bar_ptr Default implementation

    Typed pointer to the underlying GtkProgressBar instance.

    Default Implementation

    Return the stored, untyped pointer as a typed pointer to the GtkProgressBar instance.

    Declaration

    Swift

    var progress_bar_ptr: UnsafeMutablePointer<GtkProgressBar>! { get }
  • Required Initialiser for types conforming to ProgressBarProtocol

    Declaration

    Swift

    init(raw: UnsafeMutableRawPointer)

ProgressBar Class

  • Bind a ProgressBarPropertyName source property to a given target object.

    Declaration

    Swift

    @discardableResult
    @inlinable
    func bind<Q, T>(property source_property: ProgressBarPropertyName, to target: T, _ target_property: Q, flags f: BindingFlags = .default, transformFrom transform_from: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }, transformTo transform_to: @escaping GLibObject.ValueTransformer = { $0.transform(destValue: $1) }) -> BindingRef! where Q : PropertyNameProtocol, T : ObjectProtocol

    Parameters

    source_property

    the source property to bind

    target

    the target object to bind to

    target_property

    the target property to bind to

    flags

    the flags to pass to the Binding

    transform_from

    ValueTransformer to use for forward transformation

    transform_to

    ValueTransformer to use for backwards transformation

    Return Value

    binding reference or nil in case of an error

  • get(property:) Extension method

    Get the value of a ProgressBar property

    Declaration

    Swift

    @inlinable
    func get(property: ProgressBarPropertyName) -> GLibObject.Value

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

  • set(property:value:) Extension method

    Set the value of a ProgressBar property. Note that this will only have an effect on properties that are writable and not construct-only!

    Declaration

    Swift

    @inlinable
    func set(property: ProgressBarPropertyName, value v: GLibObject.Value)

    Parameters

    property

    the property to get the value for

    Return Value

    the value of the named property

ProgressBar Class: ProgressBarProtocol extension (methods and fields)

  • getEllipsize() Extension method

    Returns the ellipsizing position of the progress bar. See gtk_progress_bar_set_ellipsize().

    Declaration

    Swift

    @inlinable
    func getEllipsize() -> PangoEllipsizeMode
  • getFraction() Extension method

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

    Declaration

    Swift

    @inlinable
    func getFraction() -> Double
  • getInverted() Extension method

    Gets the value set by gtk_progress_bar_set_inverted().

    Declaration

    Swift

    @inlinable
    func getInverted() -> Bool
  • getPulseStep() Extension method

    Retrieves the pulse step set with gtk_progress_bar_set_pulse_step().

    Declaration

    Swift

    @inlinable
    func getPulseStep() -> Double
  • getShowText() Extension method

    Gets the value of the GtkProgressBar:show-text property. See gtk_progress_bar_set_show_text().

    Declaration

    Swift

    @inlinable
    func getShowText() -> Bool
  • getText() Extension method

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

    Declaration

    Swift

    @inlinable
    func getText() -> String!
  • pulse() Extension method

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

    Declaration

    Swift

    @inlinable
    func pulse()
  • setEllipsize(mode:) Extension method

    Sets the mode used to ellipsize (add an ellipsis: “…”) the text if there is not enough space to render the entire string.

    Declaration

    Swift

    @inlinable
    func setEllipsize(mode: PangoEllipsizeMode)
  • set(fraction:) Extension method

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

    Declaration

    Swift

    @inlinable
    func set(fraction: Double)
  • set(inverted:) Extension method

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

    Declaration

    Swift

    @inlinable
    func set(inverted: Bool)
  • setPulseStep(fraction:) Extension method

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

    Declaration

    Swift

    @inlinable
    func setPulseStep(fraction: Double)
  • set(showText:) Extension method

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

    Declaration

    Swift

    @inlinable
    func set(showText: Bool)
  • set(text:) Extension method

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

    If text is nil and GtkProgressBar:show-text is true, the current value of GtkProgressBar:fraction will be displayed as a percentage.

    If text is non-nil and GtkProgressBar: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 GtkProgressBar:show-text is true.

    Declaration

    Swift

    @inlinable
    func set(text: UnsafePointer<gchar>? = nil)
  • ellipsize Extension method

    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 gtk_widget_set_size_request().

    Declaration

    Swift

    @inlinable
    var ellipsize: PangoEllipsizeMode { get nonmutating set }
  • fraction Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var fraction: Double { get nonmutating set }
  • inverted Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var inverted: Bool { get nonmutating set }
  • pulseStep Extension method

    Retrieves the pulse step set with gtk_progress_bar_set_pulse_step().

    Declaration

    Swift

    @inlinable
    var pulseStep: Double { get nonmutating set }
  • showText Extension method

    Gets the value of the GtkProgressBar:show-text property. See gtk_progress_bar_set_show_text().

    Declaration

    Swift

    @inlinable
    var showText: Bool { get nonmutating set }
  • text Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var text: String! { get nonmutating set }
  • parent Extension method

    Undocumented

    Declaration

    Swift

    @inlinable
    var parent: GtkWidget { get }