The implementation of windowless widgets is slightly
different from the implementation of "normal" widgets.
Windowless widgets must set the
GTK_NO_WINDOW flag, so GTK+ can treat them
appropriately. This should be done in the init function:
gtk_box_init (GtkBox *box)
GTK_WIDGET_SET_FLAGS (box, GTK_NO_WINDOW);
box->children = NULL;
box->spacing = 0;
box->homogeneous = FALSE;
GtkBox uses the default
realize method described in the section
called Realization; because no GdkWindow needs to be created, a
rarely needs a realize method. Recall that the default
realize implementation sets the windowless widget's window field to the parent
widget's window field.
Because boxes are invisible layout containers, the GtkBox draw and expose
implementations simply pass the draw or expose request on
to the box's children. This is identical to GtkBin's draw and expose
implementations, except that there's a list of children
to iterate over.
A GTK_NO_WINDOW widget
that isn't invisible, such as GtkLabel, should be careful not to
draw a background; the parent widget's background is