Create  Edit  FrontPage  Index  Search  Changes  History  RSS  Back  Login

Gtk::ProgressBar Diff - Ruby-GNOME2 Project Website

  • Added parts are displayed like this.
  • Deleted parts are displayed like this.

= class Gtk::ProgressBar

The Gtk::ProgressBar is typically used to display the progress of a long running operation. It provides a visual clue that processing is underway. The Gtk::ProgressBar 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 Gtk::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::ProgressBar#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 Gtk::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::ProgressBar#pulse perodically to update the progress bar.

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

== Object Hierarchy

* Object
  * GLib::Instantiatable
    * GLib::Object
      * GLib::InitiallyUnowned
        * Gtk::Object
          * Gtk::Widget
            * Gtk::Progress
              * Gtk::ProgressBar

== Class Methods

--- Gtk::ProgressBar.new

    Creates a new Gtk::ProgressBar.
    * Returns: a Gtk::ProgressBar.

== Instance Methods

--- fraction

    Returns the current fraction of the task that's been completed.
    * Returns: a fraction from 0.0 to 1.0

--- fraction=(fraction)

    Causes the progress bar to "fill in" the given fraction of the bar. The fraction should be between 0.0 and 1.0, inclusive.
    * fraction: fraction of the task that's been completed
    * returns: fraction

--- set_fraction(fraction)

    Same as Gtk::ProgressBar#fraction=.
    * fraction: fraction of the task that's been completed
    * returns: self

--- orientation

    Retrieves the current progress bar orientation.
    * Returns: orientation of the progress bar

--- orientation=(orientation)

    Causes the progress bar to switch to a different orientation (left-to-right, right-to-left, top-to-bottom, or bottom-to-top).
    * orientation: orientation of the progress bar(((<GtkProgressBarOrientation|Gtk::ProgressBar#GtkProgressBarOrientation>)))
    * Returns: orientation

--- set_orientation(orientation)

    Same as Gtk::ProgressBar#orientation=.
    * orientation: orientation of the progress bar(((<GtkProgressBarOrientation|Gtk::ProgressBar#GtkProgressBarOrientation>)))
    * Returns: orientation

--- pulse

    Indicates that some progress is 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::ProgressBar#pulse() causes the block to move by a little bit (the amount of movement per pulse is determined by Gtk::ProgressBar#pulse_step=).
    * Returns: self

--- pulse_step

    Retrieves the pulse step set with Gtk::ProgressBar#pulse_step=.
    * Returns: a fraction from 0.0 to 1.0

--- pulse_step=(fraction)

    Sets the fraction of total progress bar length to move the bouncing block for each call to Gtk::ProgressBar#pulse.
    * fraction : fraction between 0.0 and 1.0
    * Returns: fraction

--- set_pulse_step(fraction)

    Same as Gtk::ProgressBar#pulse_step=.
    * fraction : fraction between 0.0 and 1.0
    * Returns: self

--- text

    Returns the current text to appear superimosed on the progress bar.
    * Returns: text

--- text=(text)

    Causes the given text to appear superimposed on the progress bar.
    * text : a UTF-8 string
    * Returns: text

--- set_text(text)

    Same as Gtk::ProgressBar#text=.
    * text : a UTF-8 string
    * Returns: self

--- ellipsize

    Gets the preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, if at all..
     * Returns: The preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, if at all.

--- ellipsize=(ellipsize)

    Sets the preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, if at all..
     * ellipsize: The preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, if at all.
     * Returns: ellipsize

--- ref_accessible

    See Atk::Implementor#ref_accessible.

--- set_ellipsize(ellipsize)

    Same as ellipsize=.
     * ellipsize: The preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, if at all.
     * Returns: self

--- add_child

    See Gtk::Buildable#add_child.

--- construct_child

    See Gtk::Buildable#construct_child.

--- get_internal_child

    See Gtk::Buildable#get_internal_child.

--- name

    See Gtk::Buildable#name.

--- name=

    See Gtk::Buildable#name=.

--- set_buildable_property

    See Gtk::Buildable#set_buildable_property.

--- set_name

    See Gtk::Buildable#set_name.

--- builder_name

    See Gtk::Buildable#builder_name.

--- builder_name=

    See Gtk::Buildable#builder_name=.

--- set_builder_name

    See Gtk::Buildable#set_builder_name.

== Constants

=== GtkProgressBarOrientation

--- LEFT_TO_RIGHT

    A horizontal progress bar growing from left to right.

--- RIGHT_TO_LEFT

    A horizontal progress bar growing from right to left.

--- BOTTOM_TO_TOP

    A vertical progress bar growing from bottom to top.

--- TOP_TO_BOTTOM

    A vertical progress bar growing from top to bottom.

== Properties

--- activity-blocks: Integer (Read/Write)

    The number of blocks which can fit in the progress bar area in activity mode (Deprecated)

--- activity-step: Integer (Read/Write)

    The increment used for each iteration in activity mode (Deprecated)

--- adjustment: Gtk::Adjustment (Read/Write)

    The Gtk::Adjustment connected to the progress bar (Deprecated)

--- bar-style: Integer (Read/Write)

    Specifies the visual style of the bar in percentage mode (Deprecated)

--- discrete-blocks: Integer (Read/Write)

    The number of discrete blocks in a progress bar (when shown in the discrete style)

--- fraction: Float (Read/Write)

    The fraction of total work that has been completed

--- orientation: Integer (Read/Write)

    Orientation and growth direction of the progress bar

--- pulse-step: Float (Read/Write)

    The fraction of total progress to move the bouncing block when pulsed

--- text: String (Read/Write)

    Text to be displayed in the progress bar

--- ellipsize: Pango::EllipsizeMode (Read/Write)

    The preferred place to ellipsize the string, if the progress bar does not have enough room to display the entire string, if at all.

== Style Properties

--- xspacing: Integer (Read/Write)

    Extra spacing applied to the width of a progress bar.

--- yspacing: Integer (Read/Write)

    Extra spacing applied to the height of a progress bar.

--- min-horizontal-bar-height: Integer (Read/Write)

    Minimum horizontal height of the progress bar

--- min-horizontal-bar-width: Integer (Read/Write)

    The minimum horizontal width of the progress bar

--- min-vertical-bar-height: Integer (Read/Write)

    The minimum vertical height of the progress bar

--- min-vertical-bar-width: Integer (Read/Write)

    The minimum vertical width of the progress bar

== See Also

== ChangeLog

((<Masao>))