<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>Wt examples: HelloApplication Class Reference</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css" /> </head> <body> <div id="top"><!-- do not remove this div! --> <div id="titlearea"> <table cellspacing="0" cellpadding="0"> <tbody> <tr style="height: 56px;"> <td style="padding-left: 0.5em;"> <div id="projectname">Wt examples  <span id="projectnumber">3.2.3</span> </div> </td> </tr> </tbody> </table> </div> <!-- Generated by Doxygen 1.7.5.1 --> <div id="navrow1" class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</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> <li><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="annotated.html"><span>Class List</span></a></li> <li><a href="inherits.html"><span>Class Hierarchy</span></a></li> <li><a href="functions.html"><span>Class Members</span></a></li> </ul> </div> </div> <div class="header"> <div class="summary"> <a href="#pub-methods">Public Member Functions</a> | <a href="#pri-methods">Private Member Functions</a> | <a href="#pri-attribs">Private Attributes</a> </div> <div class="headertitle"> <div class="title">HelloApplication Class Reference</div> </div> </div> <div class="contents"> <!-- doxytag: class="HelloApplication" --><!-- doxytag: inherits="Wt::WApplication" --><div class="dynheader"> Inheritance diagram for HelloApplication:</div> <div class="dyncontent"> <div class="center"><img src="classHelloApplication__inherit__graph.png" border="0" usemap="#HelloApplication_inherit__map" alt="Inheritance graph"/></div> <map name="HelloApplication_inherit__map" id="HelloApplication_inherit__map"> <area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html" title="Wt::WApplication" alt="" coords="5,80,128,107"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="19,5,115,32"/></map> <center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div> <p><a href="classHelloApplication-members.html">List of all members.</a></p> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="pub-methods"></a> Public Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classHelloApplication.html#af8cfe75959bce2e4fba80a46f009c4a6">HelloApplication</a> (const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a> &env)</td></tr> <tr><td colspan="2"><h2><a name="pri-methods"></a> Private Member Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classHelloApplication.html#a94de3317a1e6e45964a3dfa9aacef9f9">greet</a> ()</td></tr> <tr><td colspan="2"><h2><a name="pri-attribs"></a> Private Attributes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLineEdit.html">WLineEdit</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classHelloApplication.html#a223a6b0ae8f592504528d044b932d4d6">nameEdit_</a></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="classHelloApplication.html#a060ca5306a0289f4097ff6f83755cbad">greeting_</a></td></tr> </table> <hr/><a name="details" id="details"></a><h2>Detailed Description</h2> <div class="textblock"> <p>Definition at line <a class="el" href="hello_8C_source.html#l00023">23</a> of file <a class="el" href="hello_8C_source.html">hello.C</a>.</p> </div><hr/><h2>Constructor & Destructor Documentation</h2> <a class="anchor" id="af8cfe75959bce2e4fba80a46f009c4a6"></a><!-- doxytag: member="HelloApplication::HelloApplication" ref="af8cfe75959bce2e4fba80a46f009c4a6" args="(const WEnvironment &env)" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">HelloApplication::HelloApplication </td> <td>(</td> <td class="paramtype">const <a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a> & </td> <td class="paramname"><em>env</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="hello_8C_source.html#l00041">41</a> of file <a class="el" href="hello_8C_source.html">hello.C</a>.</p> <div class="fragment"><pre class="fragment"> : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#ae29a843f4d50159b17abfa9503c389db">WApplication</a>(env) { <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a71a3f7da5abb9a76df94fab69ba61670">setTitle</a>(<span class="stringliteral">"Hello world"</span>); <span class="comment">// application title</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a17e118a04d962459484a12989a80bc05">root</a>()-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<span class="stringliteral">"Your name, please ? "</span>)); <span class="comment">// show some text</span> <a class="code" href="classHelloApplication.html#a223a6b0ae8f592504528d044b932d4d6">nameEdit_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLineEdit.html">WLineEdit</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a17e118a04d962459484a12989a80bc05">root</a>()); <span class="comment">// allow text input</span> <a class="code" href="classHelloApplication.html#a223a6b0ae8f592504528d044b932d4d6">nameEdit_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WFormWidget.html#afe33f5c3658ddbd08fec9f6c203c578b">setFocus</a>(); <span class="comment">// give focus</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPushButton.html">WPushButton</a> *button = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WPushButton.html">WPushButton</a>(<span class="stringliteral">"Greet me."</span>, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a17e118a04d962459484a12989a80bc05">root</a>()); <span class="comment">// create a button</span> button-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a9795c18e926b26b97fcbabc62a1dd4e3">setMargin</a>(5, Left); <span class="comment">// add 5 pixels margin</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a17e118a04d962459484a12989a80bc05">root</a>()-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WBreak.html">WBreak</a>()); <span class="comment">// insert a line break</span> <a class="code" href="classHelloApplication.html#a060ca5306a0289f4097ff6f83755cbad">greeting_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a17e118a04d962459484a12989a80bc05">root</a>()); <span class="comment">// empty text</span> <span class="comment">/*</span> <span class="comment"> * Connect signals with slots</span> <span class="comment"> *</span> <span class="comment"> * - simple Wt-way</span> <span class="comment"> */</span> button-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<span class="keyword">this</span>, &<a class="code" href="classHelloApplication.html#a94de3317a1e6e45964a3dfa9aacef9f9">HelloApplication::greet</a>); <span class="comment">/*</span> <span class="comment"> * - using an arbitrary function object (binding values with boost::bind())</span> <span class="comment"> */</span> <a class="code" href="classHelloApplication.html#a223a6b0ae8f592504528d044b932d4d6">nameEdit_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#a38f06d1ad95e7599b055f49931236c10">enterPressed</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1EventSignal.html#a36896f54a4db342af24efa6e9d703455">connect</a> (boost::bind(&<a class="code" href="classHelloApplication.html#a94de3317a1e6e45964a3dfa9aacef9f9">HelloApplication::greet</a>, <span class="keyword">this</span>)); <span class="comment">/*</span> <span class="comment"> * - using a c++0x lambda:</span> <span class="comment"> */</span> <span class="comment">// b->clicked().connect(std::bind([=]() { </span> <span class="comment">// greeting_->setText("Hello there, " + nameEdit_->text());</span> <span class="comment">// }));</span> } </pre></div> </div> </div> <hr/><h2>Member Function Documentation</h2> <a class="anchor" id="a94de3317a1e6e45964a3dfa9aacef9f9"></a><!-- doxytag: member="HelloApplication::greet" ref="a94de3317a1e6e45964a3dfa9aacef9f9" args="()" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname">void HelloApplication::greet </td> <td>(</td> <td class="paramname"></td><td>)</td> <td><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="hello_8C_source.html#l00079">79</a> of file <a class="el" href="hello_8C_source.html">hello.C</a>.</p> <div class="fragment"><pre class="fragment">{ <span class="comment">/*</span> <span class="comment"> * Update the text, using text input into the nameEdit_ field.</span> <span class="comment"> */</span> <a class="code" href="classHelloApplication.html#a060ca5306a0289f4097ff6f83755cbad">greeting_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html#a2f788aa524d51b3962642c9f565e66e6">setText</a>(<span class="stringliteral">"Hello there, "</span> + <a class="code" href="classHelloApplication.html#a223a6b0ae8f592504528d044b932d4d6">nameEdit_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLineEdit.html#ac74b58779cb635898cac13e81d8b0c7a">text</a>()); } </pre></div> </div> </div> <hr/><h2>Member Data Documentation</h2> <a class="anchor" id="a060ca5306a0289f4097ff6f83755cbad"></a><!-- doxytag: member="HelloApplication::greeting_" ref="a060ca5306a0289f4097ff6f83755cbad" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>* <a class="el" href="classHelloApplication.html#a060ca5306a0289f4097ff6f83755cbad">HelloApplication::greeting_</a><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="hello_8C_source.html#l00030">30</a> of file <a class="el" href="hello_8C_source.html">hello.C</a>.</p> </div> </div> <a class="anchor" id="a223a6b0ae8f592504528d044b932d4d6"></a><!-- doxytag: member="HelloApplication::nameEdit_" ref="a223a6b0ae8f592504528d044b932d4d6" args="" --> <div class="memitem"> <div class="memproto"> <table class="memname"> <tr> <td class="memname"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLineEdit.html">WLineEdit</a>* <a class="el" href="classHelloApplication.html#a223a6b0ae8f592504528d044b932d4d6">HelloApplication::nameEdit_</a><code> [private]</code></td> </tr> </table> </div> <div class="memdoc"> <p>Definition at line <a class="el" href="hello_8C_source.html#l00029">29</a> of file <a class="el" href="hello_8C_source.html">hello.C</a>.</p> </div> </div> <hr/>The documentation for this class was generated from the following file:<ul> <li>/home/koen/project/wt/public-git/wt/examples/hello/<a class="el" href="hello_8C_source.html">hello.C</a></li> </ul> </div> <hr size="1"><address style="text-align: right; margin: 3px"><small> Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the C++ Web Toolkit (Wt)</a> by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" border="0" style="vertical-align: middle; display: inline-block; height: 2em"></a> 1.7.5.1</small></address> </body> </html>