statusbar

This widget is used to [as it suggests]
the status of the application.

We can make the widget, to accept text messages
and display one at a time, and we generally
place this widget at the bottom of the application
window.This widget can accpet text messages only
at the time of writing. We have to `push'
data into the widget to set the display text.
Also we must 'pop' the older text to remove it
and the set the newer text. In addition there
is a message priority, that is used to store
many messages and allowing them to stay in memory.
And the messages get displayed, as high priority
messages are absent or are removed.

This concept of priority is implemented in the form
of context-id's. The default context id is 0,
and you need not create [context-id] for using this
default context-id.

You may however register a new context id, and store
messages there. To register a new context id use the 
following API function, and save the context id you get.
guint
gtk_statusbar_get_context_id (GtkStatusbar *statusbar,
			      const gchar  *context_description)

You may push various messages to a particular context-id.
The last pushed, context-id string will show on the status bar.
The return value has the message-id of the statusbar. You may
save this message id, for removing the message from the statusbar.
guint
gtk_statusbar_push (GtkStatusbar *statusbar,
		    guint	  context_id,
		    const gchar  *text)

Returns message_id used for gtk_statusbar_remove 


You can remove messages, last pushed onto the statusbar using this
function, and bring around, the other functions.
void
gtk_statusbar_pop (GtkStatusbar *statusbar,
		   guint	 context_id)

You can also choose to have a resize grip on, or off.
This resize grip property will allow you to basically set the
resize icon, on a statusbar.   This property decides if
the statusbar has a grip for resizing the toplevel window.

void     gtk_statusbar_set_has_resize_grip (GtkStatusbar *statusbar,
					    gboolean      setting);
gboolean gtk_statusbar_get_has_resize_grip (GtkStatusbar *statusbar);


The GtkStatusbar is used like this

* create the widget.
  statusbar=gtk_statusbar_new();

* setting text : pop + push.
  gtk_statusbar_pop(GTK_STATUSBAR(statusbar),
		    0);
  gtk_statusbar_push(GTK_STATUSBAR(statusbar),
		    0,
		    "Hello World");
* removing text	: pop
  gtk_statusbar_pop(GTK_STATUSBAR(statusbar),
		    0);
Simple right?

example code: statusbar.c
see also: 



Last Modified on Sun Jul 3 00:16:53 IST 2005
This is part of the GtkBook project Hosted Here
This code, documents and images are © Muthiah Annamalai
This document is under Creative Commons License given by LICENSE