Container is an abstract type. You may not instantiate it.
Container, is like a fundamental type, over which many widgets are based on.
Container is an aggregator widget, extended to a Bin and a Box widgets,
which handle only one widget, and one or many widgets respectively.
Though you cannot instantiate a container type directly, you can use
the container API on widgets derived from Container.
A container holds other widget, called child widget.
Container widget has a nice API to add, remove child widgets.
You will interesting in this container API, as it will
help you while working with other widgets derived from
container, mentioned above.
To add widgets use:
void gtk_container_add (GtkContainer *container,
To remove them:
void gtk_container_remove (GtkContainer *container,
Accessors for border width are:
void gtk_container_set_border_width (GtkContainer *container,
guint gtk_container_get_border_width (GtkContainer *container);
Accessors for resize mode:
void gtk_container_set_resize_mode (GtkContainer *container,
GtkResizeMode gtk_container_get_resize_mode (GtkContainer *container);
To get a list of child widgets attached to a Container use this:
GList* gtk_container_get_children (GtkContainer *container);
Iterate through this GList structure, and typecast the list->data pointer
to a GtkWidget pointer and use it like this,
/* Do something with this widget */
and finally free the list.
Choose which widgets get to have a focussable, property.
void gtk_container_set_focus_chain (GtkContainer *container,
gboolean gtk_container_get_focus_chain (GtkContainer *container,
void gtk_container_unset_focus_chain (GtkContainer *container);
To redraw the child widgets, using your expose event of container, y
ou can use this utility function; you dont need this, ifyoure not
void gtk_container_propagate_expose (GtkContainer *container,
These are the application level methods.
Last Modified on Fri Jul 1 19:52:06 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