<!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: /home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C Source File</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><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div id="navrow2" class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> <li><a href="globals.html"><span>File Members</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <div class="title">/home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C</div> </div> </div> <div class="contents"> <a href="WtHome_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span> <a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * See the LICENSE file for terms of use.</span> <a name="l00005"></a>00005 <span class="comment"> */</span> <a name="l00006"></a>00006 <a name="l00007"></a>00007 <span class="preprocessor">#include "<a class="code" href="WtHome_8h.html">WtHome.h</a>"</span> <a name="l00008"></a>00008 <a name="l00009"></a>00009 <span class="preprocessor">#ifdef WT_EMWEB_BUILD</span> <a name="l00010"></a>00010 <span class="preprocessor"></span><span class="preprocessor">#include "QuoteForm.h"</span> <a name="l00011"></a>00011 <span class="preprocessor">#endif // WT_EMWEB_BUILD</span> <a name="l00012"></a>00012 <span class="preprocessor"></span> <a name="l00013"></a>00013 <span class="preprocessor">#include <Wt/WAnchor></span> <a name="l00014"></a>00014 <span class="preprocessor">#include <Wt/WEnvironment></span> <a name="l00015"></a>00015 <span class="preprocessor">#include <<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/WLogger.html">Wt/WLogger</a>></span> <a name="l00016"></a>00016 <span class="preprocessor">#include <Wt/WMenuItem></span> <a name="l00017"></a>00017 <span class="preprocessor">#include <Wt/WStackedWidget></span> <a name="l00018"></a>00018 <span class="preprocessor">#include <Wt/WTable></span> <a name="l00019"></a>00019 <span class="preprocessor">#include <Wt/WTabWidget></span> <a name="l00020"></a>00020 <span class="preprocessor">#include <Wt/WText></span> <a name="l00021"></a>00021 <span class="preprocessor">#include <Wt/WTreeNode></span> <a name="l00022"></a>00022 <span class="preprocessor">#include <Wt/WViewWidget></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <Wt/WWidget></span> <a name="l00024"></a>00024 <a name="l00025"></a>00025 <span class="preprocessor">#include "<a class="code" href="ExampleSourceViewer_8h.html">ExampleSourceViewer.h</a>"</span> <a name="l00026"></a>00026 <a name="l00027"></a><a class="code" href="classWtHome.html#a916f894b0b3ff5a08ebe77caad74be3e">00027</a> <a class="code" href="classWtHome.html#a916f894b0b3ff5a08ebe77caad74be3e">WtHome::WtHome</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a>& env) <a name="l00028"></a>00028 : <a class="code" href="classHome.html">Home</a>(env, <span class="stringliteral">"Wt, C++ Web Toolkit"</span>, <span class="stringliteral">"wt-home"</span>, <span class="stringliteral">"css/wt"</span>) <a name="l00029"></a>00029 { <a name="l00030"></a>00030 <a class="code" href="classHome.html#a36ac9d0c0798abaa419790c4888686b0">addLanguage</a>(<a class="code" href="structLang.html">Lang</a>(<span class="stringliteral">"en"</span>, <span class="stringliteral">"/"</span>, <span class="stringliteral">"en"</span>, <span class="stringliteral">"English"</span>)); <a name="l00031"></a>00031 <a class="code" href="classHome.html#a36ac9d0c0798abaa419790c4888686b0">addLanguage</a>(<a class="code" href="structLang.html">Lang</a>(<span class="stringliteral">"cn"</span>, <span class="stringliteral">"/cn/"</span>, <span class="stringliteral">"汉语"</span>, <span class="stringliteral">"中文 (Chinese)"</span>)); <a name="l00032"></a>00032 <a class="code" href="classHome.html#a36ac9d0c0798abaa419790c4888686b0">addLanguage</a>(<a class="code" href="structLang.html">Lang</a>(<span class="stringliteral">"ru"</span>, <span class="stringliteral">"/ru/"</span>, <span class="stringliteral">"ру"</span>, <span class="stringliteral">"Русский (Russian)"</span>)); <a name="l00033"></a>00033 <a name="l00034"></a>00034 <span class="keywordtype">char</span>* wtExamplePath = getenv(<span class="stringliteral">"WT_EXAMPLE_PATH"</span>); <a name="l00035"></a>00035 <span class="keywordflow">if</span> (wtExamplePath) <a name="l00036"></a>00036 <a class="code" href="classWtHome.html#ab6c76e3ef4c4b568f6111dae7a28619c">wtExamplePath_</a> = wtExamplePath; <a name="l00037"></a>00037 <span class="keywordflow">else</span> <a name="l00038"></a>00038 <a class="code" href="classWtHome.html#ab6c76e3ef4c4b568f6111dae7a28619c">wtExamplePath_</a> = <span class="stringliteral">"../"</span>; <a name="l00039"></a>00039 <a name="l00040"></a>00040 <a class="code" href="classHome.html#a63520babce460a8f3e1c8d02eb9bc137">init</a>(); <a name="l00041"></a>00041 } <a name="l00042"></a>00042 <a name="l00043"></a><a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">00043</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">WtHome::example</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *textKey, <span class="keyword">const</span> std::string& sourceDir) <a name="l00044"></a>00044 { <a name="l00045"></a>00045 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *result = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>(); <a name="l00046"></a>00046 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> *w = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(textKey), result); <a name="l00047"></a>00047 w-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html#a3491e55f74027b49aaf8cd25369bc0e4">setInternalPathEncoding</a>(<span class="keyword">true</span>); <a name="l00048"></a>00048 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<a class="code" href="classHome.html#a6360a674c4d5dcc614411c283af8035b">linkSourceBrowser</a>(sourceDir)); <a name="l00049"></a>00049 <span class="keywordflow">return</span> result; <a name="l00050"></a>00050 } <a name="l00051"></a>00051 <a name="l00052"></a><a class="code" href="classWtHome.html#a607084e649fc3897c71971b3b07c76b2">00052</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a607084e649fc3897c71971b3b07c76b2">WtHome::helloWorldExample</a>() <a name="l00053"></a>00053 { <a name="l00054"></a>00054 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.hello"</span>, <span class="stringliteral">"hello"</span>); <a name="l00055"></a>00055 } <a name="l00056"></a>00056 <a name="l00057"></a><a class="code" href="classWtHome.html#a9b1d47a2e9ab440ce3b474894f7a1b3b">00057</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a9b1d47a2e9ab440ce3b474894f7a1b3b">WtHome::chartExample</a>() <a name="l00058"></a>00058 { <a name="l00059"></a>00059 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.chart"</span>, <span class="stringliteral">"charts"</span>); <a name="l00060"></a>00060 } <a name="l00061"></a>00061 <a name="l00062"></a><a class="code" href="classWtHome.html#a17271af74b46d7b0845dc90510ad9b22">00062</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a17271af74b46d7b0845dc90510ad9b22">WtHome::homepageExample</a>() <a name="l00063"></a>00063 { <a name="l00064"></a>00064 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.wt"</span>, <span class="stringliteral">"wt-homepage"</span>); <a name="l00065"></a>00065 } <a name="l00066"></a>00066 <a name="l00067"></a><a class="code" href="classWtHome.html#a99ef832c24161e5e271b8e2d3a6ca20e">00067</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a99ef832c24161e5e271b8e2d3a6ca20e">WtHome::treeviewExample</a>() <a name="l00068"></a>00068 { <a name="l00069"></a>00069 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.treeview"</span>, <span class="stringliteral">"treeview-dragdrop"</span>); <a name="l00070"></a>00070 } <a name="l00071"></a>00071 <a name="l00072"></a><a class="code" href="classWtHome.html#a9b98e2ab6f0cbebf4b19de9c27af08e1">00072</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a9b98e2ab6f0cbebf4b19de9c27af08e1">WtHome::gitExample</a>() <a name="l00073"></a>00073 { <a name="l00074"></a>00074 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.git"</span>, <span class="stringliteral">"gitmodel"</span>); <a name="l00075"></a>00075 } <a name="l00076"></a>00076 <a name="l00077"></a><a class="code" href="classWtHome.html#a17880b6f1a2c40774cb730e68d4d3089">00077</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a17880b6f1a2c40774cb730e68d4d3089">WtHome::chatExample</a>() <a name="l00078"></a>00078 { <a name="l00079"></a>00079 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.chat"</span>, <span class="stringliteral">"simplechat"</span>); <a name="l00080"></a>00080 } <a name="l00081"></a>00081 <a name="l00082"></a><a class="code" href="classWtHome.html#af3a430044572741e18801a2e3a4ace27">00082</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#af3a430044572741e18801a2e3a4ace27">WtHome::composerExample</a>() <a name="l00083"></a>00083 { <a name="l00084"></a>00084 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.composer"</span>, <span class="stringliteral">"composer"</span>); <a name="l00085"></a>00085 } <a name="l00086"></a>00086 <a name="l00087"></a><a class="code" href="classWtHome.html#ad7f6cf25a06b5d595f04074e348711d0">00087</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#ad7f6cf25a06b5d595f04074e348711d0">WtHome::widgetGalleryExample</a>() <a name="l00088"></a>00088 { <a name="l00089"></a>00089 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.widgetgallery"</span>, <span class="stringliteral">"widgetgallery"</span>); <a name="l00090"></a>00090 } <a name="l00091"></a>00091 <a name="l00092"></a><a class="code" href="classWtHome.html#ac47d7c2014f292c434f8c7929e2e15b4">00092</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#ac47d7c2014f292c434f8c7929e2e15b4">WtHome::hangmanExample</a>() <a name="l00093"></a>00093 { <a name="l00094"></a>00094 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#a13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.hangman"</span>, <span class="stringliteral">"hangman"</span>); <a name="l00095"></a>00095 } <a name="l00096"></a>00096 <a name="l00097"></a><a class="code" href="classWtHome.html#a1891319ba04a1219be58e80c54330803">00097</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a1891319ba04a1219be58e80c54330803">WtHome::examples</a>() <a name="l00098"></a>00098 { <a name="l00099"></a>00099 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *result = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a>(); <a name="l00100"></a>00100 <a name="l00101"></a>00101 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a> *intro = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html">WText</a>(<a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"home.examples"</span>)); <a name="l00102"></a>00102 intro-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WText.html#a3491e55f74027b49aaf8cd25369bc0e4">setInternalPathEncoding</a>(<span class="keyword">true</span>); <a name="l00103"></a>00103 result-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(intro); <a name="l00104"></a>00104 <a name="l00105"></a>00105 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html">WTabWidget</a>(result); <a name="l00106"></a>00106 <a name="l00107"></a>00107 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WAnimation.html">WAnimation</a> animation(WAnimation::SlideInFromRight, WAnimation::EaseIn); <a name="l00108"></a>00108 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a168ee0826c0bc38e6d2a5c1b5f5c0630">contentsStack</a>()-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WStackedWidget.html#a46949b8def26baae654f54e3774da80e">setTransitionAnimation</a>(animation, <span class="keyword">true</span>); <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="comment">/*</span> <a name="l00111"></a>00111 <span class="comment"> * The following code is functionally equivalent to:</span> <a name="l00112"></a>00112 <span class="comment"> *</span> <a name="l00113"></a>00113 <span class="comment"> * examplesMenu_->addTab(helloWorldExample(), "Hello world");</span> <a name="l00114"></a>00114 <span class="comment"> *</span> <a name="l00115"></a>00115 <span class="comment"> * However, we optimize here for memory consumption (it is a homepage</span> <a name="l00116"></a>00116 <span class="comment"> * after all, and we hope to be slashdotted some day)</span> <a name="l00117"></a>00117 <span class="comment"> *</span> <a name="l00118"></a>00118 <span class="comment"> * Therefore, we wrap all the static content (including the tree</span> <a name="l00119"></a>00119 <span class="comment"> * widgets), into WViewWidgets with static models. In this way the</span> <a name="l00120"></a>00120 <span class="comment"> * widgets are not actually stored in memory on the server.</span> <a name="l00121"></a>00121 <span class="comment"> */</span> <a name="l00122"></a>00122 <a name="l00123"></a>00123 <span class="comment">// The call ->setPathComponent() is to use "/examples/" instead of</span> <a name="l00124"></a>00124 <span class="comment">// "/examples/hello_world" as internal path</span> <a name="l00125"></a>00125 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#a607084e649fc3897c71971b3b07c76b2">WtHome::helloWorldExample</a>), <a name="l00126"></a>00126 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"hello-world"</span>))-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WMenuItem.html#a4291756303dbf128b718679cdb907a5a">setPathComponent</a>(<span class="stringliteral">""</span>); <a name="l00127"></a>00127 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#a9b1d47a2e9ab440ce3b474894f7a1b3b">WtHome::chartExample</a>), <a name="l00128"></a>00128 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"charts"</span>)); <a name="l00129"></a>00129 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#a17271af74b46d7b0845dc90510ad9b22">WtHome::homepageExample</a>), <a name="l00130"></a>00130 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"wt-homepage"</span>)); <a name="l00131"></a>00131 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#a99ef832c24161e5e271b8e2d3a6ca20e">WtHome::treeviewExample</a>), <a name="l00132"></a>00132 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"treeview"</span>)); <a name="l00133"></a>00133 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#a9b98e2ab6f0cbebf4b19de9c27af08e1">WtHome::gitExample</a>), <a name="l00134"></a>00134 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"git"</span>)); <a name="l00135"></a>00135 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#a17880b6f1a2c40774cb730e68d4d3089">WtHome::chatExample</a>), <a name="l00136"></a>00136 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"chat"</span>)); <a name="l00137"></a>00137 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#af3a430044572741e18801a2e3a4ace27">WtHome::composerExample</a>), <a name="l00138"></a>00138 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"mail-composer"</span>)); <a name="l00139"></a>00139 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#ac47d7c2014f292c434f8c7929e2e15b4">WtHome::hangmanExample</a>), <a name="l00140"></a>00140 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"hangman"</span>)); <a name="l00141"></a>00141 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#ad7f6cf25a06b5d595f04074e348711d0">WtHome::widgetGalleryExample</a>), <a name="l00142"></a>00142 <a class="code" href="classHome.html#a7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"widget-gallery"</span>)); <a name="l00143"></a>00143 <a name="l00144"></a>00144 <span class="comment">// Enable internal paths for the example menu</span> <a name="l00145"></a>00145 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a855b45897b00f82137cd0eb9e0d40dfd">setInternalPathEnabled</a>(<span class="stringliteral">"/examples"</span>); <a name="l00146"></a>00146 <a class="code" href="classHome.html#a3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WTabWidget.html#a5447e1149d6c854f25d6fb6792eef513">currentChanged</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1Signal.html#a15d1150af031537b492674ee651bf4a3">connect</a>(<span class="keyword">this</span>, &<a class="code" href="classHome.html#a3c26dd54dbc1a2020776f2d6cb2aa6bf">Home::googleAnalyticsLogger</a>); <a name="l00147"></a>00147 <a name="l00148"></a>00148 <span class="keywordflow">return</span> result; <a name="l00149"></a>00149 } <a name="l00150"></a>00150 <a name="l00151"></a><a class="code" href="classWtHome.html#a00b440196930a5229ac2f6f81df1b5e7">00151</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a00b440196930a5229ac2f6f81df1b5e7">WtHome::createQuoteForm</a>() <a name="l00152"></a>00152 { <a name="l00153"></a>00153 <span class="preprocessor">#ifdef WT_EMWEB_BUILD</span> <a name="l00154"></a>00154 <span class="preprocessor"></span> <span class="keywordflow">return</span> <span class="keyword">new</span> QuoteForm(QuoteForm::Wt); <a name="l00155"></a>00155 <span class="preprocessor">#else</span> <a name="l00156"></a>00156 <span class="preprocessor"></span> <span class="keywordflow">return</span> 0; <a name="l00157"></a>00157 <span class="preprocessor">#endif</span> <a name="l00158"></a>00158 <span class="preprocessor"></span>} <a name="l00159"></a>00159 <a name="l00160"></a><a class="code" href="classWtHome.html#a81bfb1f1a961403d2e578de60571693a">00160</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a81bfb1f1a961403d2e578de60571693a">WtHome::sourceViewer</a>(<span class="keyword">const</span> std::string& deployPath) <a name="l00161"></a>00161 { <a name="l00162"></a>00162 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classExampleSourceViewer.html" title="A simple widget to visualise a set of example source files.">ExampleSourceViewer</a>(deployPath, <a class="code" href="classWtHome.html#ab6c76e3ef4c4b568f6111dae7a28619c">wtExamplePath_</a> + <span class="stringliteral">"/"</span>, <span class="stringliteral">"CPP"</span>); <a name="l00163"></a>00163 } <a name="l00164"></a>00164 <a name="l00165"></a><a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">00165</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#a52135719f856d544fad387c76af06182">WtHome::wrapView</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *(<a class="code" href="classWtHome.html">WtHome</a>::*<a class="code" href="group__chatexample.html#gabf00719b4e042ae3ee5676d30791ace0">createWidget</a>)()) <a name="l00166"></a>00166 { <a name="l00167"></a>00167 <span class="keywordflow">return</span> makeStaticModel(boost::bind(createWidget, <span class="keyword">this</span>)); <a name="l00168"></a>00168 } <a name="l00169"></a>00169 <a name="l00170"></a><a class="code" href="WtHome_8h.html#add0ef25910d91a7bd79ffb3c07a9af32">00170</a> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *<a class="code" href="WtHome_8C.html#add0ef25910d91a7bd79ffb3c07a9af32">createWtHomeApplication</a>(<span class="keyword">const</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html">WEnvironment</a>& env) <a name="l00171"></a>00171 { <a name="l00172"></a>00172 <span class="comment">// support for old (< Wt-2.2) homepage URLS: redirect from "states"</span> <a name="l00173"></a>00173 <span class="comment">// to "internal paths"</span> <a name="l00174"></a>00174 <span class="comment">// this contains the initial "history state" in old Wt versions</span> <a name="l00175"></a>00175 <span class="keyword">const</span> std::string *historyKey = env.<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WEnvironment.html#a3f87915f10f39b18eac28bac65c0cd46">getParameter</a>(<span class="stringliteral">"historyKey"</span>); <a name="l00176"></a>00176 <a name="l00177"></a>00177 <span class="keywordflow">if</span> (historyKey) { <a name="l00178"></a>00178 <span class="keyword">const</span> <span class="keywordtype">char</span> *mainStr[] <a name="l00179"></a>00179 = { <span class="stringliteral">"main:0"</span>, <span class="stringliteral">"/"</span>, <a name="l00180"></a>00180 <span class="stringliteral">"main:1"</span>, <span class="stringliteral">"/news"</span>, <a name="l00181"></a>00181 <span class="stringliteral">"main:2"</span>, <span class="stringliteral">"/features"</span>, <a name="l00182"></a>00182 <span class="stringliteral">"main:4"</span>, <span class="stringliteral">"/examples"</span>, <a name="l00183"></a>00183 <span class="stringliteral">"main:3"</span>, <span class="stringliteral">"/documentation"</span>, <a name="l00184"></a>00184 <span class="stringliteral">"main:5"</span>, <span class="stringliteral">"/download"</span>, <a name="l00185"></a>00185 <span class="stringliteral">"main:6"</span>, <span class="stringliteral">"/community"</span> }; <a name="l00186"></a>00186 <a name="l00187"></a>00187 <span class="keyword">const</span> <span class="keywordtype">char</span> *exampleStr[] <a name="l00188"></a>00188 = { <span class="stringliteral">"example:0"</span>, <span class="stringliteral">"/examples"</span>, <a name="l00189"></a>00189 <span class="stringliteral">"example:1"</span>, <span class="stringliteral">"/examples/charts"</span>, <a name="l00190"></a>00190 <span class="stringliteral">"example:2"</span>, <span class="stringliteral">"/examples/wt-homepage"</span>, <a name="l00191"></a>00191 <span class="stringliteral">"example:3"</span>, <span class="stringliteral">"/examples/treelist"</span>, <a name="l00192"></a>00192 <span class="stringliteral">"example:4"</span>, <span class="stringliteral">"/examples/hangman"</span>, <a name="l00193"></a>00193 <span class="stringliteral">"example:5"</span>, <span class="stringliteral">"/examples/chat"</span>, <a name="l00194"></a>00194 <span class="stringliteral">"example:6"</span>, <span class="stringliteral">"/examples/mail-composer"</span>, <a name="l00195"></a>00195 <span class="stringliteral">"example:7"</span>, <span class="stringliteral">"/examples/drag-and-drop"</span>, <a name="l00196"></a>00196 <span class="stringliteral">"example:8"</span>, <span class="stringliteral">"/examples/file-explorer"</span>, <a name="l00197"></a>00197 <span class="stringliteral">"example:9"</span>, <span class="stringliteral">"/examples/calendar"</span> }; <a name="l00198"></a>00198 <a name="l00199"></a>00199 <span class="keywordflow">if</span> (historyKey->find(<span class="stringliteral">"main:4"</span>) != std::string::npos) { <a name="l00200"></a>00200 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < 10; ++i) <a name="l00201"></a>00201 <span class="keywordflow">if</span> (historyKey->find(exampleStr[i*2]) != std::string::npos) { <a name="l00202"></a>00202 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *app = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>(env); <a name="l00203"></a>00203 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">"notice"</span>) << <span class="stringliteral">"redirecting old style URL '"</span> <a name="l00204"></a>00204 << *historyKey << <span class="stringliteral">"' to internal path: '"</span> <a name="l00205"></a>00205 << exampleStr[i*2+1] << <span class="stringliteral">"'"</span>; <a name="l00206"></a>00206 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(exampleStr[i*2+1])); <a name="l00207"></a>00207 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a5231d54ed34982f4366058eb6440c8f7">quit</a>(); <a name="l00208"></a>00208 <span class="keywordflow">return</span> app; <a name="l00209"></a>00209 } <a name="l00210"></a>00210 } <span class="keywordflow">else</span> <a name="l00211"></a>00211 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < 6; ++i) <a name="l00212"></a>00212 <span class="keywordflow">if</span> (historyKey->find(mainStr[i*2]) != std::string::npos) { <a name="l00213"></a>00213 <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a> *app = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html">WApplication</a>(env); <a name="l00214"></a>00214 <a name="l00215"></a>00215 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">"notice"</span>) << <span class="stringliteral">"redirecting old style URL '"</span> <a name="l00216"></a>00216 << *historyKey << <span class="stringliteral">"' to internal path: '"</span> <a name="l00217"></a>00217 << mainStr[i*2+1] << <span class="stringliteral">"'"</span>; <a name="l00218"></a>00218 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(mainStr[i*2+1])); <a name="l00219"></a>00219 app-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WApplication.html#a5231d54ed34982f4366058eb6440c8f7">quit</a>(); <a name="l00220"></a>00220 <span class="keywordflow">return</span> app; <a name="l00221"></a>00221 } <a name="l00222"></a>00222 <a name="l00223"></a>00223 <span class="comment">// unknown history key, just continue</span> <a name="l00224"></a>00224 } <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classWtHome.html">WtHome</a>(env); <a name="l00227"></a>00227 } </pre></div></div> </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>