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 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628
|
<!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::WMenu 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_1WMenu.html">WMenu</a>
</div>
</div>
<div class="contents">
<h1>Wt::WMenu Class Reference</h1><!-- doxytag: class="Wt::WMenu" --><!-- doxytag: inherits="Wt::WCompositeWidget" -->A widget that shows a menu of options.
<a href="#_details">More...</a>
<p>
<code>#include <Wt/WMenu></code>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WMenu:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WMenu__inherit__graph.png" border="0" usemap="#Wt_1_1WMenu__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WMenu__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-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_1WMenu-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_1WMenu.html#edc7dcfb468fedd82eb6e01ddcdd3f77">WMenu</a> (<a class="el" href="classWt_1_1WStackedWidget.html">WStackedWidget</a> *contentsStack, <a class="el" href="namespaceWt.html#2a8d45559e16a0185bf61bfad0a67912">Orientation</a> orientation, <a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Creates a new menu. <a href="#edc7dcfb468fedd82eb6e01ddcdd3f77"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7e2fef60ee49edaa9056b3284964576e"></a><!-- doxytag: member="Wt::WMenu::~WMenu" ref="7e2fef60ee49edaa9056b3284964576e" args="()" -->
</td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#7e2fef60ee49edaa9056b3284964576e">~WMenu</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d">addItem</a> (const <a class="el" href="classWt_1_1WString.html">WString</a> &name, <a class="el" href="classWt_1_1WWidget.html">WWidget</a> *contents, <a class="el" href="classWt_1_1WMenuItem.html#5e276ed0505694a7b89a1dd0c62aa55a">WMenuItem::LoadPolicy</a> policy=WMenuItem::LazyLoading)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Adds an item. <a href="#d7840197cc0caf0430792b9f4a0df60d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#cbccfeebf2c93244516dec81dcc56fda">addItem</a> (<a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> *item)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Adds an item. <a href="#cbccfeebf2c93244516dec81dcc56fda"></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_1WMenu.html#63819cb0a445ab7ad364f5b0e241b67d">removeItem</a> (<a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> *item)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Removes an item. <a href="#63819cb0a445ab7ad364f5b0e241b67d"></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_1WMenu.html#7bafc33564cb06d980d75e2f4d89f28d">select</a> (<a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> *item)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Selects an item. <a href="#7bafc33564cb06d980d75e2f4d89f28d"></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_1WMenu.html#ec1801d047dc0f150d1cc12b801aa6c2">select</a> (int index)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Selects an item. <a href="#ec1801d047dc0f150d1cc12b801aa6c2"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1Signal.html">Signal</a>< <a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#0303879705bcdd8dbffc2d1528670d20">itemSelected</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Signal which indicates that a new item was selected. <a href="#0303879705bcdd8dbffc2d1528670d20"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1Signal.html">Signal</a>< <a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#8737f262f99d0db0a0f4b7aeb01cfe2e">itemSelectRendered</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Signal which indicates that a new selected item is rendered. <a href="#8737f262f99d0db0a0f4b7aeb01cfe2e"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const std::vector< <a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#bb90d70d722ce95e748b3ed0b88168b5">items</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the items. <a href="#bb90d70d722ce95e748b3ed0b88168b5"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#4e94081f83aee45db0ffd43073f2b8ca">currentItem</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the currently selected item. <a href="#4e94081f83aee45db0ffd43073f2b8ca"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#467ab0da55b4584f1b46abe931354f3d">currentIndex</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the index of the currently selected item. <a href="#467ab0da55b4584f1b46abe931354f3d"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceWt.html#2a8d45559e16a0185bf61bfad0a67912">Orientation</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#8f241ce7b48d30c0c5f60abcd8e38a90">orientation</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the orientation. <a href="#8f241ce7b48d30c0c5f60abcd8e38a90"></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_1WMenu.html#8bc28b9d703b93569846441213877d4f">setRenderAsList</a> (bool enable)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Renders using an HTML list. <a href="#8bc28b9d703b93569846441213877d4f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#8cc3a34a38722aa07ad8e5e183ed6af3">renderAsList</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether the menu is rendered as an HTML list. <a href="#8cc3a34a38722aa07ad8e5e183ed6af3"></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_1WMenu.html#e1807eba0b1002808dbec779d00a79dc">setInternalPathEnabled</a> (const std::string &basePath="")</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Enables internal paths for items. <a href="#e1807eba0b1002808dbec779d00a79dc"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#a8e47ce1b3e21eb64202e6ab1b5e48b5">internalPathEnabled</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns whether the menu generates internal paths entries. <a href="#a8e47ce1b3e21eb64202e6ab1b5e48b5"></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_1WMenu.html#a5cf3b5b9919d2f130c8acd156447132">setInternalBasePath</a> (const std::string &basePath)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets the internal base path. <a href="#a5cf3b5b9919d2f130c8acd156447132"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">const std::string & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#8cdf2f75f67efa0c10c6fb25fd1cd4da">internalBasePath</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the internal base path. <a href="#8cdf2f75f67efa0c10c6fb25fd1cd4da"></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 void </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WMenu.html#ea92a8e3abe2ac6130eb93acec605ec9">enableAjax</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Progresses to an Ajax-enabled widget. <a href="#ea92a8e3abe2ac6130eb93acec605ec9"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A widget that shows a menu of options.
<p>
The WMenu widget offers menu navigation in conjunction with a <a class="el" href="classWt_1_1WStackedWidget.html" title="A container widget that stacks its widgets on top of each other.">WStackedWidget</a>, where different 'contents' are stacked upon each other. Each choice in the menu (which is implemented as a <a class="el" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">WMenuItem</a>) corresponds to a tab in the contents stack. The contents stack may contain other items, and could be shared with other <a class="el" href="classWt_1_1WMenu.html" title="A widget that shows a menu of options.">WMenu</a> instances. (the old restriction of a dedicated contents stack has been removed since Wt 2.2.1).<p>
Usage example:<p>
<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>(contentsParent);
<span class="comment">// create a 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>, menuParent);
<span class="comment">// add four items using the default lazy loading policy.</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>(<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>));
menu-><a class="code" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem</a>(<span class="stringliteral">"Demo"</span>, <span class="keyword">new</span> DemoWidget());
menu-><a class="code" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem</a>(<span class="keyword">new</span> <a class="code" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">Wt::WMenuItem</a>(<span class="stringliteral">"Demo2"</span>, <span class="keyword">new</span> DemoWidget()));
</pre></div><p>
After contruction, the first entry will be selected. At any time, it is possible to select a particular item using <a class="el" href="classWt_1_1WMenu.html#7bafc33564cb06d980d75e2f4d89f28d" title="Selects an item.">select()</a>.<p>
The WMenu implementation offers fine-grained control on how contents should be preloaded. By default, all contents is lazy-loaded, only when needed. To improve response time, an item may also be preloaded (using <a class="el" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem()</a>). In that case, the item will be loaded in the background, before its first use. In any case, once the contents corresponding to a menu item is loaded, subsequent navigation to it is handled entirely client-side.<p>
The WMenu may participate in the application's internal path, which lets menu items correspond to internal URLs, see <a class="el" href="classWt_1_1WMenu.html#e1807eba0b1002808dbec779d00a79dc" title="Enables internal paths for items.">setInternalPathEnabled()</a>.<p>
The layout of the menu may be Horizontal or Vertical. The look of the items may be defined through style sheets. The default <a class="el" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">WMenuItem</a> implementation uses two style classes to distinguish between activated and inactivated menu items: <code>item</code> and <code>itemselected</code>. By using CSS nested selectors, a different style may be defined for items in a different menu.<p>
You may customize the rendering and behaviour of menu entries by specializing <a class="el" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">WMenuItem</a>.<p>
<h3>CSS</h3>
<p>
Styling a menu will be different depending of the rendering mode (table, list). Conventionally, menus like this are styled as a list.<p>
You will want to differentiate between unselected and selected items based on the <code>item</code> and <code>itemselected</code> style classes. <div class="fragment"><pre class="fragment">.menu * .item {
cursor: pointer; cursor: hand;
color: <a class="code" href="group__style.html#gg9686ea88ce4db2c0a12ea84452f601330cb88ce2189a8986f24a4409498e490e" title="Color blue.">blue</a>;
text-decoration: underline;
}
.menu * .itemselected {
color: <a class="code" href="group__style.html#gg9686ea88ce4db2c0a12ea84452f601330cb88ce2189a8986f24a4409498e490e" title="Color blue.">blue</a>;
text-decoration: underline;
font-weight: bold;
}
</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> </dd></dl>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="edc7dcfb468fedd82eb6e01ddcdd3f77"></a><!-- doxytag: member="Wt::WMenu::WMenu" ref="edc7dcfb468fedd82eb6e01ddcdd3f77" args="(WStackedWidget *contentsStack, Orientation orientation, WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WMenu::WMenu </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WStackedWidget.html">WStackedWidget</a> * </td>
<td class="paramname"> <em>contentsStack</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="namespaceWt.html#2a8d45559e16a0185bf61bfad0a67912">Orientation</a> </td>
<td class="paramname"> <em>orientation</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype"><a class="el" href="classWt_1_1WContainerWidget.html">WContainerWidget</a> * </td>
<td class="paramname"> <em>parent</em> = <code>0</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 menu.
<p>
Construct a menu to manage the widgets in <code>contentsStack</code>, and sets the menu <code>orientation</code>.<p>
Each menu item will manage a single widget in the <code>contentsStack</code>, making it the current widget when the menu item is activated.
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="d7840197cc0caf0430792b9f4a0df60d"></a><!-- doxytag: member="Wt::WMenu::addItem" ref="d7840197cc0caf0430792b9f4a0df60d" args="(const WString &name, WWidget *contents, WMenuItem::LoadPolicy policy=WMenuItem::LazyLoading)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * Wt::WMenu::addItem </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="classWt_1_1WString.html">WString</a> & </td>
<td class="paramname"> <em>name</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">WMenuItem::LoadPolicy</a> </td>
<td class="paramname"> <em>policy</em> = <code>WMenuItem::LazyLoading</code></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Adds an item.
<p>
Adds a menu item with given <code>contents</code>, which is added to the menu's associated contents stack.<p>
<code>contents</code> may be <code>0</code>, in which case no contents in the contents stack is associated with the menu item.<p>
Returns the corresponding <a class="el" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">WMenuItem</a>.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#cbccfeebf2c93244516dec81dcc56fda" title="Adds an item.">addItem(WMenuItem *)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="cbccfeebf2c93244516dec81dcc56fda"></a><!-- doxytag: member="Wt::WMenu::addItem" ref="cbccfeebf2c93244516dec81dcc56fda" args="(WMenuItem *item)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * Wt::WMenu::addItem </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * </td>
<td class="paramname"> <em>item</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Adds an item.
<p>
Adds a menu item. Use this form to add specialized <a class="el" href="classWt_1_1WMenuItem.html" title="A single item in a menu.">WMenuItem</a> implementations.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem(const WString&, WWidget *, WMenuItem::LoadPolicy)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="63819cb0a445ab7ad364f5b0e241b67d"></a><!-- doxytag: member="Wt::WMenu::removeItem" ref="63819cb0a445ab7ad364f5b0e241b67d" args="(WMenuItem *item)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WMenu::removeItem </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * </td>
<td class="paramname"> <em>item</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Removes an item.
<p>
Removes the given item. The item and its contents is not deleted.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#d7840197cc0caf0430792b9f4a0df60d" title="Adds an item.">addItem()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="7bafc33564cb06d980d75e2f4d89f28d"></a><!-- doxytag: member="Wt::WMenu::select" ref="7bafc33564cb06d980d75e2f4d89f28d" args="(WMenuItem *item)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WMenu::select </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * </td>
<td class="paramname"> <em>item</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Selects an item.
<p>
Select the menu item <code>item</code>.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#ec1801d047dc0f150d1cc12b801aa6c2" title="Selects an item.">select(int)</a>, <a class="el" href="classWt_1_1WMenu.html#4e94081f83aee45db0ffd43073f2b8ca" title="Returns the currently selected item.">currentItem()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="ec1801d047dc0f150d1cc12b801aa6c2"></a><!-- doxytag: member="Wt::WMenu::select" ref="ec1801d047dc0f150d1cc12b801aa6c2" args="(int index)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WMenu::select </td>
<td>(</td>
<td class="paramtype">int </td>
<td class="paramname"> <em>index</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Selects an item.
<p>
Menu items in a menu with <code>N</code> items are numbered from 0 to <code>N</code> - 1.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#7bafc33564cb06d980d75e2f4d89f28d" title="Selects an item.">select(WMenuItem *)</a>, <a class="el" href="classWt_1_1WMenu.html#467ab0da55b4584f1b46abe931354f3d" title="Returns the index of the currently selected item.">currentIndex()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="0303879705bcdd8dbffc2d1528670d20"></a><!-- doxytag: member="Wt::WMenu::itemSelected" ref="0303879705bcdd8dbffc2d1528670d20" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1Signal.html">Signal</a><<a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> *>& Wt::WMenu::itemSelected </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Signal which indicates that a new item was selected.
<p>
This signal is emitted when an item was selected. It is emitted both when the user activated an item, or when <a class="el" href="classWt_1_1WMenu.html#7bafc33564cb06d980d75e2f4d89f28d" title="Selects an item.">select()</a> was invoked.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#8737f262f99d0db0a0f4b7aeb01cfe2e" title="Signal which indicates that a new selected item is rendered.">itemSelectRendered</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="8737f262f99d0db0a0f4b7aeb01cfe2e"></a><!-- doxytag: member="Wt::WMenu::itemSelectRendered" ref="8737f262f99d0db0a0f4b7aeb01cfe2e" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1Signal.html">Signal</a><<a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> *>& Wt::WMenu::itemSelectRendered </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Signal which indicates that a new selected item is rendered.
<p>
This signal is similar to <a class="el" href="classWt_1_1WMenu.html#0303879705bcdd8dbffc2d1528670d20">itemSelected</a>, but is emitted from within a stateless slot. Therefore, any slot connected to this signal will be optimized to client-side JavaScript, and must support the contract of a stateless slot.<p>
If you are unsure what is the difference with the <a class="el" href="classWt_1_1WMenu.html#0303879705bcdd8dbffc2d1528670d20">itemSelected</a> signal, you'll probably need the latter instead.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#0303879705bcdd8dbffc2d1528670d20" title="Signal which indicates that a new item was selected.">itemSelected</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="bb90d70d722ce95e748b3ed0b88168b5"></a><!-- doxytag: member="Wt::WMenu::items" ref="bb90d70d722ce95e748b3ed0b88168b5" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const std::vector<<a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> *>& Wt::WMenu::items </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the items.
<p>
Returns the list of menu items in this menu.
</div>
</div><p>
<a class="anchor" name="4e94081f83aee45db0ffd43073f2b8ca"></a><!-- doxytag: member="Wt::WMenu::currentItem" ref="4e94081f83aee45db0ffd43073f2b8ca" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WMenuItem.html">WMenuItem</a> * Wt::WMenu::currentItem </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const</td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the currently selected item.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#467ab0da55b4584f1b46abe931354f3d" title="Returns the index of the currently selected item.">currentIndex()</a>, <a class="el" href="classWt_1_1WMenu.html#7bafc33564cb06d980d75e2f4d89f28d" title="Selects an item.">select(WMenuItem *)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="467ab0da55b4584f1b46abe931354f3d"></a><!-- doxytag: member="Wt::WMenu::currentIndex" ref="467ab0da55b4584f1b46abe931354f3d" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">int Wt::WMenu::currentIndex </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the index of the currently selected item.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#4e94081f83aee45db0ffd43073f2b8ca" title="Returns the currently selected item.">currentItem()</a>, <a class="el" href="classWt_1_1WMenu.html#ec1801d047dc0f150d1cc12b801aa6c2" title="Selects an item.">select(int)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="8f241ce7b48d30c0c5f60abcd8e38a90"></a><!-- doxytag: member="Wt::WMenu::orientation" ref="8f241ce7b48d30c0c5f60abcd8e38a90" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="namespaceWt.html#2a8d45559e16a0185bf61bfad0a67912">Orientation</a> Wt::WMenu::orientation </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the orientation.
<p>
The orientation is set at time of construction.
</div>
</div><p>
<a class="anchor" name="8bc28b9d703b93569846441213877d4f"></a><!-- doxytag: member="Wt::WMenu::setRenderAsList" ref="8bc28b9d703b93569846441213877d4f" args="(bool enable)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WMenu::setRenderAsList </td>
<td>(</td>
<td class="paramtype">bool </td>
<td class="paramname"> <em>enable</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Renders using an HTML list.
<p>
By default, the the menu is rendered using an HTML <table> element for layout. Setting this option enables rendering using <ul> and <il> elements, as is commonly done for CSS-based designs.<p>
<dl class="note" compact><dt><b>Note:</b></dt><dd>You cannot use this method after items have been added to the menu. </dd></dl>
</div>
</div><p>
<a class="anchor" name="8cc3a34a38722aa07ad8e5e183ed6af3"></a><!-- doxytag: member="Wt::WMenu::renderAsList" ref="8cc3a34a38722aa07ad8e5e183ed6af3" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Wt::WMenu::renderAsList </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns whether the menu is rendered as an HTML list.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#8bc28b9d703b93569846441213877d4f" title="Renders using an HTML list.">setRenderAsList(bool)</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="e1807eba0b1002808dbec779d00a79dc"></a><!-- doxytag: member="Wt::WMenu::setInternalPathEnabled" ref="e1807eba0b1002808dbec779d00a79dc" args="(const std::string &basePath="")" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WMenu::setInternalPathEnabled </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>basePath</em> = <code>""</code> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Enables internal paths for items.
<p>
The menu participates in the internal path by changing the internal path when an item has been selected, and listening for path changes to react to path selections. As a consequence this allows the user to bookmark the current menu selection and revisit it later, use back/forward buttons to navigate through history of visited menu items, and allows indexing of pages.<p>
For each menu item, <a class="el" href="classWt_1_1WMenuItem.html#5ab0b5430b9fb852a45886deb0ff01b1" title="Returns the path component for this item.">WMenuItem::pathComponent()</a> is appended to the internal base path (<a class="el" href="classWt_1_1WMenu.html#8cdf2f75f67efa0c10c6fb25fd1cd4da" title="Returns the internal base path.">internalBasePath()</a>), which defaults to the internal path (<a class="el" href="classWt_1_1WApplication.html#ab6320ecdd0e8e4026e9ef1aca710ca5" title="Returns the current internal path.">WApplication::internalPath()</a>) but may be changed using <a class="el" href="classWt_1_1WMenu.html#a5cf3b5b9919d2f130c8acd156447132" title="Sets the internal base path.">setInternalBasePath()</a>, with a '/' appended to turn it into a folder, if needed.<p>
By default, menu interaction does not change 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.">WMenuItem::setPathComponent()</a>. </dd></dl>
</div>
</div><p>
<a class="anchor" name="a8e47ce1b3e21eb64202e6ab1b5e48b5"></a><!-- doxytag: member="Wt::WMenu::internalPathEnabled" ref="a8e47ce1b3e21eb64202e6ab1b5e48b5" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">bool Wt::WMenu::internalPathEnabled </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns whether the menu generates internal paths entries.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#e1807eba0b1002808dbec779d00a79dc" title="Enables internal paths for items.">setInternalPathEnabled()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="a5cf3b5b9919d2f130c8acd156447132"></a><!-- doxytag: member="Wt::WMenu::setInternalBasePath" ref="a5cf3b5b9919d2f130c8acd156447132" args="(const std::string &basePath)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WMenu::setInternalBasePath </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>basePath</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets the internal base path.
<p>
A '/' is appended to turn it into a folder, if needed.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#e1807eba0b1002808dbec779d00a79dc" title="Enables internal paths for items.">setInternalPathEnabled()</a>, <a class="el" href="classWt_1_1WMenu.html#8cdf2f75f67efa0c10c6fb25fd1cd4da" title="Returns the internal base path.">internalBasePath()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="8cdf2f75f67efa0c10c6fb25fd1cd4da"></a><!-- doxytag: member="Wt::WMenu::internalBasePath" ref="8cdf2f75f67efa0c10c6fb25fd1cd4da" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const std::string& Wt::WMenu::internalBasePath </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the internal base path.
<p>
The default value is the application's internalPath (<a class="el" href="classWt_1_1WApplication.html#ab6320ecdd0e8e4026e9ef1aca710ca5" title="Returns the current internal path.">WApplication::internalPath()</a>) that was recorded when <a class="el" href="classWt_1_1WMenu.html#e1807eba0b1002808dbec779d00a79dc" title="Enables internal paths for items.">setInternalPathEnabled()</a> was called, and together with each <a class="el" href="classWt_1_1WMenuItem.html#5ab0b5430b9fb852a45886deb0ff01b1" title="Returns the path component for this item.">WMenuItem::pathComponent()</a> determines the paths for each item.<p>
For example, if <a class="el" href="classWt_1_1WMenu.html#8cdf2f75f67efa0c10c6fb25fd1cd4da" title="Returns the internal base path.">internalBasePath()</a> is <code>"/examples/"</code> and pathComponent() for a particular item is <code>"charts/"</code>, then the internal path for that item will be <code>"/examples/charts/"</code>.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WMenu.html#e1807eba0b1002808dbec779d00a79dc" title="Enables internal paths for items.">setInternalPathEnabled()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="ea92a8e3abe2ac6130eb93acec605ec9"></a><!-- doxytag: member="Wt::WMenu::enableAjax" ref="ea92a8e3abe2ac6130eb93acec605ec9" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WMenu::enableAjax </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Progresses to an Ajax-enabled widget.
<p>
This method is called when the progressive bootstrap method is used, and support for AJAX has been detected. The default behavior will upgrade the widget's event handling to use AJAX instead of full page reloads, and propagate the call to its children.<p>
You may want to reimplement this method if you want to make changes to widget when AJAX is enabled. You should always call the base implementation.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WApplication.html#78016406c4746c56b2c2ffce7c5e181f" title="Progresses to an Ajax-enabled user interface.">WApplication::enableAjax()</a> </dd></dl>
<p>Reimplemented from <a class="el" href="classWt_1_1WCompositeWidget.html#90e07c1bb6c48732ed4b5d98f91cfda0">Wt::WCompositeWidget</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>
|