summaryrefslogtreecommitdiff
path: root/doc/mallard/C/mal_block_tree.page
blob: 65da596dd0d6965314da23b1ddf939f0cda41cf8 (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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
<page xmlns="http://projectmallard.org/1.0/"
      type="topic"
      id="mal_block_tree">

<info>
  <revision version="0.1" date="2009-05-25" status="review"/>

  <credit type="author">
    <name>Shaun McCance</name>
    <email>shaunm@gnome.org</email>
  </credit>
  <copyright>
    <year>2008-2009</year>
    <name>Shaun McCance</name>
  </copyright>

  <include href="legal.xml" xmlns="http://www.w3.org/2001/XInclude" />

  <desc>Create simple trees to show heirarchical structures.</desc>
</info>

<title>Tree Lists</title>

<synopsis><code mime="application/relax-ng-compact-syntax">
mal_block_tree = element tree {
  attribute style { xsd:NMTOKENS } ?,
  attribute * - (mal:* | local:*) { text } *,

  <link xref="mal_block_title">mal_block_title</link> ?,
  mal_tree_item +
}
mal_tree_item = element item {
  attribute style { xsd:NMTOKENS } ?,
  attribute * - (mal:* | local:*) { text } *,

  <link xref="mal_inline">mal_inline</link>,
  mal_tree_item *
}
</code></synopsis>

<p>Use the <code>tree</code> element to create a heirarchical tree.  While
conceptually similar to nested <code xref="mal_block_list">list</code>
elements, trees offer a simple way to display common heirarchies such as
class inheritance or directory layouts.</p>


<!-- BEGIN notes -->
<section id="notes">
  <title>Notes</title>
  <list>
    <item><p>The <code>tree</code> element can contain an optional
    <code xref="mal_block_title">title</code> element followed by one or more
    <code>item</code> elements.  Each child <code>item</code> element can
    contain a mixture of text and any
    <link xref="mal_inline">general inline elements</link>, followed by
    zero or more nested <code>item</code> elements.</p></item>

    <item><p>The <code>tree</code> element can occur in any
    general block context, including inside
    <link xref="mal_page">pages</link>, <link xref="mal_section">sections</link>,
    and certain <link xref="mal_block">block elements</link>.</p></item>

    <item><p>The <code>style</code> attribute takes a space-separated list of
    style hints.  Processing tools should adjust their behavior according to
    those style hints they understand.</p></item>

    <item>
      <p>The following style hints are recommended:</p>
      <table rules="rows">
        <tr>
          <td><p><code>lines</code></p></td>
          <td><p>draw lines to show the hierarchy</p></td>
        </tr>
      </table>
    </item>

    <item><p>The <code>tree</code> element can have attributes from external
    namespaces.  See <link xref="mal_external"/> for more information
    on external-namespace attributes.</p></item>
  </list>
</section>
<!-- END notes -->


<!-- BEGIN examples -->
<section id="examples">
  <title>Examples</title>

  <p>Use a tree to outline a class heirarchy inside a
  <code xref="mal_block_synopsis">>synopsis</code> element:</p>

  <example>
    <code><![CDATA[
<synopsis>
  <tree>
    <item>
      <code>GtkBin</code>
      <item>
        <code>GtkButton</code>
        <item><code>GtkToggleButton</code></item>
        <item><code>GtkColorButton</code></item>
        <item><code>GtkFontButton</code></item>
        <item><code>GtkLinkButton</code></item>
        <item><code>GtkOptionMenu</code></item>
        <item><code>GtkScaleButton</code></item>
      </item>
    </item>
  </tree>
</synopsis>]]></code>
    <synopsis>
      <tree>
        <item>
          <code>GtkBin</code>
          <item>
            <code>GtkButton</code>
            <item><code>GtkToggleButton</code></item>
            <item><code>GtkColorButton</code></item>
            <item><code>GtkFontButton</code></item>
            <item><code>GtkLinkButton</code></item>
            <item><code>GtkOptionMenu</code></item>
            <item><code>GtkScaleButton</code></item>
          </item>
        </item>
      </tree>
    </synopsis>
  </example>

  <p>Use the <code>lines</code> style hint to visually show the tree structure:</p>

  <example>
    <code><![CDATA[
<tree style="lines">
  <item>
    Anatinae (dabbling ducks)
    <item>
      Anas
      <item>Baikal Teal</item>
      <item>Wigeons</item>
      <item>Mallard</item>
    </item>
    <item>Lophonetta</item>
    <item>Speculanas</item>
  </item>
  <item>
    Anthyinae (diving ducks)
    <item>Aythya</item>
    <item>Netta</item>
  </item>
  <item>Dendrocygninae (whistling ducks)</item>
</tree>]]></code>
    <tree style="lines">
      <item>
        Anatinae (dabbling ducks)
        <item>
          Anas
          <item>Baikal Teal</item>
          <item>Wigeons</item>
          <item>Mallard</item>
        </item>
        <item>Lophonetta</item>
        <item>Speculanas</item>
      </item>
      <item>
        Anthyinae (diving ducks)
        <item>Aythya</item>
        <item>Netta</item>
      </item>
      <item>Dendrocygninae (whistling ducks)</item>
    </tree>
  </example>
</section>
<!-- END examples -->


<!-- BEGIN processing -->
<section id="processing">
  <title>Processing Expectations</title>

  <p>Tree lists are display as block elements.  Each child <code>item</code>
  has its leading inline content displayed in a single block and any nested
  <code>item</code> elements displayed as blocks in turn.  Successive levels
  of nesting should yield more indentation, though this may vary based on
  style hints or other factors.  By default, there should be little vertical
  spacing between items; trees are compact.  No bullets, icons, or other marks
  are expected to precede items, although they may be used for certain style
  hints.</p>
</section>
<!-- END processing -->

</page>