Gnome User Interface Library Reference Manual
<<< Previous Page | Home | Up |

# GnomeProcBar

## Name

GnomeProcBar -- Gnome Process Bar

## Synopsis

    #include <gnome.h>

    struct      GnomeProcBar;
    #define     GNOME_PROC_BAR__CLASS           (klass)
    GtkWidget*  gnome_proc_bar_new              (GtkWidget *label,
                                                 gint n,
                                                 GdkColor *colors,
                                                 gint (*cb) ());
    void        gnome_proc_bar_set_values       (GnomeProcBar *pb,
                                                 unsigned val[]);
    void        gnome_proc_bar_set_orient       (GnomeProcBar *pb,
                                                 gboolean vertical);
    void        gnome_proc_bar_start            (GnomeProcBar *pb,
                                                 gint gtime,
                                                 gpointer data);
    void        gnome_proc_bar_stop             (GnomeProcBar *pb);
    void        gnome_proc_bar_update           (GnomeProcBar *pb,
                                                 GdkColor *colors);

## Object Hierarchy

      GtkObject
       +----GtkWidget
             +----GtkContainer
                   +----GtkBox
                         +----GtkHBox
                               +----GnomeProcBar

## Description

The GnomeProcBar widget is used to display load graphs like cpu usage, memory and swap load. It is for instance used in the cpumemusage applet and in GTop.

## Details

### struct GnomeProcBar

    struct GnomeProcBar;

### GNOME_PROC_BAR__CLASS()

    #define GNOME_PROC_BAR__CLASS(klass)	GTK_CHECK_CLASS_CAST (klass, gnome_proc_bar_get_type (), GnomeProcBarClass)

`klass` : |

### gnome_proc_bar_new ()

    GtkWidget*  gnome_proc_bar_new              (GtkWidget *label,
                                                 gint n,
                                                 GdkColor *colors,
                                                 gint (*cb) ());

Creates a new Gnome Process Bar with `n` items with the colors of `colors`. To do automatic updating, you set the `cb` to a function which takes a single void pointer as an argument and returns `TRUE` or `FALSE`. When it returns `FALSE` the timer stops running and the function stops getting called. You need to call gnome_proc_bar_start with the time interval and the data argument that will be passed to the callback to actually start executing the timer.

`label` : | Either `NULL` or a GtkWidget that will be shown at the left side of the process bar.
`n` : | Number of items.
`colors` : | Pointer to an array of `n` GdkColor elements.
`cb` : | Callback function to update the process bar.
Returns : | The newly created GnomeProcBar widget.

### gnome_proc_bar_set_values ()

    void        gnome_proc_bar_set_values       (GnomeProcBar *pb,
                                                 unsigned val[]);

Set the values of `pb` to `val` and redraw it. You will probably call this function in the callback to update the values.

`pb` : | Pointer to a GnomeProcBar object
`Param2` : |

### gnome_proc_bar_set_orient ()

    void        gnome_proc_bar_set_orient       (GnomeProcBar *pb,
                                                 gboolean vertical);

Sets the orientation of `pb` to vertical if `vertical` is `TRUE` or to horizontal if `vertical` is `FALSE`.

`pb` : | Pointer to a GnomeProcBar object
`vertical` : | `TRUE` if vertical `FALSE` if horizontal

### gnome_proc_bar_start ()

    void        gnome_proc_bar_start            (GnomeProcBar *pb,
                                                 gint gtime,
                                                 gpointer data);

Start a timer, and call the callback that was set on gnome_proc_bar_new with the `data`.

`pb` : | Pointer to a GnomeProcBar object
`gtime` : | time interval in ms
`data` : | data to the callback

### gnome_proc_bar_stop ()

    void        gnome_proc_bar_stop             (GnomeProcBar *pb);

Stop running the callback in the timer.

`pb` : | Pointer to a GnomeProcBar object

### gnome_proc_bar_update ()

    void        gnome_proc_bar_update           (GnomeProcBar *pb,
                                                 GdkColor *colors);

Update `pb` with `colors`. `pb` is not redrawn, it is only redrawn when you call gnome_proc_bar_set_values

`pb` : | Pointer to a GnomeProcBar object
`colors` : | Pointer to an array of `pb`->n GdkColor elements

<<< Previous Page | Home | Up |
GnomeDockLayout |