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
|
<!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: FormExample 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="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 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>
<div class="contents">
<h1>FormExample Class Reference<br>
<small>
[<a class="el" href="group__formexample.html">Form example</a>]</small>
</h1><!-- doxytag: class="FormExample" --><!-- doxytag: inherits="Wt::WContainerWidget" -->Main widget for the Form example.
<a href="#_details">More...</a>
<p>
<code>#include <<a class="el" href="FormExample_8h-source.html">FormExample.h</a>></code>
<p>
<div class="dynheader">
Inheritance diagram for FormExample:</div>
<div class="dynsection">
<p><center><img src="classFormExample__inherit__graph.png" border="0" usemap="#FormExample__inherit__map" alt="Inheritance graph"></center>
<map name="FormExample__inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html" title="Wt::WContainerWidget" alt="" coords="5,304,157,331"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html" title="Wt::WInteractWidget" alt="" coords="11,229,152,256"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html" title="Wt::WWebWidget" alt="" coords="20,155,143,181"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html" title="Wt::WWidget" alt="" coords="33,80,129,107"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="33,5,129,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>
<p>
<a href="classFormExample-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classFormExample.html#06229101d94ff644080db3bdea52bfd3">FormExample</a> (<a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *<a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#3461e31818c4d2f516641bdaf508312a">parent</a>=0)</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Instantiate a new form example. <a href="#06229101d94ff644080db3bdea52bfd3"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Slots</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classFormExample.html#047867b2f3c5a749792469576773be65">changeLanguage</a> ()</td></tr>
<tr><td class="mdescLeft"> </td><td class="mdescRight">Change the language. <a href="#047867b2f3c5a749792469576773be65"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classFormExample.html#6958d8310fa5d3c1fa2172ca867e1e50">setLanguage</a> (const std::string lang)</td></tr>
<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::vector< <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="classFormExample.html#d2cb9b1cfa26199a58f5635671fbb018">languageSelects_</a></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
Main widget for the Form example.
<p>
This class demonstrates, next instantiating the form itself, handling of different languages.
<p>Definition at line <a class="el" href="FormExample_8h-source.html#l00029">29</a> of file <a class="el" href="FormExample_8h-source.html">FormExample.h</a>.</p>
<hr><h2>Constructor & Destructor Documentation</h2>
<a class="anchor" name="06229101d94ff644080db3bdea52bfd3"></a><!-- doxytag: member="FormExample::FormExample" ref="06229101d94ff644080db3bdea52bfd3" args="(WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">FormExample::FormExample </td>
<td>(</td>
<td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> * </td>
<td class="paramname"> <em>parent</em> = <code>0</code> </td>
<td> ) </td>
<td></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Instantiate a new form example.
<p>
<p>Definition at line <a class="el" href="FormExample_8C-source.html#l00014">14</a> of file <a class="el" href="FormExample_8C-source.html">FormExample.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00015"></a>00015 : <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(parent)
<a name="l00016"></a>00016 {
<a name="l00017"></a>00017 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *langLayout = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(<span class="keyword">this</span>);
<a name="l00018"></a>00018 langLayout-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#ba13c9e62c74bcba53519ee9cf41f40a">setContentAlignment</a>(AlignRight);
<a name="l00019"></a>00019 <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_1WWidget.html#a651f107ec7cf080faef6c435705fc44">tr</a>(<span class="stringliteral">"language"</span>), langLayout);
<a name="l00020"></a>00020
<a name="l00021"></a>00021 <span class="keyword">const</span> <span class="keywordtype">char</span> *lang[] = { <span class="stringliteral">"en"</span>, <span class="stringliteral">"nl"</span> };
<a name="l00022"></a>00022
<a name="l00023"></a>00023 <span class="keywordflow">for</span> (<span class="keywordtype">int</span> i = 0; i < 2; ++i) {
<a name="l00024"></a>00024 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a> *t = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a>(widen(lang[i]), langLayout);
<a name="l00025"></a>00025 t-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#07719d06da0dd17af2381c663e8fb0b7">setMargin</a>(5);
<a name="l00026"></a>00026 t-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(SLOT(<span class="keyword">this</span>, <a class="code" href="classFormExample.html#047867b2f3c5a749792469576773be65" title="Change the language.">FormExample::changeLanguage</a>));
<a name="l00027"></a>00027
<a name="l00028"></a>00028 <a class="code" href="classFormExample.html#d2cb9b1cfa26199a58f5635671fbb018">languageSelects_</a>.push_back(t);
<a name="l00029"></a>00029 }
<a name="l00030"></a>00030
<a name="l00031"></a>00031 <span class="comment">/*</span>
<a name="l00032"></a>00032 <span class="comment"> * Start with the reported locale, if available</span>
<a name="l00033"></a>00033 <span class="comment"> */</span>
<a name="l00034"></a>00034 <a class="code" href="classFormExample.html#6958d8310fa5d3c1fa2172ca867e1e50">setLanguage</a>(wApp->locale());
<a name="l00035"></a>00035
<a name="l00036"></a>00036 <a class="code" href="classForm.html" title="A simple Form.">Form</a> *form = <span class="keyword">new</span> <a class="code" href="classForm.html" title="A simple Form.">Form</a>(<span class="keyword">this</span>);
<a name="l00037"></a>00037 form->setMargin(20);
<a name="l00038"></a>00038 }
</pre></div>
<p>
</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="047867b2f3c5a749792469576773be65"></a><!-- doxytag: member="FormExample::changeLanguage" ref="047867b2f3c5a749792469576773be65" args="()" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void FormExample::changeLanguage </td>
<td>(</td>
<td class="paramname"> </td>
<td> ) </td>
<td><code> [private, slot]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
Change the language.
<p>
<p>Definition at line <a class="el" href="FormExample_8C-source.html#l00062">62</a> of file <a class="el" href="FormExample_8C-source.html">FormExample.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00063"></a>00063 {
<a name="l00064"></a>00064 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a> *t = (<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_1WObject.html#413deb54de40ee278dd554e4960d58ca">sender</a>();
<a name="l00065"></a>00065 <a class="code" href="classFormExample.html#6958d8310fa5d3c1fa2172ca867e1e50">setLanguage</a>(narrow(t-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html#1081f42ae498fa8d23656cec207a4a76">text</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WString.html#b76d45947986f8aa20763cf99267ec23">value</a>()));
<a name="l00066"></a>00066 }
</pre></div>
<p>
</div>
</div><p>
<a class="anchor" name="6958d8310fa5d3c1fa2172ca867e1e50"></a><!-- doxytag: member="FormExample::setLanguage" ref="6958d8310fa5d3c1fa2172ca867e1e50" args="(const std::string lang)" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void FormExample::setLanguage </td>
<td>(</td>
<td class="paramtype">const std::string </td>
<td class="paramname"> <em>lang</em> </td>
<td> ) </td>
<td><code> [private]</code></td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<p>Definition at line <a class="el" href="FormExample_8C-source.html#l00040">40</a> of file <a class="el" href="FormExample_8C-source.html">FormExample.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00041"></a>00041 {
<a name="l00042"></a>00042 <span class="keywordtype">bool</span> haveLang = <span class="keyword">false</span>;
<a name="l00043"></a>00043
<a name="l00044"></a>00044 <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i < <a class="code" href="classFormExample.html#d2cb9b1cfa26199a58f5635671fbb018">languageSelects_</a>.size(); ++i) {
<a name="l00045"></a>00045 <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a> *t = <a class="code" href="classFormExample.html#d2cb9b1cfa26199a58f5635671fbb018">languageSelects_</a>[i];
<a name="l00046"></a>00046
<a name="l00047"></a>00047 <span class="comment">// prefix match, e.g. en matches en-us.</span>
<a name="l00048"></a>00048 <span class="keywordtype">bool</span> isLang = lang.find(narrow(t-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html#1081f42ae498fa8d23656cec207a4a76">text</a>().<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WString.html#b76d45947986f8aa20763cf99267ec23">value</a>())) == 0;
<a name="l00049"></a>00049 t-><a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#6fd43dced1a62f7e79bc3522eeb16216">setStyleClass</a>(isLang ? L<span class="stringliteral">"langcurrent"</span> : L<span class="stringliteral">"lang"</span>);
<a name="l00050"></a>00050
<a name="l00051"></a>00051 haveLang = haveLang || isLang;
<a name="l00052"></a>00052 }
<a name="l00053"></a>00053
<a name="l00054"></a>00054 <span class="keywordflow">if</span> (!haveLang) {
<a name="l00055"></a>00055 <a class="code" href="classFormExample.html#d2cb9b1cfa26199a58f5635671fbb018">languageSelects_</a>[0]->setStyleClass(L<span class="stringliteral">"langcurrent"</span>);
<a name="l00056"></a>00056 WApplication::instance()
<a name="l00057"></a>00057 ->setLocale(narrow(<a class="code" href="classFormExample.html#d2cb9b1cfa26199a58f5635671fbb018">languageSelects_</a>[0]->text().value()));
<a name="l00058"></a>00058 } <span class="keywordflow">else</span>
<a name="l00059"></a>00059 WApplication::instance()->setLocale(lang);
<a name="l00060"></a>00060 }
</pre></div>
<p>
</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="d2cb9b1cfa26199a58f5635671fbb018"></a><!-- doxytag: member="FormExample::languageSelects_" ref="d2cb9b1cfa26199a58f5635671fbb018" args="" -->
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">std::vector<<a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a> *> <a class="el" href="classFormExample.html#d2cb9b1cfa26199a58f5635671fbb018">FormExample::languageSelects_</a><code> [private]</code> </td>
</tr>
</table>
</div>
<div class="memdoc">
<p>
<p>Definition at line <a class="el" href="FormExample_8h-source.html#l00042">42</a> of file <a class="el" href="FormExample_8h-source.html">FormExample.h</a>.</p>
</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>/home/koen/project/wt/public-git/wt/examples/form/<a class="el" href="FormExample_8h-source.html">FormExample.h</a><li>/home/koen/project/wt/public-git/wt/examples/form/<a class="el" href="FormExample_8C-source.html">FormExample.C</a></ul>
</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>
|