- Prison Code Breaker Diary -

=> aka: Nhật Kí Code Tù

Categories

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 jelir, 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!@

2 comments

  1. Unknown  

    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 !

  2. Pete Houston  

    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.

Post a Comment