File: classWt_1_1WTree.html

package info (click to toggle)
witty 3.1.2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,512 kB
  • ctags: 35,832
  • sloc: cpp: 69,469; ansic: 66,945; xml: 4,383; sh: 594; perl: 108; makefile: 106
file content (211 lines) | stat: -rw-r--r-- 18,922 bytes parent folder | download
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt: Wt::WTree Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="pages.html"><span>Related&nbsp;Pages</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
  <div class="navpath"><a class="el" href="namespaceWt.html">Wt</a>::<a class="el" href="classWt_1_1WTree.html">WTree</a>
  </div>
</div>
<div class="contents">
<h1>Wt::WTree Class Reference</h1><!-- doxytag: class="Wt::WTree" --><!-- doxytag: inherits="Wt::WCompositeWidget" -->A widget that represents a navigatable tree.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;Wt/WTree&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WTree:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WTree__inherit__graph.png" border="0" usemap="#Wt_1_1WTree__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WTree__inherit__map">
<area shape="rect" href="classWt_1_1WCompositeWidget.html" title="A widget that hides the implementation of composite widgets." alt="" coords="5,155,165,181"><area shape="rect" href="classWt_1_1WWidget.html" title="The abstract base class for a user&#45;interface component." alt="" coords="37,80,133,107"><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="37,5,133,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="classWt_1_1WTree-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2308f07ae7dfb959360ad1bdcf394e44"></a><!-- doxytag: member="Wt::WTree::WTreeNodeSet" ref="2308f07ae7dfb959360ad1bdcf394e44" args="" -->
typedef std::set&lt; <a class="el" href="classWt_1_1WTreeNode.html">WTreeNode</a> * &gt;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#2308f07ae7dfb959360ad1bdcf394e44">WTreeNodeSet</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Typedef for a set of WTreeNode's. <br></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0814258c8147d68000402468016f9817"></a><!-- doxytag: member="Wt::WTree::WTree" ref="0814258c8147d68000402468016f9817" args="(WContainerWidget *parent=0)" -->
&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#0814258c8147d68000402468016f9817">WTree</a> (<a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Creates a new tree. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#040f5fa4df57cbfb586d686ffe1326d0">setTreeRoot</a> (<a class="el" href="classWt_1_1WTreeNode.html">WTreeNode</a> *root)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the tree root node.  <a href="#040f5fa4df57cbfb586d686ffe1326d0"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WTreeNode.html">WTreeNode</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#54de80f955e54acbab38a344546ce0bf">treeRoot</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the root node.  <a href="#54de80f955e54acbab38a344546ce0bf"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#7270f705ad5f9be1e2bee06a73348a9a">setSelectionMode</a> (<a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc">SelectionMode</a> mode)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets the selection mode.  <a href="#7270f705ad5f9be1e2bee06a73348a9a"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="fcc60067220a91ce69dde46ea413afc5"></a><!-- doxytag: member="Wt::WTree::selectionMode" ref="fcc60067220a91ce69dde46ea413afc5" args="() const " -->
<a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc">SelectionMode</a>&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#fcc60067220a91ce69dde46ea413afc5">selectionMode</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the selection mode. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7d415764d1fce3d4c9d33713892c0ef9"></a><!-- doxytag: member="Wt::WTree::selectedNodes" ref="7d415764d1fce3d4c9d33713892c0ef9" args="() const " -->
const <a class="el" href="classWt_1_1WTree.html#2308f07ae7dfb959360ad1bdcf394e44">WTreeNodeSet</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#7d415764d1fce3d4c9d33713892c0ef9">selectedNodes</a> () const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns the set of selected tree nodes. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="9e09dff326743004dc9f2bf27408551a"></a><!-- doxytag: member="Wt::WTree::select" ref="9e09dff326743004dc9f2bf27408551a" args="(const WTreeNodeSet &amp;nodes)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#9e09dff326743004dc9f2bf27408551a">select</a> (const <a class="el" href="classWt_1_1WTree.html#2308f07ae7dfb959360ad1bdcf394e44">WTreeNodeSet</a> &amp;nodes)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Sets a selection of tree nodes. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="52c770a65ac3f4c2493f714271a5133a"></a><!-- doxytag: member="Wt::WTree::select" ref="52c770a65ac3f4c2493f714271a5133a" args="(WTreeNode *node, bool selected=true)" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#52c770a65ac3f4c2493f714271a5133a">select</a> (<a class="el" href="classWt_1_1WTreeNode.html">WTreeNode</a> *node, bool selected=true)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Selects or unselect the given <em>node</em>. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="3969fd0bab17347bb32727dba2ff9682"></a><!-- doxytag: member="Wt::WTree::isSelected" ref="3969fd0bab17347bb32727dba2ff9682" args="(WTreeNode *node) const " -->
bool&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#3969fd0bab17347bb32727dba2ff9682">isSelected</a> (<a class="el" href="classWt_1_1WTreeNode.html">WTreeNode</a> *node) const </td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Returns if the given <em>node</em> is currently selected. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="14a781edeb90b3040a5e09238290514e"></a><!-- doxytag: member="Wt::WTree::clearSelection" ref="14a781edeb90b3040a5e09238290514e" args="()" -->
void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#14a781edeb90b3040a5e09238290514e">clearSelection</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Clears the current selection. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="103603f639e07f83d1a75e293b70966d"></a><!-- doxytag: member="Wt::WTree::itemSelectionChanged" ref="103603f639e07f83d1a75e293b70966d" args="()" -->
<a class="el" href="classWt_1_1Signal.html">Signal</a> &amp;&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WTree.html#103603f639e07f83d1a75e293b70966d">itemSelectionChanged</a> ()</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Signal that is emitted when the selection changes. <br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A widget that represents a navigatable tree. 
<p>
WTree provides a tree widget, and coordinates selection functionality.<p>
Unlike the MVC-based <a class="el" href="classWt_1_1WTreeView.html" title="A view class that displays a model as a tree or tree table.">WTreeView</a>, the tree renders a widget hierarchy, rather than a hierarhical standard model. This provides extra flexibility (as any widget can be used as contents), at the cost of server-side, client-side and bandwidth resources (especially for large tree tables).<p>
The tree is implemented as a hierarchy of <a class="el" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">WTreeNode</a> widgets.<p>
Selection is rendered by calling <a class="el" href="classWt_1_1WTreeNode.html#e4bb84bf91002f80941d2e890cab12cd" title="Renders the node to be selected.">WTreeNode::renderSelected(bool)</a>. Only tree nodes that are <a class="el" href="classWt_1_1WTreeNode.html#60428cfc48b2a39550efc308b38406b2">selectable</a> may participate in the selection.<p>
Usage example: <div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WIconPair.html" title="A widget that shows one of two icons depending on its state.">Wt::WIconPair</a> *folderIcon = <span class="keyword">new</span> <a class="code" href="classWt_1_1WIconPair.html" title="A widget that shows one of two icons depending on its state.">Wt::WIconPair</a>(<span class="stringliteral">"icons/yellow-folder-closed.png"</span>,
                                               <span class="stringliteral">"icons/yellow-folder-open.png"</span>, <span class="keyword">false</span>);

 <a class="code" href="classWt_1_1WTree.html" title="A widget that represents a navigatable tree.">Wt::WTree</a> *tree = <span class="keyword">new</span> <a class="code" href="classWt_1_1WTree.html" title="A widget that represents a navigatable tree.">Wt::WTree</a>();
 tree-&gt;<a class="code" href="classWt_1_1WTree.html#7270f705ad5f9be1e2bee06a73348a9a" title="Sets the selection mode.">setSelectionMode</a>(<a class="code" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc4fd3c5ba6ce5289a1e732d85f002882a" title="Single selection only.">Wt::SingleSelection</a>);

 <a class="code" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">Wt::WTreeNode</a> *root = <span class="keyword">new</span> <a class="code" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">Wt::WTreeNode</a>(<span class="stringliteral">"Tree root"</span>, folderIcon);
 root-&gt;<a class="code" href="classWt_1_1WCompositeWidget.html#f9a8abf4e8b5be186a31cd951e60bdc6" title="Sets (one or more) CSS style classes.">setStyleClass</a>(<span class="stringliteral">"example-tree"</span>);
 tree-&gt;<a class="code" href="classWt_1_1WTree.html#040f5fa4df57cbfb586d686ffe1326d0" title="Sets the tree root node.">setTreeRoot</a>(root);
 root-&gt;<a class="code" href="classWt_1_1WTreeNode.html#32c24104359b595cbaf914e35accb3b4" title="Returns the label.">label</a>()-&gt;setTextFormat(<a class="code" href="namespaceWt.html#140dea437d52d3d7c438ea3bd16a1480e06bb9ae9a26d13c3dcf9f20d5067885" title="Format text as plain text.">Wt::PlainText</a>);
 root-&gt;<a class="code" href="classWt_1_1WTreeNode.html#ff37a6152a8195dd9b2a80e593d94298" title="Sets the image pack for this (sub)tree (deprecated).">setImagePack</a>(<span class="stringliteral">"resources/"</span>);
 root-&gt;<a class="code" href="classWt_1_1WTreeNode.html#af3d613cc461f4d9d39a71cd45bd155e" title="Sets the load policy for this tree.">setLoadPolicy</a>(<a class="code" href="classWt_1_1WTreeNode.html#51c02b42c069e61a269fde598b9a1bff387323cbdc8efd12ef6bf8553876c011" title="Pre-load one level of child nodes.">Wt::WTreeNode::NextLevelLoading</a>);
 root-&gt;<a class="code" href="classWt_1_1WTreeNode.html#deb2bd7c946ef9c7bb5b72b3f88453a6" title="Adds a child node.">addChildNode</a>(<span class="keyword">new</span> <a class="code" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">Wt::WTreeNode</a>(<span class="stringliteral">"one"</span>));
 root-&gt;<a class="code" href="classWt_1_1WTreeNode.html#deb2bd7c946ef9c7bb5b72b3f88453a6" title="Adds a child node.">addChildNode</a>(<span class="keyword">new</span> <a class="code" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">Wt::WTreeNode</a>(<span class="stringliteral">"two"</span>));

 <a class="code" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">Wt::WTreeNode</a> *three = <span class="keyword">new</span> <a class="code" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">Wt::WTreeNode</a>(<span class="stringliteral">"three"</span>);
 three-&gt;<a class="code" href="classWt_1_1WTreeNode.html#deb2bd7c946ef9c7bb5b72b3f88453a6" title="Adds a child node.">addChildNode</a>(<span class="keyword">new</span> WTreeNode(<span class="stringliteral">"three: one"</span>));
 three-&gt;<a class="code" href="classWt_1_1WTreeNode.html#deb2bd7c946ef9c7bb5b72b3f88453a6" title="Adds a child node.">addChildNode</a>(<span class="keyword">new</span> WTreeNode(<span class="stringliteral">"three: two"</span>));
 root-&gt;<a class="code" href="classWt_1_1WTreeNode.html#deb2bd7c946ef9c7bb5b72b3f88453a6" title="Adds a child node.">addChildNode</a>(three);

 root-&gt;<a class="code" href="classWt_1_1WTreeNode.html#10e99f9db96ec2fc500927a5d50caafe" title="Expands this node.">expand</a>();
</pre></div><p>
<h3>CSS</h3>
<p>
The tree is styled by the current CSS theme. The look can be overridden using the <code>Wt-tree</code> CSS class. The style selectors that affect the rendering of the decoration of the nodes are indicated in the documentation for <a class="el" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">WTreeNode</a>. In addition, the following selector may be used to style the header:<p>
<div class="fragment"><pre class="fragment">
.Wt-tree .Wt-selected : selected item
</pre></div><p>
A screenshot of the tree: <table border="0" align="center" cellspacing="3" cellpadding="3">
<tr>
<td><div align="center">
<img src="WTree-default-1.png" alt="WTree-default-1.png">
<p><strong>An example WTree (default)</strong></p></div>
  </td><td><div align="center">
<img src="WTree-polished-1.png" alt="WTree-polished-1.png">
<p><strong>An example WTree (polished)</strong></p></div>
   </td></tr>
</table>
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WTreeNode.html" title="A single node in a tree.">WTreeNode</a>, <a class="el" href="classWt_1_1WTreeTable.html" title="A table with a navigatable tree in the first column.">WTreeTable</a>, <a class="el" href="classWt_1_1WTreeView.html" title="A view class that displays a model as a tree or tree table.">WTreeView</a> </dd></dl>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="040f5fa4df57cbfb586d686ffe1326d0"></a><!-- doxytag: member="Wt::WTree::setTreeRoot" ref="040f5fa4df57cbfb586d686ffe1326d0" args="(WTreeNode *root)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WTree::setTreeRoot           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classWt_1_1WTreeNode.html">WTreeNode</a> *&nbsp;</td>
          <td class="paramname"> <em>root</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the tree root node. 
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WTree.html#54de80f955e54acbab38a344546ce0bf" title="Returns the root node.">treeRoot()</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="54de80f955e54acbab38a344546ce0bf"></a><!-- doxytag: member="Wt::WTree::treeRoot" ref="54de80f955e54acbab38a344546ce0bf" args="() const " -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classWt_1_1WTreeNode.html">WTreeNode</a>* Wt::WTree::treeRoot           </td>
          <td>(</td>
          <td class="paramname">          </td>
          <td>&nbsp;)&nbsp;</td>
          <td> const<code> [inline]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Returns the root node. 
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WTree.html#040f5fa4df57cbfb586d686ffe1326d0" title="Sets the tree root node.">setTreeRoot(WTreeNode *)</a> </dd></dl>

</div>
</div><p>
<a class="anchor" name="7270f705ad5f9be1e2bee06a73348a9a"></a><!-- doxytag: member="Wt::WTree::setSelectionMode" ref="7270f705ad5f9be1e2bee06a73348a9a" args="(SelectionMode mode)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Wt::WTree::setSelectionMode           </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bccc">SelectionMode</a>&nbsp;</td>
          <td class="paramname"> <em>mode</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Sets the selection mode. 
<p>
The default selection mode is <a class="el" href="namespaceWt.html#74b3f7eb1689a3cbf0ea514ffd20bcccb681964d34d71d850361461bafc46891" title="No selections.">Wt::NoSelection</a>. 
</div>
</div><p>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:07 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>