summaryrefslogtreecommitdiff
path: root/doc/children.sgml
blob: 718a30bf6fa120b9521c91232ed2df6c32468df1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<refentry id="children" revision="8 Feb 2006">
  <refmeta>
    <refentrytitle>Container Objects</refentrytitle>
    <refmiscinfo>Glade UI</refmiscinfo>
  </refmeta>
  <refnamediv>
    <refname>Containers</refname>
    <refpurpose>
How to add support for hierarchic widget relationships
    </refpurpose>
  </refnamediv>

  <refsect1>
    <title>Defining Containers in the Catalog</title>
    <para>
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.
    </para>
    <para>
Child support definitions are identified by the GType of supported child class and
are embedded into a glade-widget-class block like so:
      <programlisting>
<![CDATA[<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>]]></programlisting>
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.
    </para>
  </refsect1>
  <refsect2>
    <title>Container Relationship Parameter Tag Definitions</title>
    <para>
      <variablelist>
        <varlistentry>
          <term>add-child-function</term>
          <listitem>
            <para>
A #GladeAddChildFunc used to add child objects from parent objects.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>remove-child-function</term>
          <listitem>
            <para>
A #GladeRemoveChildFunc used to remove child objects from parent objects.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>replace-child-function</term>
          <listitem>
            <para>
A #GladeReplaceChildFunc Used to swap placholders with project widgets.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>get-children-function</term>
          <listitem>
            <para>
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.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>child-set-property-function</term>
          <listitem>
            <para>
A #GladeChildSetPropertyFunc to set a packing property on this child.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>child-get-property-function</term>
          <listitem>
            <para>
A #GladeChildGetPropertyFunc to get a packing property on this child.
            </para>
          </listitem>
        </varlistentry>
        <varlistentry>
          <term>special-child-type</term>
          <listitem>
            <para>
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.
            </para>
            <para>
Currently this isnt very neatly done; you must do:
<programlisting>g_object_set_data (child, "special-child-type", type);</programlisting>
when creating special child types and handle it on replace-child; look at glade-gtk.c for 
examples.
            </para>
          </listitem>
        </varlistentry>
      </variablelist>
    </para>
  </refsect2>
</refentry>