Like any other GUI Framework, Gtk+ do provide a kind of widget what roles as a container for others, as a mean like parents like children , GtkContainer.
GtkContainer is created as a base class for widgets which contain other widgets.
Reference GtkContainer
There are two types of containers:
+ Decorator
+ Layout
1. Decorator Containers:
+ This type of container is designed for the decorating or customizing other widgets. In a mean, it can contain only one widget and provide the extra-functionality to its child. The known as a type of this is GtkBin.
Reference GtkBin
As you see in the hierarchy, those are inheried from GtkBin include GtkWindow, GtkFrame, GtkButton...
2. Layout Containers:
+ In contrast to Decorator containers, the layout containers can contain more than one child, and the parent container widgets have the functionality to arrange its own children. GtkBox belongs to this type.
Reference GtkBox
Refer to GtkBox hierarchy, you can see 3 classes inherited from it, they are GtkButtonBox, GtkHBox, GtkVBox.
We will cover the them later.
Have fun!@
August 14, 2009 at 3:59 PM
GtkContainer is really important in GTK+. I think this post for GtkContainer is not long enough to see its importance and how it actually work with other widgets. I read several books on GTK+, but none of them really goes into the detail. Try to give some examples accompanied with some important API+ so that the readers can understand it better.
Anyway, nice job buddy :D !
August 14, 2009 at 6:46 PM
Basically, you need to use GtkContainer API only when you need to work w/ its children. However, programmers often access children directly rather than through the parent containers. That's why books on Gtk+ don't mention much about this indirect access, I guess.