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 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310
|
<!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::WSubMenuItem 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 Page</span></a></li>
<li><a href="pages.html"><span>Related 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 List</span></a></li>
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
<li><a href="functions.html"><span>Class Members</span></a></li>
</ul>
</div>
<div class="navpath"><a class="el" href="namespaceWt.html">Wt</a>::<a class="el" href="classWt_1_1WSubMenuItem.html">WSubMenuItem</a>
</div>
</div>
<div class="contents">
<h1>Wt::WSubMenuItem Class Reference</h1><!-- doxytag: class="Wt::WSubMenuItem" --><!-- doxytag: inherits="Wt::WMenuItem" -->A menu item that contains a nested sub menu.
<a href="#_details">More...</a>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WSubMenuItem:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WSubMenuItem__inherit__graph.png" border="0" usemap="#Wt_1_1WSubMenuItem__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WSubMenuItem__inherit__map">
<area shape="rect" href="classWt_1_1WMenuItem.html" title="A single item in a menu." alt="" coords="17,80,132,107"><area shape="rect" href="classWt_1_1WObject.html" title="A base class for objects that participate in the signal/slot system." alt="" coords="27,5,123,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classWt_1_1WSubMenuItem-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 Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#0c56dcd20f9d6afaaf289d2270e3b296">WSubMenuItem</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &text, <a class="el" href="classWt_1_1WWidget.html">WWidget</a> *contents, <a class="el" href="classWt_1_1WMenuItem.html#5e276ed0505694a7b89a1dd0c62aa55a">LoadPolicy</a> policy=LazyLoading)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new item. <a href="#0c56dcd20f9d6afaaf289d2270e3b296"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#33eccd31a4aa8436cf66effa2cecf94b">setSubMenu</a> (<a class="el" href="classWt_1_1WMenu.html">WMenu</a> *subMenu)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets a sub menu. <a href="#33eccd31a4aa8436cf66effa2cecf94b"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WMenu.html">WMenu</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#a30469d72bfdec0c85181f012e269e9f">subMenu</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the sub menu. <a href="#a30469d72bfdec0c85181f012e269e9f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#f774d49f24f2ee362cc28eb688cb9eef">pathComponent</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the path component for this item. <a href="#f774d49f24f2ee362cc28eb688cb9eef"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classWt_1_1WWidget.html">WWidget</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#3883ce17fd7d04553510700189fbc7af">createItemWidget</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates the widget that represents the item. <a href="#3883ce17fd7d04553510700189fbc7af"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#44820d1555db0e1f6593dd80d1c0b34e">updateItemWidget</a> (<a class="el" href="classWt_1_1WWidget.html">WWidget</a> *itemWidget)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Updates the widget that represents the item. <a href="#44820d1555db0e1f6593dd80d1c0b34e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#d3096bef2abbc291cb2560cd16d92458">renderSelected</a> (bool selected)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Renders the item as selected or unselected. <a href="#d3096bef2abbc291cb2560cd16d92458"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual SignalBase & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WSubMenuItem.html#38d7a0fa3581f34aa72c9fd4d1a6eaeb">activateSignal</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the signal used to activate the item. <a href="#38d7a0fa3581f34aa72c9fd4d1a6eaeb"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A menu item that contains a nested sub menu.
<p>
This class specializes menu item to have an optional sub menu.<p>
When the item is shown and hidden when the item is selected respectively deselected.<p>
Usage example: <div class="fragment"><pre class="fragment"> <span class="comment">// create the stack where the contents will be located</span>
<a class="code" href="classWt_1_1WStackedWidget.html" title="A container widget that stacks its widgets on top of each other.">Wt::WStackedWidget</a> *contents = <span class="keyword">new</span> <a class="code" href="classWt_1_1WStackedWidget.html" title="A container widget that stacks its widgets on top of each other.">Wt::WStackedWidget</a>();
<span class="comment">// create a top-level menu</span>
<a class="code" href="classWt_1_1WMenu.html" title="A widget that shows a menu of options.">Wt::WMenu</a> *menu = <span class="keyword">new</span> <a class="code" href="classWt_1_1WMenu.html" title="A widget that shows a menu of options.">Wt::WMenu</a>(contents, <a class="code" href="namespaceWt.html#2a8d45559e16a0185bf61bfad0a67912f916b7ec24727db2d972f0770170c7f5" title="Vertical.">Wt::Vertical</a>);
<span class="comment">// add two plain items</span>
menu-><a class="code" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem</a>(<span class="stringliteral">"Introduction"</span>, <span class="keyword">new</span> <a class="code" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">Wt::WText</a>(tr(<span class="stringliteral">"intro"</span>));
menu-><a class="code" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem</a>(<span class="stringliteral">"Download"</span>, <span class="keyword">new</span> <a class="code" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">Wt::WText</a>(<span class="stringliteral">"Not yet available"</span>));
<span class="comment">// add an item with a sub menu</span>
<a class="code" href="classWt_1_1WSubMenuItem.html" title="A menu item that contains a nested sub menu.">Wt::WSubMenuItem</a> *examples = <span class="keyword">new</span> <a class="code" href="classWt_1_1WSubMenuItem.html" title="A menu item that contains a nested sub menu.">Wt::WSubMenuItem</a>(<span class="stringliteral">"Examples"</span>, <span class="keyword">new</span> <a class="code" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">Wt::WText</a>(tr(<span class="stringliteral">"examples"</span>)));
<a class="code" href="classWt_1_1WMenu.html" title="A widget that shows a menu of options.">Wt::WMenu</a> *examplesMenu = <span class="keyword">new</span> <a class="code" href="classWt_1_1WMenu.html" title="A widget that shows a menu of options.">Wt::WMenu</a>(contents, <a class="code" href="namespaceWt.html#2a8d45559e16a0185bf61bfad0a67912f916b7ec24727db2d972f0770170c7f5" title="Vertical.">Wt::Vertical</a>);
examplesMenu-><a class="code" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem</a>(<span class="stringliteral">"Hello world"</span>, <span class="keyword">new</span> <a class="code" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">Wt::WText</a>(tr(<span class="stringliteral">"example.hello-world"</span>)));
examplesMenu-><a class="code" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem</a>(<span class="stringliteral">"Shopping cart"</span>, <span class="keyword">new</span> <a class="code" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">Wt::WText</a>(tr(<span class="stringliteral">"example.shopping"</span>)));
examples-><a class="code" href="classWt_1_1WSubMenuItem.html#33eccd31a4aa8436cf66effa2cecf94b" title="Sets a sub menu.">setSubMenu</a>(examplesMenu);
menu-><a class="code" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem</a>(examples);
addWidget(menu);
addWidget(contents);
</pre></div><p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">WMenuItem</a>, <a class="el" href="classWt_1_1WMenu.html" title="A widget that shows a menu of options.">WMenu</a> </dd></dl>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="0c56dcd20f9d6afaaf289d2270e3b296"></a><!-- doxytag: member="Wt::WSubMenuItem::WSubMenuItem" ref="0c56dcd20f9d6afaaf289d2270e3b296" args="(const WString &text, WWidget *contents, LoadPolicy policy=LazyLoading)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WSubMenuItem::WSubMenuItem </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> & </td>
<td class="paramname"> <em>text</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> * </td>
<td class="paramname"> <em>contents</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WMenuItem.html#5e276ed0505694a7b89a1dd0c62aa55a">LoadPolicy</a> </td>
<td class="paramname"> <em>policy</em> = <code>LazyLoading</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates a new item.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenuItem.html#772f165f3dc02138c28d74f1f42d1a45" title="Creates a new item.">WMenuItem::WMenuItem(const WString&, WWidget *, LoadPolicy)</a> </dd></dl>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="33eccd31a4aa8436cf66effa2cecf94b"></a><!-- doxytag: member="Wt::WSubMenuItem::setSubMenu" ref="33eccd31a4aa8436cf66effa2cecf94b" args="(WMenu *subMenu)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WSubMenuItem::setSubMenu </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WMenu.html">WMenu</a> * </td>
<td class="paramname"> <em>subMenu</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets a sub menu.
<p>
Ownership of the <code>subMenu</code> is transferred to the item. In most cases, the sub menu would use the same contents stack as the parent menu.<p>
The default submenu is <code>0</code>, in which case the item behaves as a plain <a class="el" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">WMenuItem</a>.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>A sub menu can only be set before the item is added to a menu. </dd></dl>
</div>
</div><p>
<a class="anchor" name="a30469d72bfdec0c85181f012e269e9f"></a><!-- doxytag: member="Wt::WSubMenuItem::subMenu" ref="a30469d72bfdec0c85181f012e269e9f" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WMenu.html">WMenu</a>* Wt::WSubMenuItem::subMenu </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the sub menu.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WSubMenuItem.html#33eccd31a4aa8436cf66effa2cecf94b" title="Sets a sub menu.">setSubMenu()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="f774d49f24f2ee362cc28eb688cb9eef"></a><!-- doxytag: member="Wt::WSubMenuItem::pathComponent" ref="f774d49f24f2ee362cc28eb688cb9eef" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string Wt::WSubMenuItem::pathComponent </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the path component for this item.
<p>
You may want to reimplement this to customize the path component set by the item in the application internal path.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenuItem.html#4291756303dbf128b718679cdb907a5a" title="Sets the path component for this item.">setPathComponent()</a> </dd></dl>
<p>Reimplemented from <a class="el" href="classWt_1_1WMenuItem.html#5ab0b5430b9fb852a45886deb0ff01b1">Wt::WMenuItem</a>.</p>
</div>
</div><p>
<a class="anchor" name="3883ce17fd7d04553510700189fbc7af"></a><!-- doxytag: member="Wt::WSubMenuItem::createItemWidget" ref="3883ce17fd7d04553510700189fbc7af" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> * Wt::WSubMenuItem::createItemWidget </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Creates the widget that represents the item.
<p>
The default implementation will simply return a <a class="el" href="classWt_1_1WAnchor.html" title="A widget that represents an HTML anchor (to link to other documents).">WAnchor</a>. A call to <a class="el" href="classWt_1_1WSubMenuItem.html#3883ce17fd7d04553510700189fbc7af" title="Creates the widget that represents the item.">createItemWidget()</a> is immediately followed by <a class="el" href="classWt_1_1WSubMenuItem.html#44820d1555db0e1f6593dd80d1c0b34e" title="Updates the widget that represents the item.">updateItemWidget()</a>.<p>
If you reimplement this method, you should probably also reimplement <a class="el" href="classWt_1_1WSubMenuItem.html#44820d1555db0e1f6593dd80d1c0b34e" title="Updates the widget that represents the item.">updateItemWidget()</a>.
<p>Reimplemented from <a class="el" href="classWt_1_1WMenuItem.html#5dd1286e97b110b621e00e02e58a15d2">Wt::WMenuItem</a>.</p>
</div>
</div><p>
<a class="anchor" name="44820d1555db0e1f6593dd80d1c0b34e"></a><!-- doxytag: member="Wt::WSubMenuItem::updateItemWidget" ref="44820d1555db0e1f6593dd80d1c0b34e" args="(WWidget *itemWidget)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WSubMenuItem::updateItemWidget </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WWidget.html">WWidget</a> * </td>
<td class="paramname"> <em>itemWidget</em> </td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Updates the widget that represents the item.
<p>
The default implementation will cast the <code>itemWidget</code> to a <a class="el" href="classWt_1_1WAnchor.html" title="A widget that represents an HTML anchor (to link to other documents).">WAnchor</a>, and set the anchor's text and destination according to <a class="el" href="classWt_1_1WMenuItem.html#2061c3c242e98e53c820bfa500db492c" title="Returns the text for this item.">text()</a> and <a class="el" href="classWt_1_1WSubMenuItem.html#f774d49f24f2ee362cc28eb688cb9eef" title="Returns the path component for this item.">pathComponent()</a>.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WSubMenuItem.html#3883ce17fd7d04553510700189fbc7af" title="Creates the widget that represents the item.">createItemWidget()</a> </dd></dl>
<p>Reimplemented from <a class="el" href="classWt_1_1WMenuItem.html#df18031f469001bdd5333cff0a66a9a4">Wt::WMenuItem</a>.</p>
</div>
</div><p>
<a class="anchor" name="d3096bef2abbc291cb2560cd16d92458"></a><!-- doxytag: member="Wt::WSubMenuItem::renderSelected" ref="d3096bef2abbc291cb2560cd16d92458" args="(bool selected)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WSubMenuItem::renderSelected </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>selected</em> </td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Renders the item as selected or unselected.
<p>
The default implementation sets the styleclass for <a class="el" href="classWt_1_1WMenuItem.html#185b334943c3e07d63d3e45a17e960f7" title="Returns the widget that represents the item.">itemWidget()</a> to 'item' for an unselected, and 'itemselected' for a selected item.<p>
Note that this method is called from within a stateless slot implementation, and thus should be stateless as well.
<p>Reimplemented from <a class="el" href="classWt_1_1WMenuItem.html#3af62f2a97827c844e021ad2dd3f6085">Wt::WMenuItem</a>.</p>
</div>
</div><p>
<a class="anchor" name="38d7a0fa3581f34aa72c9fd4d1a6eaeb"></a><!-- doxytag: member="Wt::WSubMenuItem::activateSignal" ref="38d7a0fa3581f34aa72c9fd4d1a6eaeb" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">SignalBase & Wt::WSubMenuItem::activateSignal </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the signal used to activate the item.
<p>
The default implementation will tries to cast the <a class="el" href="classWt_1_1WMenuItem.html#185b334943c3e07d63d3e45a17e960f7" title="Returns the widget that represents the item.">itemWidget()</a> to a <a class="el" href="classWt_1_1WInteractWidget.html" title="An abstract widget that can receive user-interface interaction.">WInteractWidget</a> and returns the <a class="el" href="classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked signal</a>.
<p>Reimplemented from <a class="el" href="classWt_1_1WMenuItem.html#5f1d03e160011fcd39759b681f8bc063">Wt::WMenuItem</a>.</p>
</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 <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>
|