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
|
<!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 examples: /home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C Source File</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="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>
<h1>/home/koen/project/wt/public-git/wt/examples/wt-homepage/WtHome.C</h1><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">#include <Wt/WAnchor></span>
<a name="l00010"></a>00010 <span class="preprocessor">#include <Wt/WEnvironment></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include <Wt/WLogger></span>
<a name="l00012"></a>00012 <span class="preprocessor">#include <Wt/WMenuItem></span>
<a name="l00013"></a>00013 <span class="preprocessor">#include <Wt/WTable></span>
<a name="l00014"></a>00014 <span class="preprocessor">#include <Wt/WTabWidget></span>
<a name="l00015"></a>00015 <span class="preprocessor">#include <Wt/WText></span>
<a name="l00016"></a>00016 <span class="preprocessor">#include <Wt/WTreeNode></span>
<a name="l00017"></a>00017 <span class="preprocessor">#include <Wt/WViewWidget></span>
<a name="l00018"></a>00018 <span class="preprocessor">#include <Wt/WWidget></span>
<a name="l00019"></a>00019
<a name="l00020"></a>00020 <span class="preprocessor">#include "<a class="code" href="ExampleSourceViewer_8h.html">ExampleSourceViewer.h</a>"</span>
<a name="l00021"></a>00021
<a name="l00022"></a><a class="code" href="classWtHome.html#916f894b0b3ff5a08ebe77caad74be3e">00022</a> <a class="code" href="classWtHome.html#916f894b0b3ff5a08ebe77caad74be3e">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="l00023"></a>00023 : <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="l00024"></a>00024 {
<a name="l00025"></a>00025 <a class="code" href="classHome.html#36ac9d0c0798abaa419790c4888686b0">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="l00026"></a>00026 <a class="code" href="classHome.html#36ac9d0c0798abaa419790c4888686b0">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="l00027"></a>00027
<a name="l00028"></a>00028 <span class="keywordtype">char</span>* wtExamplePath = getenv(<span class="stringliteral">"WT_EXAMPLE_PATH"</span>);
<a name="l00029"></a>00029 <span class="keywordflow">if</span> (wtExamplePath)
<a name="l00030"></a>00030 <a class="code" href="classWtHome.html#b6c76e3ef4c4b568f6111dae7a28619c">wtExamplePath_</a> = wtExamplePath;
<a name="l00031"></a>00031 <span class="keywordflow">else</span>
<a name="l00032"></a>00032 <a class="code" href="classWtHome.html#b6c76e3ef4c4b568f6111dae7a28619c">wtExamplePath_</a> = <span class="stringliteral">"../"</span>;
<a name="l00033"></a>00033
<a name="l00034"></a>00034 <a class="code" href="classHome.html#63520babce460a8f3e1c8d02eb9bc137">init</a>();
<a name="l00035"></a>00035 }
<a name="l00036"></a>00036
<a name="l00037"></a><a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">00037</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">WtHome::example</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *textKey, <span class="keyword">const</span> std::string& sourceDir)
<a name="l00038"></a>00038 {
<a name="l00039"></a>00039 <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="l00040"></a>00040 <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#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(textKey), result);
<a name="l00041"></a>00041 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<a class="code" href="classHome.html#6360a674c4d5dcc614411c283af8035b">linkSourceBrowser</a>(sourceDir));
<a name="l00042"></a>00042 <span class="keywordflow">return</span> result;
<a name="l00043"></a>00043 }
<a name="l00044"></a>00044
<a name="l00045"></a><a class="code" href="classWtHome.html#607084e649fc3897c71971b3b07c76b2">00045</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#607084e649fc3897c71971b3b07c76b2">WtHome::helloWorldExample</a>()
<a name="l00046"></a>00046 {
<a name="l00047"></a>00047 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.hello"</span>, <span class="stringliteral">"hello"</span>);
<a name="l00048"></a>00048 }
<a name="l00049"></a>00049
<a name="l00050"></a><a class="code" href="classWtHome.html#9b1d47a2e9ab440ce3b474894f7a1b3b">00050</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#9b1d47a2e9ab440ce3b474894f7a1b3b">WtHome::chartExample</a>()
<a name="l00051"></a>00051 {
<a name="l00052"></a>00052 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.chart"</span>, <span class="stringliteral">"charts"</span>);
<a name="l00053"></a>00053 }
<a name="l00054"></a>00054
<a name="l00055"></a><a class="code" href="classWtHome.html#17271af74b46d7b0845dc90510ad9b22">00055</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#17271af74b46d7b0845dc90510ad9b22">WtHome::homepageExample</a>()
<a name="l00056"></a>00056 {
<a name="l00057"></a>00057 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.wt"</span>, <span class="stringliteral">"wt-homepage"</span>);
<a name="l00058"></a>00058 }
<a name="l00059"></a>00059
<a name="l00060"></a><a class="code" href="classWtHome.html#99ef832c24161e5e271b8e2d3a6ca20e">00060</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#99ef832c24161e5e271b8e2d3a6ca20e">WtHome::treeviewExample</a>()
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.treeview"</span>, <span class="stringliteral">"treeview-dragdrop"</span>);
<a name="l00063"></a>00063 }
<a name="l00064"></a>00064
<a name="l00065"></a><a class="code" href="classWtHome.html#9b98e2ab6f0cbebf4b19de9c27af08e1">00065</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#9b98e2ab6f0cbebf4b19de9c27af08e1">WtHome::gitExample</a>()
<a name="l00066"></a>00066 {
<a name="l00067"></a>00067 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.git"</span>, <span class="stringliteral">"gitmodel"</span>);
<a name="l00068"></a>00068 }
<a name="l00069"></a>00069
<a name="l00070"></a><a class="code" href="classWtHome.html#17880b6f1a2c40774cb730e68d4d3089">00070</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#17880b6f1a2c40774cb730e68d4d3089">WtHome::chatExample</a>()
<a name="l00071"></a>00071 {
<a name="l00072"></a>00072 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.chat"</span>, <span class="stringliteral">"simplechat"</span>);
<a name="l00073"></a>00073 }
<a name="l00074"></a>00074
<a name="l00075"></a><a class="code" href="classWtHome.html#f3a430044572741e18801a2e3a4ace27">00075</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#f3a430044572741e18801a2e3a4ace27">WtHome::composerExample</a>()
<a name="l00076"></a>00076 {
<a name="l00077"></a>00077 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.composer"</span>, <span class="stringliteral">"composer"</span>);
<a name="l00078"></a>00078 }
<a name="l00079"></a>00079
<a name="l00080"></a><a class="code" href="classWtHome.html#d7f6cf25a06b5d595f04074e348711d0">00080</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#d7f6cf25a06b5d595f04074e348711d0">WtHome::widgetGalleryExample</a>()
<a name="l00081"></a>00081 {
<a name="l00082"></a>00082 <span class="keywordflow">return</span> <a class="code" href="classWtHome.html#13fc1bc689a28fcdbd08088928940e3c">example</a>(<span class="stringliteral">"home.examples.widgetgallery"</span>, <span class="stringliteral">"widgetgallery"</span>);
<a name="l00083"></a>00083 }
<a name="l00084"></a>00084
<a name="l00085"></a><a class="code" href="classWtHome.html#1891319ba04a1219be58e80c54330803">00085</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#1891319ba04a1219be58e80c54330803">WtHome::examples</a>()
<a name="l00086"></a>00086 {
<a name="l00087"></a>00087 <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="l00088"></a>00088
<a name="l00089"></a>00089 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</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="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"home.examples"</span>)));
<a name="l00090"></a>00090
<a name="l00091"></a>00091 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html">WTabWidget</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/namespaceWt.html#b8f772c69bc8180c31f9e4f4593b143f58fe5182bd266132c59718c6d30945a9">AlignTop</a> | <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/namespaceWt.html#b8f772c69bc8180c31f9e4f4593b143f18cdf9d975a5a41afa182aabfde0de88">AlignJustify</a>, result);
<a name="l00092"></a>00092
<a name="l00093"></a>00093 <span class="comment">/*</span>
<a name="l00094"></a>00094 <span class="comment"> * The following code is functionally equivalent to:</span>
<a name="l00095"></a>00095 <span class="comment"> *</span>
<a name="l00096"></a>00096 <span class="comment"> * examplesMenu_->addTab(helloWorldExample(), "Hello world");</span>
<a name="l00097"></a>00097 <span class="comment"> *</span>
<a name="l00098"></a>00098 <span class="comment"> * However, we optimize here for memory consumption (it is a homepage</span>
<a name="l00099"></a>00099 <span class="comment"> * after all, and we hope to be slashdotted some day)</span>
<a name="l00100"></a>00100 <span class="comment"> *</span>
<a name="l00101"></a>00101 <span class="comment"> * Therefore, we wrap all the static content (including the tree</span>
<a name="l00102"></a>00102 <span class="comment"> * widgets), into WViewWidgets with static models. In this way the</span>
<a name="l00103"></a>00103 <span class="comment"> * widgets are not actually stored in memory on the server.</span>
<a name="l00104"></a>00104 <span class="comment"> */</span>
<a name="l00105"></a>00105
<a name="l00106"></a>00106 <span class="comment">// The call ->setPathComponent() is to use "/examples/" instead of</span>
<a name="l00107"></a>00107 <span class="comment">// "/examples/hello_world" as internal path</span>
<a name="l00108"></a>00108 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#607084e649fc3897c71971b3b07c76b2">WtHome::helloWorldExample</a>),
<a name="l00109"></a>00109 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"hello-world"</span>))-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WMenuItem.html#4291756303dbf128b718679cdb907a5a">setPathComponent</a>(<span class="stringliteral">""</span>);
<a name="l00110"></a>00110 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#9b1d47a2e9ab440ce3b474894f7a1b3b">WtHome::chartExample</a>),
<a name="l00111"></a>00111 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"charts"</span>));
<a name="l00112"></a>00112 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#17271af74b46d7b0845dc90510ad9b22">WtHome::homepageExample</a>),
<a name="l00113"></a>00113 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"wt-homepage"</span>));
<a name="l00114"></a>00114 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#99ef832c24161e5e271b8e2d3a6ca20e">WtHome::treeviewExample</a>),
<a name="l00115"></a>00115 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"treeview"</span>));
<a name="l00116"></a>00116 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#9b98e2ab6f0cbebf4b19de9c27af08e1">WtHome::gitExample</a>),
<a name="l00117"></a>00117 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"git"</span>));
<a name="l00118"></a>00118 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#17880b6f1a2c40774cb730e68d4d3089">WtHome::chatExample</a>),
<a name="l00119"></a>00119 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"chat"</span>));
<a name="l00120"></a>00120 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#f3a430044572741e18801a2e3a4ace27">WtHome::composerExample</a>),
<a name="l00121"></a>00121 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"mail-composer"</span>));
<a name="l00122"></a>00122 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#8f5bea792ccb3487fb2f3a9258463b3f">addTab</a>(<a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">wrapView</a>(&<a class="code" href="classWtHome.html#d7f6cf25a06b5d595f04074e348711d0">WtHome::widgetGalleryExample</a>),
<a name="l00123"></a>00123 <a class="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"widget-gallery"</span>));
<a name="l00124"></a>00124
<a name="l00125"></a>00125 <span class="comment">// Enable internal paths for the example menu</span>
<a name="l00126"></a>00126 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#855b45897b00f82137cd0eb9e0d40dfd">setInternalPathEnabled</a>(<span class="stringliteral">"/examples"</span>);
<a name="l00127"></a>00127 <a class="code" href="classHome.html#3abd28c83870cb52131d423ec9e73b6b">examplesMenu_</a>-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTabWidget.html#5447e1149d6c854f25d6fb6792eef513">currentChanged</a>().connect(SLOT(<span class="keyword">this</span>, <a class="code" href="classHome.html#3c26dd54dbc1a2020776f2d6cb2aa6bf">Home::googleAnalyticsLogger</a>));
<a name="l00128"></a>00128
<a name="l00129"></a>00129 <span class="keywordflow">return</span> result;
<a name="l00130"></a>00130 }
<a name="l00131"></a>00131
<a name="l00132"></a><a class="code" href="classWtHome.html#743dc5b1e0391c7a45012c697254095e">00132</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#743dc5b1e0391c7a45012c697254095e">WtHome::download</a>()
<a name="l00133"></a>00133 {
<a name="l00134"></a>00134 <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="l00135"></a>00135 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</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="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"home.download"</span>)));
<a name="l00136"></a>00136 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</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="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"home.download.license"</span>)));
<a name="l00137"></a>00137 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</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="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"home.download.requirements"</span>)));
<a name="l00138"></a>00138 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</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="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"home.download.cvs"</span>)));
<a name="l00139"></a>00139 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</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="code" href="classHome.html#7c8a4abe8f7ade4407333aaaee98c57e">tr</a>(<span class="stringliteral">"home.download.packages"</span>)));
<a name="l00140"></a>00140
<a name="l00141"></a>00141 <a class="code" href="classHome.html#31eeca8eae96be5b0b1d53ef96a3b4b7">releases_</a> = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WTable.html">WTable</a>();
<a name="l00142"></a>00142 <a class="code" href="classHome.html#afa9b1d1821f2501c80eb6666b54e90e">readReleases</a>(<a class="code" href="classHome.html#31eeca8eae96be5b0b1d53ef96a3b4b7">releases_</a>);
<a name="l00143"></a>00143 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(<a class="code" href="classHome.html#31eeca8eae96be5b0b1d53ef96a3b4b7">releases_</a>);
<a name="l00144"></a>00144
<a name="l00145"></a>00145 result-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#2cfe66d9b62940f889e99538a9f478d2">addWidget</a>
<a name="l00146"></a>00146 (<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">"<p>Older releases are still available at "</span>
<a name="l00147"></a>00147 + <a class="code" href="classHome.html#4c6b5887e984c16b88385e83805c28a2">href</a>(<span class="stringliteral">"http://sourceforge.net/project/showfiles.php?"</span>
<a name="l00148"></a>00148 <span class="stringliteral">"group_id=153710#files"</span>,
<a name="l00149"></a>00149 <span class="stringliteral">"sourceforge.net"</span>)
<a name="l00150"></a>00150 + <span class="stringliteral">"</p>"</span>));
<a name="l00151"></a>00151
<a name="l00152"></a>00152 <span class="keywordflow">return</span> result;
<a name="l00153"></a>00153 }
<a name="l00154"></a>00154
<a name="l00155"></a><a class="code" href="classWtHome.html#81bfb1f1a961403d2e578de60571693a">00155</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html">WWidget</a> *<a class="code" href="classWtHome.html#81bfb1f1a961403d2e578de60571693a">WtHome::sourceViewer</a>(<span class="keyword">const</span> std::string& deployPath)
<a name="l00156"></a>00156 {
<a name="l00157"></a>00157 <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#b6c76e3ef4c4b568f6111dae7a28619c">wtExamplePath_</a> + <span class="stringliteral">"/"</span>, <span class="stringliteral">"CPP"</span>);
<a name="l00158"></a>00158 }
<a name="l00159"></a>00159
<a name="l00160"></a><a class="code" href="classWtHome.html#52135719f856d544fad387c76af06182">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#52135719f856d544fad387c76af06182">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>::*createWidget)())
<a name="l00161"></a>00161 {
<a name="l00162"></a>00162 <span class="keywordflow">return</span> makeStaticModel(boost::bind(createWidget, <span class="keyword">this</span>));
<a name="l00163"></a>00163 }
<a name="l00164"></a>00164
<a name="l00165"></a><a class="code" href="WtHome_8h.html#dd0ef25910d91a7bd79ffb3c07a9af32">00165</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#dd0ef25910d91a7bd79ffb3c07a9af32">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="l00166"></a>00166 {
<a name="l00167"></a>00167 <span class="comment">// support for old (< Wt-2.2) homepage URLS: redirect from "states"</span>
<a name="l00168"></a>00168 <span class="comment">// to "internal paths"</span>
<a name="l00169"></a>00169 <span class="comment">// this contains the initial "history state" in old Wt versions</span>
<a name="l00170"></a>00170 <span class="keyword">const</span> std::string *historyKey = env.<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WEnvironment.html#3f87915f10f39b18eac28bac65c0cd46">getParameter</a>(<span class="stringliteral">"historyKey"</span>);
<a name="l00171"></a>00171
<a name="l00172"></a>00172 <span class="keywordflow">if</span> (historyKey) {
<a name="l00173"></a>00173 <span class="keyword">const</span> <span class="keywordtype">char</span> *mainStr[]
<a name="l00174"></a>00174 = { <span class="stringliteral">"main:0"</span>, <span class="stringliteral">"/"</span>,
<a name="l00175"></a>00175 <span class="stringliteral">"main:1"</span>, <span class="stringliteral">"/news"</span>,
<a name="l00176"></a>00176 <span class="stringliteral">"main:2"</span>, <span class="stringliteral">"/features"</span>,
<a name="l00177"></a>00177 <span class="stringliteral">"main:4"</span>, <span class="stringliteral">"/examples"</span>,
<a name="l00178"></a>00178 <span class="stringliteral">"main:3"</span>, <span class="stringliteral">"/documentation"</span>,
<a name="l00179"></a>00179 <span class="stringliteral">"main:5"</span>, <span class="stringliteral">"/download"</span>,
<a name="l00180"></a>00180 <span class="stringliteral">"main:6"</span>, <span class="stringliteral">"/community"</span> };
<a name="l00181"></a>00181
<a name="l00182"></a>00182 <span class="keyword">const</span> <span class="keywordtype">char</span> *exampleStr[]
<a name="l00183"></a>00183 = { <span class="stringliteral">"example:0"</span>, <span class="stringliteral">"/examples"</span>,
<a name="l00184"></a>00184 <span class="stringliteral">"example:1"</span>, <span class="stringliteral">"/examples/charts"</span>,
<a name="l00185"></a>00185 <span class="stringliteral">"example:2"</span>, <span class="stringliteral">"/examples/wt-homepage"</span>,
<a name="l00186"></a>00186 <span class="stringliteral">"example:3"</span>, <span class="stringliteral">"/examples/treelist"</span>,
<a name="l00187"></a>00187 <span class="stringliteral">"example:4"</span>, <span class="stringliteral">"/examples/hangman"</span>,
<a name="l00188"></a>00188 <span class="stringliteral">"example:5"</span>, <span class="stringliteral">"/examples/chat"</span>,
<a name="l00189"></a>00189 <span class="stringliteral">"example:6"</span>, <span class="stringliteral">"/examples/mail-composer"</span>,
<a name="l00190"></a>00190 <span class="stringliteral">"example:7"</span>, <span class="stringliteral">"/examples/drag-and-drop"</span>,
<a name="l00191"></a>00191 <span class="stringliteral">"example:8"</span>, <span class="stringliteral">"/examples/file-explorer"</span>,
<a name="l00192"></a>00192 <span class="stringliteral">"example:9"</span>, <span class="stringliteral">"/examples/calendar"</span> };
<a name="l00193"></a>00193
<a name="l00194"></a>00194 <span class="keywordflow">if</span> (historyKey->find(<span class="stringliteral">"main:4"</span>) != std::string::npos) {
<a name="l00195"></a>00195 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < 10; ++i)
<a name="l00196"></a>00196 <span class="keywordflow">if</span> (historyKey->find(exampleStr[i*2]) != std::string::npos) {
<a name="l00197"></a>00197 <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#e29a843f4d50159b17abfa9503c389db">WApplication</a>(env);
<a name="l00198"></a>00198 app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">"notice"</span>) << <span class="stringliteral">"redirecting old style URL '"</span>
<a name="l00199"></a>00199 << *historyKey << <span class="stringliteral">"' to internal path: '"</span>
<a name="l00200"></a>00200 << exampleStr[i*2+1] << <span class="stringliteral">"'"</span>;
<a name="l00201"></a>00201 app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(exampleStr[i*2+1]));
<a name="l00202"></a>00202 app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#5231d54ed34982f4366058eb6440c8f7">quit</a>();
<a name="l00203"></a>00203 <span class="keywordflow">return</span> app;
<a name="l00204"></a>00204 }
<a name="l00205"></a>00205 } <span class="keywordflow">else</span>
<a name="l00206"></a>00206 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < 6; ++i)
<a name="l00207"></a>00207 <span class="keywordflow">if</span> (historyKey->find(mainStr[i*2]) != std::string::npos) {
<a name="l00208"></a>00208 <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#e29a843f4d50159b17abfa9503c389db">WApplication</a>(env);
<a name="l00209"></a>00209
<a name="l00210"></a>00210 app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#75067771ba8fcc56e174f2e741ce278f">log</a>(<span class="stringliteral">"notice"</span>) << <span class="stringliteral">"redirecting old style URL '"</span>
<a name="l00211"></a>00211 << *historyKey << <span class="stringliteral">"' to internal path: '"</span>
<a name="l00212"></a>00212 << mainStr[i*2+1] << <span class="stringliteral">"'"</span>;
<a name="l00213"></a>00213 app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#4dcbf69c8b09c301577b5b6aa8a4da18">redirect</a>(app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#37b4cf44f393688785ed3b34f53fead1">bookmarkUrl</a>(mainStr[i*2+1]));
<a name="l00214"></a>00214 app-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WApplication.html#5231d54ed34982f4366058eb6440c8f7">quit</a>();
<a name="l00215"></a>00215 <span class="keywordflow">return</span> app;
<a name="l00216"></a>00216 }
<a name="l00217"></a>00217
<a name="l00218"></a>00218 <span class="comment">// unknown history key, just continue</span>
<a name="l00219"></a>00219 }
<a name="l00220"></a>00220
<a name="l00221"></a>00221 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="classWtHome.html#916f894b0b3ff5a08ebe77caad74be3e">WtHome</a>(env);
<a name="l00222"></a>00222 }
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:12 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>
|