Gnome User Interface Library Reference Manual | |||
---|---|---|---|
<<< Previous Page | Home | Up |
#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, const guint 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); |
GtkObject +----GtkWidget +----GtkContainer +----GtkBox +----GtkHBox +----GnomeProcBar |
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.
#define GNOME_PROC_BAR__CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GNOME_TYPE_PROC_BAR, GnomeProcBarClass)) |
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. |
void gnome_proc_bar_set_values (GnomeProcBar *pb, const guint 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 : |
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 |
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 |
void gnome_proc_bar_stop (GnomeProcBar *pb); |
Stop running the callback in the timer.
pb : | Pointer to a GnomeProcBar object |
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 |