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
|
<!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::WObject 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_1WObject.html">WObject</a>
</div>
</div>
<div class="contents">
<h1>Wt::WObject Class Reference<br>
<small>
[<a class="el" href="group__signalslot.html">Signal/slot system</a>]</small>
</h1><!-- doxytag: class="Wt::WObject" -->A base class for objects that participate in the signal/slot system.
<a href="#_details">More...</a>
<p>
<code>#include <Wt/WObject></code>
<p>
<div class="dynheader">
Inheritance diagram for Wt::WObject:</div>
<div class="dynsection">
<p><center><img src="classWt_1_1WObject__inherit__graph.png" border="0" usemap="#Wt_1_1WObject__inherit__map" alt="Inheritance graph"></center>
<map name="Wt_1_1WObject__inherit__map">
<area shape="rect" href="classWt_1_1WSignalMapper.html" title="Wt::WSignalMapper\< int \>" alt="" coords="263,5,436,32"><area shape="rect" href="classWt_1_1WSignalMapper.html" title="Wt::WSignalMapper\< Wt::ItemCheckBox * \>" alt="" coords="209,56,489,83"><area shape="rect" href="classWt_1_1WSignalMapper.html" title="Wt::WSignalMapper\< Wt::StandardButton, Wt::NoClass \>" alt="" coords="172,107,527,133"><area shape="rect" href="classWt_1_1WSignalMapper.html" title="Wt::WSignalMapper\< Wt::WCalendar::Coordinate, Wt::NoClass \>" alt="" coords="151,157,548,184"><area shape="rect" href="classWt_1_1WSignalMapper.html" title="Wt::WSignalMapper\< Wt::WModelIndex \>" alt="" coords="217,208,481,235"><area shape="rect" href="classWt_1_1WSignalMapper.html" title="Wt::WSignalMapper\< Wt::WTreeNode *, Wt::WMouseEvent \>" alt="" coords="161,259,537,285"><area shape="rect" href="classWt_1_1Ext_1_1ToolTipConfig.html" title="A configuration object for tool tips." alt="" coords="273,309,425,336"><area shape="rect" href="classWt_1_1WAbstractArea.html" title="Abstract base class for interactive areas in a widget." alt="" coords="284,360,415,387"><area shape="rect" href="classWt_1_1WAbstractItemDelegate.html" title="Abstract delegate class for rendering a view item." alt="" coords="259,411,440,437"><area shape="rect" href="classWt_1_1WAbstractItemModel.html" title="An abstract model for use with Wt's view classes." alt="" coords="267,461,432,488"><area shape="rect" href="classWt_1_1WApplication.html" title="Represents an application instance for a single session." alt="" coords="289,512,409,539"><area shape="rect" href="classWt_1_1WButtonGroup.html" title="A class for grouping radio buttons logically together." alt="" coords="284,563,415,589"><area shape="rect" href="classWt_1_1WCanvasPaintDevice.html" title="A paint device for rendering using the HTML 5 <canvas> element." alt="" coords="264,613,435,640"><area shape="rect" href="classWt_1_1WItemSelectionModel.html" title="A class that represents a selection for a WAbstractItemView." alt="" coords="264,664,435,691"><area shape="rect" href="classWt_1_1WLayout.html" title="An abstract base class for layout managers." alt="" coords="301,715,397,741"><area shape="rect" href="classWt_1_1WMenuItem.html" title="A single item in a menu." alt="" coords="292,765,407,792"><area shape="rect" href="classWt_1_1WResource.html" title="An object which can be rendered in the HTTP protocol." alt="" coords="293,816,405,843"><area shape="rect" href="classWt_1_1WScrollBar.html" title="A scrollbar attached to a scroll area." alt="" coords="295,867,404,893"><area shape="rect" href="classWt_1_1WSignalMapper.html" title="A utility class to connect multiple senders to a single slot." alt="" coords="253,917,445,944"><area shape="rect" href="classWt_1_1WSocketNotifier.html" title="A utility class for asynchronous notification of socket activity." alt="" coords="280,968,419,995"><area shape="rect" href="classWt_1_1WSound.html" title="Utility class to play a sound." alt="" coords="303,1019,396,1045"><area shape="rect" href="classWt_1_1WTableColumn.html" title="A table column." alt="" coords="284,1069,415,1096"><area shape="rect" href="classWt_1_1WTableRow.html" title="A table row." alt="" coords="293,1120,405,1147"><area shape="rect" href="classWt_1_1WTimer.html" title="A utility class which provides timer signals and single-shot timers." alt="" coords="304,1171,395,1197"><area shape="rect" href="classWt_1_1WValidator.html" title="A validator is used to validate user input according to pre-defined rules." alt="" coords="296,1221,403,1248"><area shape="rect" href="classWt_1_1WWidget.html" title="The abstract base class for a user-interface component." alt="" coords="301,1272,397,1299"><area shape="rect" href="classWt_1_1WCircleArea.html" title="A interactive area in a widget, specified by a circle." alt="" coords="627,183,744,209"><area shape="rect" href="classWt_1_1WPolygonArea.html" title="An interactive area in a widget, specified by a polygon." alt="" coords="620,233,751,260"><area shape="rect" href="classWt_1_1WRectArea.html" title="A interactive area in a widget, specified by a rectangle." alt="" coords="629,284,741,311"><area shape="rect" href="classWt_1_1WItemDelegate.html" title="Standard delegate class for rendering a view item." alt="" coords="619,335,752,361"><area shape="rect" href="classWt_1_1WAbstractListModel.html" title="An abstract list model for use with Wt's view classes." alt="" coords="605,385,765,412"><area shape="rect" href="classWt_1_1WAbstractProxyModel.html" title="An abstract proxy model for Wt's item models." alt="" coords="599,436,772,463"><area shape="rect" href="classWt_1_1WAbstractTableModel.html" title="An abstract table model for use with Wt's view classes." alt="" coords="600,487,771,513"><area shape="rect" href="classWt_1_1WStandardItemModel.html" title="A standard data model, which stores its data in memory." alt="" coords="600,537,771,564"><area shape="rect" href="classWt_1_1WBorderLayout.html" title="A layout manager which divides the container region in five regions." alt="" coords="619,588,752,615"><area shape="rect" href="classWt_1_1WBoxLayout.html" title="A layout manager which arranges widgets horizontally or vertically." alt="" coords="625,639,745,665"><area shape="rect" href="classWt_1_1WDefaultLayout.html" title="A default layout manager." alt="" coords="617,689,753,716"><area shape="rect" href="classWt_1_1WFitLayout.html" title="A layout manager which spans a single widget to all available space." alt="" coords="629,740,741,767"><area shape="rect" href="classWt_1_1WGridLayout.html" title="A layout manager which arranges widgets in a grid." alt="" coords="625,791,745,817"><area shape="rect" href="classWt_1_1WSubMenuItem.html" title="A menu item that contains a nested sub menu." alt="" coords="616,841,755,868"><area shape="rect" href="classWt_1_1Ext_1_1DataStore.html" title="A resource that serializes data from a data model." alt="" coords="620,892,751,919"><area shape="rect" href="classWt_1_1WFileResource.html" title="A resource which streams data from a local file." alt="" coords="619,943,752,969"><area shape="rect" href="classWt_1_1WMemoryResource.html" title="A resource which streams data from memory." alt="" coords="605,993,765,1020"><area shape="rect" href="classWt_1_1WSvgImage.html" title="A paint device for rendering using Scalable Vector Graphics (SVG)." alt="" coords="628,1044,743,1071"><area shape="rect" href="classWt_1_1WDateValidator.html" title="A validator for date input." alt="" coords="619,1145,752,1172"><area shape="rect" href="classWt_1_1WDoubleValidator.html" title="A validator for validating floating point user input." alt="" coords="612,1196,759,1223"><area shape="rect" href="classWt_1_1WIntValidator.html" title="A validator that validates integer user input." alt="" coords="624,1247,747,1273"><area shape="rect" href="classWt_1_1WLengthValidator.html" title="A validator that checks the string length of user input." alt="" coords="612,1297,759,1324"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classWt_1_1WObject-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="6ef714d6ef0060b78c039e729b913aa9"></a><!-- doxytag: member="Wt::WObject::Method" ref="6ef714d6ef0060b78c039e729b913aa9" args=")()" -->
typedef void(WObject::* </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#6ef714d6ef0060b78c039e729b913aa9">Method</a> )()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Typedef for a WObject method without arguments. <br></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_1WObject.html#1da12f5d82488adcca912c596b9398ea">WObject</a> (<a class="el" href="classWt_1_1WObject.html">WObject</a> *parent=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Create a WObject with a given parent object. <a href="#1da12f5d82488adcca912c596b9398ea"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#45d6c07b134db69687bd1b49025799c3">~WObject</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Destructor. <a href="#45d6c07b134db69687bd1b49025799c3"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual const std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#5c5cc1d7aada99baf97d0dc203e42154">id</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the (unique) identifier for this object. <a href="#5c5cc1d7aada99baf97d0dc203e42154"></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_1WObject.html#64ce31cadb378c4eba81224f43bf493d">setObjectName</a> (const std::string &name)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Sets an object name. <a href="#64ce31cadb378c4eba81224f43bf493d"></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_1WObject.html#5cad0cc3f73402de1422747653ece18f">objectName</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the object name. <a href="#5cad0cc3f73402de1422747653ece18f"></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_1WObject.html#92d8b00edc79b7a60d41d7c088f50436">resetLearnedSlots</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Resets learned stateless slot implementations. <a href="#92d8b00edc79b7a60d41d7c088f50436"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">void </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#e06fa3064a80f857b3b05123ef412bb2">resetLearnedSlot</a> (void(T::*method)())</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Resets a learned stateless slot implementation. <a href="#e06fa3064a80f857b3b05123ef412bb2"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">WStatelessSlot * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da">implementStateless</a> (void(T::*method)())</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Declares a slot to be stateless and learn client-side behaviour on first invocation. <a href="#c00d775170f47e715894b24de6b869da"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">WStatelessSlot * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#18c9870a4944cf1e802c9b94fc2a55a6">implementStateless</a> (void(T::*method)(), void(T::*undoMethod)())</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Declares a slot to be stateless and learn client-side behaviour in advance. <a href="#18c9870a4944cf1e802c9b94fc2a55a6"></a><br></td></tr>
<tr><td class="memTemplParams" nowrap colspan="2">template<class T> </td></tr>
<tr><td class="memTemplItemLeft" nowrap align="right" valign="top">WStatelessSlot * </td><td class="memTemplItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#6b6619da758adfc3c0c8cd4a06d9a4c9">implementJavaScript</a> (void(T::*method)(), const std::string &jsCode)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Provides a JavaScript implementation for a method. <a href="#6b6619da758adfc3c0c8cd4a06d9a4c9"></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_1WObject.html#945f972be4331bfe46221263e04ae9ed">addChild</a> (<a class="el" href="classWt_1_1WObject.html">WObject</a> *child)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Adds a child object. <a href="#945f972be4331bfe46221263e04ae9ed"></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_1WObject.html#1f811eeb5f0aa37b5b1931497cd9f163">removeChild</a> (<a class="el" href="classWt_1_1WObject.html">WObject</a> *child)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Removes a child object. <a href="#1f811eeb5f0aa37b5b1931497cd9f163"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="66c8da3f967545ceb585ed574f68b8cf"></a><!-- doxytag: member="Wt::WObject::children" ref="66c8da3f967545ceb585ed574f68b8cf" args="() const " -->
const std::vector< <a class="el" href="classWt_1_1WObject.html">WObject</a> * > & </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#66c8da3f967545ceb585ed574f68b8cf">children</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the children. <br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2af8f7ec8d3807d434e1f70d1245c6b4"></a><!-- doxytag: member="Wt::WObject::parent" ref="2af8f7ec8d3807d434e1f70d1245c6b4" args="() const " -->
<a class="el" href="classWt_1_1WObject.html">WObject</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#2af8f7ec8d3807d434e1f70d1245c6b4">parent</a> () const </td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the parent object. <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 WStatelessSlot * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#ae1e4d3444723814adfc9717e14b693a">getStateless</a> (<a class="el" href="classWt_1_1WObject.html#6ef714d6ef0060b78c039e729b913aa9">Method</a> method)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">On-demand stateless slot implementation. <a href="#ae1e4d3444723814adfc9717e14b693a"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Static Protected Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="el" href="classWt_1_1WObject.html">WObject</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classWt_1_1WObject.html#413deb54de40ee278dd554e4960d58ca">sender</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Returns the sender of the current slot call. <a href="#413deb54de40ee278dd554e4960d58ca"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A base class for objects that participate in the signal/slot system.
<p>
The main feature offered by WObject is automated object life-time tracking when involved in signal/slot connections. Connections between signals and slots of WObject instances implement a type-safe event callback system. For example, one can simply connect() the <a class="el" href="classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c" title="Event signal emitted when a mouse key was clicked on this widget.">WInteractWidget::clicked()</a> signal of a <a class="el" href="classWt_1_1WPushButton.html" title="A widget that represents a push button.">WPushButton</a> to the <a class="el" href="classWt_1_1WApplication.html#5231d54ed34982f4366058eb6440c8f7" title="Quits the application.">WApplication::quit()</a> method, to exit the application when the button is clicked:<p>
<div class="fragment"><pre class="fragment"> <a class="code" href="classWt_1_1WInteractWidget.html" title="An abstract widget that can receive user-interface interaction.">Wt::WInteractWidget</a> *<a class="code" href="classWt_1_1WObject.html#413deb54de40ee278dd554e4960d58ca" title="Returns the sender of the current slot call.">sender</a> = <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">"Quit."</span>);
<a class="code" href="classWt_1_1WApplication.html" title="Represents an application instance for a single session.">Wt::WApplication</a> *app = <a class="code" href="classWt_1_1WApplication.html#38d922da0a0d83395519f3eaab85d0f6" title="Returns the current application instance.">Wt::WApplication::instance</a>();
sender-><a class="code" href="classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c" title="Event signal emitted when a mouse key was clicked on this widget.">clicked</a>().connect(SLOT(app, <a class="code" href="classWt_1_1WApplication.html#5231d54ed34982f4366058eb6440c8f7" title="Quits the application.">Wt::WApplication::quit</a>));
</pre></div><p>
The SLOT macro in the last statement simply expands to taking the address of the method: <div class="fragment"><pre class="fragment"> sender-><a class="code" href="classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c" title="Event signal emitted when a mouse key was clicked on this widget.">clicked</a>().connect(app, &<a class="code" href="classWt_1_1WApplication.html#5231d54ed34982f4366058eb6440c8f7" title="Quits the application.">Wt::WApplication::quit</a>);
</pre></div><p>
Wt's signals may also propagate arguments to slots. For example, the same clicked() signal provides event details in a <a class="el" href="classWt_1_1WMouseEvent.html" title="A class providing details for a mouse event.">WMouseEvent</a> details class, and these details may be received in the slot: <div class="fragment"><pre class="fragment"> <span class="keyword">class </span>MyClass : <span class="keyword">public</span> Wt::WContainerWidget
{
<span class="keyword">public</span>:
MyClass(<a class="code" href="classWt_1_1WContainerWidget.html" title="A widget that holds and manages child widgets.">Wt::WContainerWidget</a> *parent = 0)
: Wt::WContainerWidget(parent)
{
<a class="code" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">Wt::WText</a> *text = <a class="code" href="classWt_1_1WText.html" title="A widget that renders (XHTML) text.">Wt::WText</a>(<span class="stringliteral">"Click here"</span>, <span class="keyword">this</span>);
text-><a class="code" href="classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c" title="Event signal emitted when a mouse key was clicked on this widget.">clicked</a>().connect(SLOT(<span class="keyword">this</span>, MyClass::handleClick));
...
}
<span class="keyword">private</span>:
<span class="keywordtype">void</span> handleClick(<span class="keyword">const</span> <a class="code" href="classWt_1_1WMouseEvent.html" title="A class providing details for a mouse event.">Wt::WMouseEvent</a>& event) {
<span class="keywordflow">if</span> (event.<a class="code" href="classWt_1_1WMouseEvent.html#c84d28364a178e547d2bc417e3eb2423" title="Returns keyboard modifiers.">modifiers</a>() & <a class="code" href="group__signalslot.html#gg50f91169486bada5931f3adc3a623091206924f86e7455d5d88c30a1d61899b3" title="Shift key pressed.">Wt::ShiftModifier</a>) {
...
}
}
};
</pre></div> As the example illustrates, slots are ordinary WObject methods.<p>
A second feature of WObject is that they allow ownership organization in ownership object trees. When an object is created with another object as parent, it's ownership is transferred to the parent. If not deleted explicitly, the child object will be deleted together with the parent. Child objects may also be deleted manually: they will remove themselves from their parent in the process.<p>
In conjunction with <a class="el" href="classWt_1_1EventSignal.html" title="A signal that conveys user-interface events.">EventSignal</a>, WObject also facilitates learning of client-side event handling (in JavaScript) through invocation of the slot method. This is only possible when the slot behaviour is stateless, i.e. independent of any application state, and can be specified using the <a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da" title="Declares a slot to be stateless and learn client-side behaviour on first invocation...">implementStateless()</a> methods.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1Signal.html" title="A signal that propagates events to listeners.">Signal</a>, <a class="el" href="classWt_1_1EventSignal.html" title="A signal that conveys user-interface events.">EventSignal</a> </dd></dl>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="1da12f5d82488adcca912c596b9398ea"></a><!-- doxytag: member="Wt::WObject::WObject" ref="1da12f5d82488adcca912c596b9398ea" args="(WObject *parent=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WObject::WObject </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WObject.html">WObject</a> * </td>
<td class="paramname"> <em>parent</em> = <code>0</code> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Create a WObject with a given parent object.
<p>
If the optional parent is specified, the parent object will destroy all child objects. Set parent to <code>0</code> to create an object with no parent.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#945f972be4331bfe46221263e04ae9ed" title="Adds a child object.">addChild()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="45d6c07b134db69687bd1b49025799c3"></a><!-- doxytag: member="Wt::WObject::~WObject" ref="45d6c07b134db69687bd1b49025799c3" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">Wt::WObject::~WObject </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Destructor.
<p>
This automatically:<ul>
<li>deletes all child objects</li><li>invalidates this object as sender or receiver in signals and slots </li></ul>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="5c5cc1d7aada99baf97d0dc203e42154"></a><!-- doxytag: member="Wt::WObject::id" ref="5c5cc1d7aada99baf97d0dc203e42154" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">const std::string Wt::WObject::id </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the (unique) identifier for this object.
<p>
For a WWidget, this corresponds to the id of the DOM element that represents the widget. This is not entirely unique, since a <a class="el" href="classWt_1_1WCompositeWidget.html">composite widget</a> shares the same id as its implementation.<p>
By default, the id is auto-generated, unless a custom id is set for a widget using <a class="el" href="classWt_1_1WWidget.html#93ff9d1ca04e733cd54cd40a06775f7e" title="Sets the CSS Id.">WWidget::setId()</a>. The auto-generated id is created by concatenating <a class="el" href="classWt_1_1WObject.html#5cad0cc3f73402de1422747653ece18f" title="Returns the object name.">objectName()</a> with a unique number.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WWidget.html#a2b7078b3b43d53a85e5244b45d504f7" title="Returns a JavaScript expression to the corresponding DOM node.">WWidget::jsRef()</a> </dd></dl>
<p>Reimplemented in <a class="el" href="classWt_1_1WButtonGroup.html#badc2ee3d7c98c6d4f7f0dcf3384d3be">Wt::WButtonGroup</a>, <a class="el" href="classWt_1_1WCompositeWidget.html#0557ba9778c04c33eab0be399cc84c02">Wt::WCompositeWidget</a>, <a class="el" href="classWt_1_1WTableColumn.html#bd8af1a254554ad9bc465bccb4411b02">Wt::WTableColumn</a>, <a class="el" href="classWt_1_1WTableRow.html#c16b8e1246aa646e7dca93c13685a392">Wt::WTableRow</a>, and <a class="el" href="classWt_1_1WWebWidget.html#d15b688428389cfd4b1b67e574ff0aa1">Wt::WWebWidget</a>.</p>
</div>
</div><p>
<a class="anchor" name="64ce31cadb378c4eba81224f43bf493d"></a><!-- doxytag: member="Wt::WObject::setObjectName" ref="64ce31cadb378c4eba81224f43bf493d" args="(const std::string &name)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WObject::setObjectName </td>
<td>(</td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>name</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Sets an object name.
<p>
The object name can be used to easily identify a type of object in the DOM, and does not need to be unique. It will usually reflect the widget type or role. The object name is prepended to the auto-generated object <a class="el" href="classWt_1_1WObject.html#5c5cc1d7aada99baf97d0dc203e42154" title="Returns the (unique) identifier for this object.">id()</a>.<p>
The default object name is empty.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#5c5cc1d7aada99baf97d0dc203e42154" title="Returns the (unique) identifier for this object.">id()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="5cad0cc3f73402de1422747653ece18f"></a><!-- doxytag: member="Wt::WObject::objectName" ref="5cad0cc3f73402de1422747653ece18f" args="() const " -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::string Wt::WObject::objectName </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td> const<code> [virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the object name.
<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#64ce31cadb378c4eba81224f43bf493d" title="Sets an object name.">setObjectName()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="92d8b00edc79b7a60d41d7c088f50436"></a><!-- doxytag: member="Wt::WObject::resetLearnedSlots" ref="92d8b00edc79b7a60d41d7c088f50436" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WObject::resetLearnedSlots </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Resets learned stateless slot implementations.
<p>
Clears the stateless implementation for all slots declared to be implemented with a stateless implementation.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#e06fa3064a80f857b3b05123ef412bb2" title="Resets a learned stateless slot implementation.">resetLearnedSlot()</a>, <a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da" title="Declares a slot to be stateless and learn client-side behaviour on first invocation...">implementStateless()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="e06fa3064a80f857b3b05123ef412bb2"></a><!-- doxytag: member="Wt::WObject::resetLearnedSlot" ref="e06fa3064a80f857b3b05123ef412bb2" args="(void(T::*method)())" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T> </div>
<table class="memname">
<tr>
<td class="memname">void Wt::WObject::resetLearnedSlot </td>
<td>(</td>
<td class="paramtype">void(T::*)() </td>
<td class="paramname"> <em>method</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Resets a learned stateless slot implementation.
<p>
Clears the stateless implementation for the given slot that was declared to be implemented with a stateless implementation.<p>
When something has changed that breaks the contract of a stateless slot to always have the same effect, you may call this method to force the application to discard the current implementation.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da" title="Declares a slot to be stateless and learn client-side behaviour on first invocation...">implementStateless()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="c00d775170f47e715894b24de6b869da"></a><!-- doxytag: member="Wt::WObject::implementStateless" ref="c00d775170f47e715894b24de6b869da" args="(void(T::*method)())" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T> </div>
<table class="memname">
<tr>
<td class="memname">WStatelessSlot * Wt::WObject::implementStateless </td>
<td>(</td>
<td class="paramtype">void(T::*)() </td>
<td class="paramname"> <em>method</em> </td>
<td> ) </td>
<td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Declares a slot to be stateless and learn client-side behaviour on first invocation.
<p>
Indicate that the given slot is stateless, and meets the requirement that the slot's code does not depend on any state of the object, but performs the same visual effect regardless of any state, or at least until <a class="el" href="classWt_1_1WObject.html#e06fa3064a80f857b3b05123ef412bb2" title="Resets a learned stateless slot implementation.">resetLearnedSlot()</a> is called.<p>
When this slot is connected to an <a class="el" href="classWt_1_1EventSignal.html" title="A signal that conveys user-interface events.">EventSignal</a> (such as those exposed by <a class="el" href="classWt_1_1WInteractWidget.html" title="An abstract widget that can receive user-interface interaction.">WInteractWidget</a> and <a class="el" href="classWt_1_1WFormWidget.html" title="An abstract widget that corresponds to an HTML form element.">WFormWidget</a>), the Wt library may decide to cache the visual effect of this slot in JavaScript code at client-side: this effect will be learned automatically at the first invocation. This has no consequences for the normal event handling, since the slot implementation is still executed in response to any event notification. Therefore, it is merely an optimization of the latency for the visual effect, but it does not change the behaviour of the application.<p>
When for some reason the visual effect does change, one may use <a class="el" href="classWt_1_1WObject.html#e06fa3064a80f857b3b05123ef412bb2" title="Resets a learned stateless slot implementation.">resetLearnedSlot()</a> or <a class="el" href="classWt_1_1WObject.html#92d8b00edc79b7a60d41d7c088f50436" title="Resets learned stateless slot implementations.">resetLearnedSlots()</a> to flush the existing cached visual effect, forcing the library to relearn it.<p>
It is crucial that this function be applied first to a slot that is intended to be stateless before any EventSignal connects to that slot. Otherwise, the connecting EventSignal cannot find the stateless slot implementation for the intended slot, and the statement will have no effect for that connection.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#e06fa3064a80f857b3b05123ef412bb2" title="Resets a learned stateless slot implementation.">resetLearnedSlot()</a>, <a class="el" href="classWt_1_1EventSignal.html" title="A signal that conveys user-interface events.">EventSignal</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="18c9870a4944cf1e802c9b94fc2a55a6"></a><!-- doxytag: member="Wt::WObject::implementStateless" ref="18c9870a4944cf1e802c9b94fc2a55a6" args="(void(T::*method)(), void(T::*undoMethod)())" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T> </div>
<table class="memname">
<tr>
<td class="memname">WStatelessSlot * Wt::WObject::implementStateless </td>
<td>(</td>
<td class="paramtype">void(T::*)() </td>
<td class="paramname"> <em>method</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">void(T::*)() </td>
<td class="paramname"> <em>undoMethod</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Declares a slot to be stateless and learn client-side behaviour in advance.
<p>
This method has the same effect as <a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da">implementStateless(void (T::*method)())</a>, but learns the visual effect of the slot before the first invocation of the event.<p>
To learn the visual effect, the library will simulate the event and record the visual effect. To restore the application state, it will call the undoMethod which must restore the effect of method.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da">implementStateless(void (T::*method)())</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="6b6619da758adfc3c0c8cd4a06d9a4c9"></a><!-- doxytag: member="Wt::WObject::implementJavaScript" ref="6b6619da758adfc3c0c8cd4a06d9a4c9" args="(void(T::*method)(), const std::string &jsCode)" -->
<div class="memitem">
<div class="memproto">
<div class="memtemplate">
template<class T> </div>
<table class="memname">
<tr>
<td class="memname">WStatelessSlot * Wt::WObject::implementJavaScript </td>
<td>(</td>
<td class="paramtype">void(T::*)() </td>
<td class="paramname"> <em>method</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const std::string & </td>
<td class="paramname"> <em>jsCode</em></td><td> </td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td><td><code> [inline]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Provides a JavaScript implementation for a method.
<p>
This method sets the JavaScript implementation for a method. As a result, if JavaScript is available, the JavaScript version will be used on the client side and the visual effect of the C++ implementation will be ignored.<p>
This is very similar to an auto-learned stateless slot, but here the learning is avoided by directly setting the JavaScript implementation.<p>
The <code>jsCode</code> should be one or more valid JavaScript statements.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da">implementStateless(void (T::*method)())</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="945f972be4331bfe46221263e04ae9ed"></a><!-- doxytag: member="Wt::WObject::addChild" ref="945f972be4331bfe46221263e04ae9ed" args="(WObject *child)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WObject::addChild </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WObject.html">WObject</a> * </td>
<td class="paramname"> <em>child</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Adds a child object.
<p>
Take responsibility of deleting the child object, together with this object.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#1f811eeb5f0aa37b5b1931497cd9f163" title="Removes a child object.">removeChild()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="1f811eeb5f0aa37b5b1931497cd9f163"></a><!-- doxytag: member="Wt::WObject::removeChild" ref="1f811eeb5f0aa37b5b1931497cd9f163" args="(WObject *child)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void Wt::WObject::removeChild </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WObject.html">WObject</a> * </td>
<td class="paramname"> <em>child</em> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Removes a child object.
<p>
The child must have been previously added.<p>
<dl class="see" compact><dt><b>See also:</b></dt><dd><a class="el" href="classWt_1_1WObject.html#945f972be4331bfe46221263e04ae9ed" title="Adds a child object.">addChild()</a> </dd></dl>
</div>
</div><p>
<a class="anchor" name="413deb54de40ee278dd554e4960d58ca"></a><!-- doxytag: member="Wt::WObject::sender" ref="413deb54de40ee278dd554e4960d58ca" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="classWt_1_1WObject.html">WObject</a> * Wt::WObject::sender </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [static, protected]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Returns the sender of the current slot call.
<p>
Use this function to know who emitted the signal that triggered this slot call. It may be <code>0</code> if the signal has no owner information, or if there is no signal triggering the current slot, but instead the slot method is called directly.
</div>
</div><p>
<a class="anchor" name="ae1e4d3444723814adfc9717e14b693a"></a><!-- doxytag: member="Wt::WObject::getStateless" ref="ae1e4d3444723814adfc9717e14b693a" args="(Method method)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">WStatelessSlot * Wt::WObject::getStateless </td>
<td>(</td>
<td class="paramtype"><a class="el" href="classWt_1_1WObject.html#6ef714d6ef0060b78c039e729b913aa9">Method</a> </td>
<td class="paramname"> <em>method</em> </td>
<td> ) </td>
<td><code> [protected, virtual]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
On-demand stateless slot implementation.
<p>
This method returns a stateless slot implementation for the given <code>method</code>. To avoid the cost of declaring methods to be stateless when they are not used, you may reimplement this method to provide a stateless implementation for a method only when the method is involved in a slot connection.<p>
Use <a class="el" href="classWt_1_1WObject.html#c00d775170f47e715894b24de6b869da" title="Declares a slot to be stateless and learn client-side behaviour on first invocation...">implementStateless()</a> to provide a stateless implementation of the given <code>method</code>, or return the base class implementation otherwise.
</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>
|