GTK+ Reference Manual
<<< Previous Page | Home | Up | Next Page >>>

# GtkProgress

## Name

GtkProgress -- the base class for GtkProgressBar.

## Synopsis

    #include <gtk/gtk.h>

    struct      GtkProgress;
    void        gtk_progress_set_show_text      (GtkProgress *progress,
                                                 gint show_text);
    void        gtk_progress_set_text_alignment (GtkProgress *progress,
                                                 gfloat x_align,
                                                 gfloat y_align);
    void        gtk_progress_set_format_string  (GtkProgress *progress,
                                                 gchar *format);
    void        gtk_progress_set_adjustment     (GtkProgress *progress,
                                                 GtkAdjustment *adjustment);
    void        gtk_progress_set_percentage     (GtkProgress *progress,
                                                 gfloat percentage);
    void        gtk_progress_set_value          (GtkProgress *progress,
                                                 gfloat value);
    gfloat      gtk_progress_get_value          (GtkProgress *progress);
    void        gtk_progress_set_activity_mode  (GtkProgress *progress,
                                                 guint activity_mode);
    gchar*      gtk_progress_get_current_text   (GtkProgress *progress);
    gchar*      gtk_progress_get_text_from_value
                                                (GtkProgress *progress,
                                                 gfloat value);
    gfloat      gtk_progress_get_current_percentage
                                                (GtkProgress *progress);
    gfloat      gtk_progress_get_percentage_from_value
                                                (GtkProgress *progress,
                                                 gfloat value);
    void        gtk_progress_configure          (GtkProgress *progress,
                                                 gfloat value,
                                                 gfloat min,
                                                 gfloat max);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkProgress

## Properties

      "activity-mode"        gboolean             : Read / Write
      "show-text"            gboolean             : Read / Write
      "text-xalign"          gfloat               : Read / Write
      "text-yalign"          gfloat               : Read / Write

## Description

A GtkProgress is the abstract base class used to derive a GtkProgressBar which provides a visual representation of the progress of a long running operation.

## Details

### struct GtkProgress

    struct GtkProgress;

The GtkProgress struct contains private data only. and should be accessed using the functions below.

### gtk_progress_set_show_text ()

    void        gtk_progress_set_show_text      (GtkProgress *progress,
                                                 gint show_text);

Controls whether progress text is shown.

`progress` : | a GtkProgress.
`show_text` : | a boolean indicating whether the progress text is shown.

### gtk_progress_set_text_alignment ()

    void        gtk_progress_set_text_alignment (GtkProgress *progress,
                                                 gfloat x_align,
                                                 gfloat y_align);

Controls the alignment of the text within the progress bar area.

`progress` : | a GtkProgress.
`x_align` : | a number between 0.0 and 1.0 indicating the horizontal alignment of the progress text within the GtkProgress.
`y_align` : | a number between 0.0 and 1.0 indicating the vertical alignment of the progress text within the GtkProgress.

### gtk_progress_set_format_string ()

    void        gtk_progress_set_format_string  (GtkProgress *progress,
                                                 gchar *format);

Sets a format string used to display text indicating the current progress. The string can contain the following substitution characters:

- %`v` - the current progress value.

- %`l` - the lower bound for the progress value.

- %`u` - the upper bound for the progress value.

- %`p` - the current progress percentage.

`progress` : | a GtkProgress.
`format` : | a string used to display progress text.

### gtk_progress_set_adjustment ()

    void        gtk_progress_set_adjustment     (GtkProgress *progress,
                                                 GtkAdjustment *adjustment);

Associates a GtkAdjustment with the GtkProgress. A GtkAdjustment is used to represent the upper and lower bounds and the step interval of the underlying value for which progress is shown.

`progress` : | a GtkProgress.
`adjustment` : | the GtkAdjustment to be associated with the GtkProgress.

### gtk_progress_set_percentage ()

    void        gtk_progress_set_percentage     (GtkProgress *progress,
                                                 gfloat percentage);

Sets the current percentage completion for the GtkProgress.

`progress` : | a GtkProgress.
`percentage` : | the percentage complete which must be between 0.0 and 1.0.

### gtk_progress_set_value ()

    void        gtk_progress_set_value          (GtkProgress *progress,
                                                 gfloat value);

Sets the value within the GtkProgress to an absolute value. The value must be within the valid range of values for the underlying GtkAdjustment.

`progress` : | a GtkProgress.
`value` : | the value indicating the current completed amount.

### gtk_progress_get_value ()

    gfloat      gtk_progress_get_value          (GtkProgress *progress);

Returns the current progress complete value.

`progress` : | a GtkProgress.
Returns : | the current progress complete value.

### gtk_progress_set_activity_mode ()

    void        gtk_progress_set_activity_mode  (GtkProgress *progress,
                                                 guint activity_mode);

A GtkProgress can be in one of two different modes: percentage mode (the default) and activity mode. In activity mode, the progress is simply indicated as activity rather than as a percentage complete.

`progress` : | a GtkProgress.
`activity_mode` : | a boolean, TRUE for activity mode.

### gtk_progress_get_current_text ()

    gchar*      gtk_progress_get_current_text   (GtkProgress *progress);

Returns the current text associated with the GtkProgress. This text is the based on the underlying format string after any substitutions are made.

`progress` : | a GtkProgress.
Returns : | the text indicating the current progress.

### gtk_progress_get_text_from_value ()

    gchar*      gtk_progress_get_text_from_value
                                                (GtkProgress *progress,
                                                 gfloat value);

Returns the text indicating the progress based on the supplied value. The current value for the GtkProgress remains unchanged.

`progress` : | a GtkProgress.
`value` : | an absolute progress value to use when formatting the progress text.
Returns : | a string indicating the progress.

### gtk_progress_get_current_percentage ()

    gfloat      gtk_progress_get_current_percentage
                                                (GtkProgress *progress);

Returns the current progress as a percentage.

`progress` : | a GtkProgress.
Returns : | a number between 0.0 and 1.0 indicating the percentage complete.

### gtk_progress_get_percentage_from_value ()

    gfloat      gtk_progress_get_percentage_from_value
                                                (GtkProgress *progress,
                                                 gfloat value);

Returns the progress as a percentage calculated from the supplied absolute progress value.

`progress` : | a GtkProgress.
`value` : | an absolute progress value.
Returns : | a number between 0.0 and 1.0 indicating the percentage complete represented by `value`.

### gtk_progress_configure ()

    void        gtk_progress_configure          (GtkProgress *progress,
                                                 gfloat value,
                                                 gfloat min,
                                                 gfloat max);

Allows the configuration of the minimum, maximum, and current values for the GtkProgress.

`progress` : | a GtkProgress.
`value` : | the current progress value.
`min` : | the minimum progress value.
`max` : | the maximum progress value.

## Properties

"`activity-mode`" (gboolean : Read / Write)

"`show-text`" (gboolean : Read / Write)

"`text-xalign`" (gfloat : Read / Write)

"`text-yalign`" (gfloat : Read / Write)

<<< Previous Page | Home | Up | Next Page >>>
GtkPreview | GtkProgressBar