## Container Objects

Containers — How to add support for hierarchic widget relationships

## Defining Containers in the Catalog

GtkContainer objects which parent GtkWidget objects have built-in detection in the glade core; but other container relationships may be constructed; if for example you wished to treat a GtkMenuBar --> GtkMenuItem relationship specially in the plugin; Any GObject can parent any GObject. The default GtkContainer --> GtkWidget relationship can also be modified for a GtkContainer derived object.

Child support definitions are identified by the GType of supported child class and are embedded into a glade-widget-class block like so:

    <glade-widget-class name="Foo">

      <children>
        <child>
        <type>Bar</type>

          ... 'Foo --> Bar' container relationship parameters go here

          <properties>

            ... packing property definition for this container relationship

          </properties>

        </child>

        ... more child definitions here ...

      </children>

    </glade-widget-class>

Note that you can access and modify and even add virtual packing properties in exactly the same way as previously described with normal object properties.

### Container Relationship Parameter Tag Definitions

add-child-function | A GladeAddChildFunc used to add child objects from parent objects.
remove-child-function | A GladeRemoveChildFunc used to remove child objects from parent objects.
replace-child-function | A GladeReplaceChildFunc Used to swap placholders with project widgets.
get-children-function | A GladeGetChildrenFunc to return a list of children for this container. If you have any anarchist internal children; they should be listed here along with normal children.
child-set-property-function | A GladeChildSetPropertyFunc to set a packing property on this child.
child-get-property-function | A GladeChildGetPropertyFunc to get a packing property on this child.

special-child-type

A special type identifier that will indicate whether this is an alternate child type; such as a notebook tab label or a frame label. The value of special-child-type is the name of the added packing property for this child type; you must then use the type to add children to the "correct port" at load time.

Currently this isnt very neatly done; you must do:

    g_object_set_data (child, "special-child-type", type);

when creating special child types and handle it on replace-child; look at glade-gtk.c for examples.