<?xml version="1.0" encoding="UTF-8" ?>
<messages>
  <message id="src-Anchor">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WAnchor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>

<span class="c1">// Create an anchor that links to a URL through clickable text.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span> <span class="o">*</span><span class="n">anchor</span> <span class="o">=</span>
        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;http://www.webtoolkit.eu/&quot;</span><span class="p">),</span>
                        <span class="s">&quot;Wt homepage (in a new window)&quot;</span><span class="p">);</span>
<span class="n">anchor</span><span class="o">-&gt;</span><span class="n">setTarget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">TargetNewWindow</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-AnchorImage">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WAnchor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>

<span class="c1">// Create an anchor that links to a URL through an image.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span> <span class="o">*</span><span class="n">anchor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;http://www.emweb.be/&quot;</span><span class="p">));</span>
<span class="n">anchor</span><span class="o">-&gt;</span><span class="n">setTarget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">TargetNewWindow</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;pics/emweb_small.jpg&quot;</span><span class="p">),</span> <span class="n">anchor</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Audio">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WAudio&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="c1">// Define media source locations.</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">mp3Audio</span> <span class="o">=</span>
            <span class="s">&quot;http://www.webtoolkit.eu/audio/LaSera-NeverComeAround.mp3&quot;</span><span class="p">;</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">oggAudio</span> <span class="o">=</span>
            <span class="s">&quot;http://www.webtoolkit.eu/audio/LaSera-NeverComeAround.ogg&quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WAudio</span> <span class="o">*</span><span class="n">audio</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAudio</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">audio</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">mp3Audio</span><span class="p">));</span>
<span class="n">audio</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">oggAudio</span><span class="p">));</span>
<span class="n">audio</span><span class="o">-&gt;</span><span class="n">setOptions</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAudio</span><span class="o">::</span><span class="n">Controls</span><span class="p">);</span>
<span class="n">audio</span><span class="o">-&gt;</span><span class="n">setAlternativeContent</span>
  <span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;You don&#39;t have HTML5 audio support!&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">audio</span><span class="o">-&gt;</span><span class="n">playbackStarted</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Audio playing&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">audio</span><span class="o">-&gt;</span><span class="n">playbackPaused</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Audio paused&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">audio</span><span class="o">-&gt;</span><span class="n">ended</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Audio ended&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">audio</span><span class="o">-&gt;</span><span class="n">volumeChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Volume changed&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-AutoComplete">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WSuggestionPopup&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="c1">// Set options for email address suggestions:</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WSuggestionPopup</span><span class="o">::</span><span class="n">Options</span> <span class="n">contactOptions</span><span class="p">;</span>
<span class="n">contactOptions</span><span class="p">.</span><span class="n">highlightBeginTag</span> <span class="o">=</span> <span class="s">&quot;&lt;span class=</span><span class="se">\&quot;</span><span class="s">highlight</span><span class="se">\&quot;</span><span class="s">&gt;&quot;</span><span class="p">;</span>
<span class="n">contactOptions</span><span class="p">.</span><span class="n">highlightEndTag</span> <span class="o">=</span> <span class="s">&quot;&lt;/span&gt;&quot;</span><span class="p">;</span>
<span class="n">contactOptions</span><span class="p">.</span><span class="n">listSeparator</span> <span class="o">=</span> <span class="sc">&#39;,&#39;</span><span class="p">;</span>
<span class="n">contactOptions</span><span class="p">.</span><span class="n">whitespace</span> <span class="o">=</span> <span class="s">&quot; </span><span class="se">\\</span><span class="s">n&quot;</span><span class="p">;</span>
<span class="n">contactOptions</span><span class="p">.</span><span class="n">wordSeparators</span> <span class="o">=</span> <span class="s">&quot;-., </span><span class="se">\&quot;</span><span class="s">@</span><span class="se">\\</span><span class="s">n;&quot;</span><span class="p">;</span>
<span class="n">contactOptions</span><span class="p">.</span><span class="n">appendReplacedText</span> <span class="o">=</span> <span class="s">&quot;, &quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSuggestionPopup</span> <span class="o">*</span><span class="n">sp</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSuggestionPopup</span><span class="p">(</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WSuggestionPopup</span><span class="o">::</span><span class="n">generateMatcherJS</span><span class="p">(</span><span class="n">contactOptions</span><span class="p">),</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WSuggestionPopup</span><span class="o">::</span><span class="n">generateReplacerJS</span><span class="p">(</span><span class="n">contactOptions</span><span class="p">),</span>
	    <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">le</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">le</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;Enter a name starting with &#39;J&#39;&quot;</span><span class="p">);</span>
<span class="n">sp</span><span class="o">-&gt;</span><span class="n">forEdit</span><span class="p">(</span><span class="n">le</span><span class="p">);</span>

<span class="c1">// Populate the underlying model with suggestions:</span>
<span class="n">sp</span><span class="o">-&gt;</span><span class="n">addSuggestion</span><span class="p">(</span><span class="s">&quot;John Tech &lt;techie@mycompany.com&gt;&quot;</span><span class="p">);</span>
<span class="n">sp</span><span class="o">-&gt;</span><span class="n">addSuggestion</span><span class="p">(</span><span class="s">&quot;Johnny Cash &lt;cash@mycompany.com&gt;&quot;</span><span class="p">);</span>
<span class="n">sp</span><span class="o">-&gt;</span><span class="n">addSuggestion</span><span class="p">(</span><span class="s">&quot;John Rambo &lt;rambo@mycompany.com&gt;&quot;</span><span class="p">);</span>
<span class="n">sp</span><span class="o">-&gt;</span><span class="n">addSuggestion</span><span class="p">(</span><span class="s">&quot;Johanna Tree &lt;johanna@mycompany.com&gt;&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-BorderLayout">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WBorderLayout&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setHeight</span><span class="p">(</span><span class="mi">400</span><span class="p">);</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WBorderLayout</span> <span class="o">*</span><span class="n">layout</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorderLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">layout</span><span class="p">);</span>

<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">cell</span> <span class="o">=</span> <span class="s">&quot;{1} item&quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="n">cell</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="s">&quot;North&quot;</span><span class="p">));</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">layout</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorderLayout</span><span class="o">::</span><span class="n">North</span><span class="p">);</span>

<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="n">cell</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="s">&quot;West&quot;</span><span class="p">));</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">layout</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorderLayout</span><span class="o">::</span><span class="n">West</span><span class="p">);</span>

<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="n">cell</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="s">&quot;East&quot;</span><span class="p">));</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">layout</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorderLayout</span><span class="o">::</span><span class="n">East</span><span class="p">);</span>

<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="n">cell</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="s">&quot;South&quot;</span><span class="p">));</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">layout</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorderLayout</span><span class="o">::</span><span class="n">South</span><span class="p">);</span>

<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="n">cell</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="s">&quot;Center&quot;</span><span class="p">));</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">layout</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorderLayout</span><span class="o">::</span><span class="n">Center</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-CSS">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTable&gt;</span>

<span class="c1">// Add an external style sheet to the application.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">useStyleSheet</span><span class="p">(</span><span class="s">&quot;style/CSSexample.css&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="c1">// The style sheet should be applied to this container only.</span>
<span class="c1">// The class .CSS-example is used as selector.</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;CSS-example&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">allB</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Set all classes&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">removeB</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Remove info class&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">removeB</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>
<span class="n">removeB</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">toggleB</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Toggle condensed&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">toggleB</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">text</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;These are the most import API classes and methods for&quot;</span>
              <span class="s">&quot; working with CSS:&lt;/p&gt;&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTable</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTable</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderCount</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Method&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Description&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;WApplication::useStyleSheet()&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Adds an external style sheet&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;WWidget::setStyleClass()&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Sets (one or more) CSS style classes&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;WWidget::removeStyleClass()&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Removes a CSS style class&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;WWidget::toggleStyleClass()&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">4</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Toggles a CSS style class&quot;</span><span class="p">));</span>

<span class="n">allB</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="c1">// Set style classes for the complete table.</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;table table-bordered&quot;</span><span class="p">);</span>
    <span class="c1">// Set the info style class for the first row after the header.</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">rowAt</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;info&quot;</span><span class="p">);</span>
    <span class="c1">// Set a style class for the methods (first column, the header excluded).</span>
    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">1</span><span class="p">;</span> <span class="n">i</span><span class="o">&lt;</span><span class="n">table</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span>
        <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">i</span><span class="p">,</span><span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;code&quot;</span><span class="p">);</span>
    <span class="n">removeB</span><span class="o">-&gt;</span><span class="n">enable</span><span class="p">();</span>
    <span class="n">toggleB</span><span class="o">-&gt;</span><span class="n">enable</span><span class="p">();</span>
<span class="p">}));</span>

<span class="n">removeB</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">rowAt</span><span class="p">(</span><span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">removeStyleClass</span><span class="p">(</span><span class="s">&quot;info&quot;</span><span class="p">);</span>
    <span class="n">removeB</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
<span class="p">}));</span>

<span class="n">toggleB</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">toggleB</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;Toggle condensed&quot;</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">table</span><span class="o">-&gt;</span><span class="n">toggleStyleClass</span><span class="p">(</span><span class="s">&quot;table-condensed&quot;</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
        <span class="n">toggleB</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Toggle expanded&quot;</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
        <span class="n">table</span><span class="o">-&gt;</span><span class="n">toggleStyleClass</span><span class="p">(</span><span class="s">&quot;table-condensed&quot;</span><span class="p">,</span> <span class="nb">false</span><span class="p">);</span>
        <span class="n">toggleB</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Toggle condensed&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-CalendarExtended">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCalendar&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WDate&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WCalendar</span> <span class="o">*</span><span class="n">c2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCalendar</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">c2</span><span class="o">-&gt;</span><span class="n">setSelectionMode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ExtendedSelection</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="o">*</span> <span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">c2</span><span class="o">-&gt;</span><span class="n">selectionChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">selected</span><span class="p">;</span>
    <span class="n">std</span><span class="o">::</span><span class="n">set</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">&gt;</span> <span class="n">selection</span> <span class="o">=</span> <span class="n">c2</span><span class="o">-&gt;</span><span class="n">selection</span><span class="p">();</span>

    <span class="k">for</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">set</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">&gt;::</span><span class="n">const_iterator</span> <span class="n">it</span> <span class="o">=</span> <span class="n">selection</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span>
	 <span class="n">it</span> <span class="o">!=</span> <span class="n">selection</span><span class="p">.</span><span class="n">end</span><span class="p">();</span> <span class="o">++</span><span class="n">it</span><span class="p">)</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">selected</span><span class="p">.</span><span class="n">empty</span><span class="p">())</span>
	    <span class="n">selected</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span><span class="p">;</span>

	<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">&amp;</span> <span class="n">d</span> <span class="o">=</span> <span class="o">*</span><span class="n">it</span><span class="p">;</span>
	<span class="n">selected</span> <span class="o">+=</span> <span class="n">d</span><span class="p">.</span><span class="n">toString</span><span class="p">(</span><span class="s">&quot;dd/MM/yyyy&quot;</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span>
		 <span class="p">(</span><span class="s">&quot;&lt;p&gt;You selected the following dates: {1}&lt;/p&gt;&quot;</span><span class="p">)</span>
		 <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">selected</span><span class="p">));</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-CalendarSimple">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCalendar&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WCalendar</span> <span class="o">*</span><span class="n">c1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCalendar</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">c1</span><span class="o">-&gt;</span><span class="n">selectionChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">std</span><span class="o">::</span><span class="n">set</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">&gt;</span> <span class="n">selection</span> <span class="o">=</span> <span class="n">c1</span><span class="o">-&gt;</span><span class="n">selection</span><span class="p">();</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">selection</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span> <span class="n">d</span><span class="p">;</span>
	<span class="n">d</span> <span class="o">=</span> <span class="p">(</span><span class="o">*</span><span class="n">selection</span><span class="p">.</span><span class="n">begin</span><span class="p">());</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span> <span class="n">toDate</span><span class="p">(</span><span class="n">d</span><span class="p">.</span><span class="n">year</span><span class="p">()</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
	<span class="kt">int</span> <span class="n">days</span> <span class="o">=</span> <span class="n">d</span><span class="p">.</span><span class="n">daysTo</span><span class="p">(</span><span class="n">toDate</span><span class="p">);</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;That&#39;s {1} days until New Year&#39;s Day!&lt;/p&gt;&quot;</span><span class="p">)</span>
		     <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">days</span><span class="p">));</span>
    <span class="p">}</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-CategoryChart">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/Chart/WCartesianChart&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WDataSeries&gt;</span>
<span class="cp">#include &lt;Wt/WAbstractItemView&gt;</span>
<span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WEnvironment&gt;</span>
<span class="cp">#include &lt;Wt/WItemDelegate&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItem&gt;</span>
<span class="cp">#include &lt;Wt/WTableView&gt;</span>

<span class="cp">#include &quot;../treeview-dragdrop/CsvUtil.h&quot;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model</span>
    <span class="o">=</span> <span class="n">csvToModel</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">appRoot</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;category.csv&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">model</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">container</span><span class="p">;</span>

<span class="cm">/*</span>
<span class="cm"> * Configure all model items as selectable and editable.</span>
<span class="cm"> */</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">row</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="o">++</span><span class="n">row</span><span class="p">)</span>
    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">col</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">col</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="o">++</span><span class="n">col</span><span class="p">)</span>
        <span class="n">model</span><span class="o">-&gt;</span><span class="n">item</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">col</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setFlags</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ItemIsEditable</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Shows a table, allowing editing of the model</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setSortingEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnResizeEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setAlternatingRowColors</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderAlignment</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignCenter</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnAlignment</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignCenter</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setRowHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLength</span><span class="o">::</span><span class="n">Auto</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">4</span><span class="o">*</span><span class="mi">120</span> <span class="o">+</span> <span class="mi">80</span> <span class="o">+</span> <span class="mi">5</span><span class="o">*</span><span class="mi">7</span> <span class="o">+</span> <span class="mi">2</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Editing does not really work without Ajax, it would require an</span>
<span class="cm"> * additional button somewhere to confirm the edited value.</span>
<span class="cm"> */</span>

<span class="k">if</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">environment</span><span class="p">().</span><span class="n">ajax</span><span class="p">())</span> <span class="p">{</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">SingleClicked</span><span class="p">);</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setEditOptions</span><span class="p">(</span><span class="n">table</span><span class="o">-&gt;</span><span class="n">editOptions</span><span class="p">()</span> <span class="o">|</span> 
			  <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">SaveWhenClosed</span><span class="p">);</span>
<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">NoEditTrigger</span><span class="p">);</span>
<span class="p">}</span>

<span class="cm">/*</span>
<span class="cm"> * Use a delegate for the numeric data which rounds values sensibly.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WItemDelegate</span> <span class="o">*</span><span class="n">delegate</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WItemDelegate</span><span class="p">(</span><span class="n">table</span><span class="p">);</span>
<span class="n">delegate</span><span class="o">-&gt;</span><span class="n">setTextFormat</span><span class="p">(</span><span class="s">&quot;%.f&quot;</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setItemDelegate</span><span class="p">(</span><span class="n">delegate</span><span class="p">);</span>

<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnWidth</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">80</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnWidth</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">120</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Create the category chart.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span> <span class="o">*</span><span class="n">chart</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setXSeriesColumn</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setLegendEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Provide ample space for the title, the X and Y axis and the legend.</span>
<span class="cm"> */</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setPlotAreaPadding</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setPlotAreaPadding</span><span class="p">(</span><span class="mi">120</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Add all (but first) column as bar series.</span>
<span class="cm"> */</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">column</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">column</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="o">++</span><span class="n">column</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WDataSeries</span> <span class="n">series</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">BarSeries</span><span class="p">);</span>
    <span class="n">series</span><span class="p">.</span><span class="n">setShadow</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WShadow</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">127</span><span class="p">),</span> <span class="mi">3</span><span class="p">));</span>
    <span class="n">chart</span><span class="o">-&gt;</span><span class="n">addSeries</span><span class="p">(</span><span class="n">series</span><span class="p">);</span>
<span class="p">}</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">600</span><span class="p">,</span> <span class="mi">400</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLength</span><span class="o">::</span><span class="n">Auto</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-CategoryCharts3D">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WCssDecorationStyle&gt;</span>
<span class="cp">#include &lt;Wt/WBorder&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WCartesian3DChart&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WGridData&gt;</span>

<span class="cp">#include &quot;../treeview-dragdrop/CsvUtil.h&quot;</span>

<span class="cp">#include &quot;DataModels.h&quot;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="c1">// create the chart</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesian3DChart</span> <span class="o">*</span><span class="n">chart</span>
    <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesian3DChart</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setType</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">CategoryChart</span><span class="p">);</span>

<span class="c1">// disable server-side rendering fallback; our VPSes don&#39;t have that</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setRenderOptions</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGLWidget</span><span class="o">::</span><span class="n">ClientSideRendering</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGLWidget</span><span class="o">::</span><span class="n">AntiAliasing</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WCssDecorationStyle</span> <span class="n">style</span><span class="p">;</span>
<span class="n">style</span><span class="p">.</span><span class="n">setBorder</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="o">::</span><span class="n">Solid</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="o">::</span><span class="n">Medium</span><span class="p">,</span>
			    <span class="n">Wt</span><span class="o">::</span><span class="n">black</span><span class="p">));</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setDecorationStyle</span><span class="p">(</span><span class="n">style</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">600</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;Fish consumption in western Europe&quot;</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">axis</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">).</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;Consumption (pcs/year)&quot;</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setLegendStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WFont</span><span class="p">(),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">(),</span>
		      <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">lightGray</span><span class="p">)));</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setLegendEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XZ_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">YZ_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>

<span class="c1">// load data</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model</span> <span class="o">=</span> 
    <span class="n">csvToModel</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">appRoot</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;fish_consumption.csv&quot;</span><span class="p">,</span>
	       <span class="n">container</span><span class="p">,</span> <span class="nb">false</span><span class="p">);</span>

<span class="c1">// highlight Belgian codfish consumption</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">j</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="n">j</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">if</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">data</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">j</span><span class="p">))</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;codfish&quot;</span><span class="p">)</span> <span class="o">&amp;&amp;</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">data</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Belgium&quot;</span><span class="p">))</span>
	    <span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span>
			   <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">cyan</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerBrushColorRole</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WGridData</span> <span class="o">*</span><span class="n">isotopes</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WGridData</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
<span class="n">isotopes</span><span class="o">-&gt;</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;made-up data&quot;</span><span class="p">);</span>
<span class="n">isotopes</span><span class="o">-&gt;</span><span class="n">setType</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">BarSeries3D</span><span class="p">);</span>

<span class="c1">// add the dataseries to the chart</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">addDataSeries</span><span class="p">(</span><span class="n">isotopes</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setAlternativeContent</span>
    <span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;pics/categoricalChartScreenshot.png&quot;</span><span class="p">)));</span>
</pre></div>
  </message>
  <message id="src-CheckBoxInline">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCheckBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span> <span class="o">*</span><span class="n">cb</span><span class="p">;</span>

<span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Check me!&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setChecked</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Check me too!&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>

<span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Check me, I&#39;m tristate!&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setTristate</span><span class="p">();</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setCheckState</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">PartiallyChecked</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-CheckBoxStack">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCheckBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span> <span class="o">*</span><span class="n">cb</span><span class="p">;</span>

<span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Check me!&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setChecked</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Check me too!&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>

<span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Check me, I&#39;m tristate!&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setTristate</span><span class="p">();</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setCheckState</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">PartiallyChecked</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-ComboBox">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WComboBox&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span> <span class="o">*</span><span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">();</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Heavy&quot;</span><span class="p">);</span>   <span class="c1">// &#39;Heavy&#39; (index 0) is shown by default.</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Medium&quot;</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Light&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-ComboBoxActivated">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WComboBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span> <span class="o">*</span><span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Heavy&quot;</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Medium&quot;</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Light&quot;</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span> <span class="c1">// Show &#39;Medium&#39; initially.</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">cb</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;You selected {1}.&quot;</span><span class="p">)</span>
		 <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">cb</span><span class="o">-&gt;</span><span class="n">currentText</span><span class="p">()));</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-ComboBoxModel">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WComboBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WStringListModel&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span> <span class="o">*</span><span class="n">cb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStringListModel</span> <span class="o">*</span><span class="n">model</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStringListModel</span><span class="p">(</span><span class="n">cb</span><span class="p">);</span>

<span class="n">model</span><span class="o">-&gt;</span><span class="n">addString</span><span class="p">(</span><span class="s">&quot;Belgium&quot;</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;BE&quot;</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">addString</span><span class="p">(</span><span class="s">&quot;Netherlands&quot;</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;NL&quot;</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">addString</span><span class="p">(</span><span class="s">&quot;United Kingdom&quot;</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;UK&quot;</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">addString</span><span class="p">(</span><span class="s">&quot;United States&quot;</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;US&quot;</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setFlags</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>

<span class="n">cb</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">cb</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">countryName</span> <span class="o">=</span> <span class="n">cb</span><span class="o">-&gt;</span><span class="n">currentText</span><span class="p">();</span>
    <span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="n">cb</span><span class="o">-&gt;</span><span class="n">currentIndex</span><span class="p">();</span>
    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">countryCode</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">any_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span>
        <span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">data</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">index</span><span class="p">(</span><span class="n">row</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">));</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;You selected {1} with key {2}.&quot;</span><span class="p">).</span>
		 <span class="n">arg</span><span class="p">(</span><span class="n">countryName</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">countryCode</span><span class="p">));</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-ComboDelegateTable">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WStandardItem&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WStringListModel&gt;</span>
<span class="cp">#include &lt;Wt/WTableView&gt;</span>
<span class="cp">#include &lt;Wt/WItemDelegate&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WComboBox&gt;</span>

<span class="cm">/*</span>
<span class="cm"> * This delegate demonstrates how to override the editing behaviour of a</span>
<span class="cm"> * table cell.</span>
<span class="cm"> *</span>
<span class="cm"> * It takes a list of possible items on construction and, when edited, saves</span>
<span class="cm"> * the selected item from the list to the Wt::DisplayRole in the model for</span>
<span class="cm"> * Wt::WItemDelegate to render.</span>
<span class="cm"> * It also saves the items index for future editing (rather than each time</span>
<span class="cm"> * searching the item in the list). This is done using the general purpose</span>
<span class="cm"> * Wt::UserRole in the model.</span>
<span class="cm"> */</span>
<span class="k">class</span> <span class="nc">ComboDelegate</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WItemDelegate</span> <span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">ComboDelegate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span><span class="o">*</span> <span class="n">items</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">items_</span><span class="p">(</span><span class="n">items</span><span class="p">)</span>
    <span class="p">{</span> <span class="p">}</span>

    <span class="kt">void</span> <span class="n">setModelData</span><span class="p">(</span><span class="k">const</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="o">&amp;</span><span class="n">editState</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span><span class="o">*</span> <span class="n">model</span><span class="p">,</span>
		      <span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span> <span class="o">&amp;</span><span class="n">index</span><span class="p">)</span> <span class="k">const</span>
    <span class="p">{</span>
      <span class="kt">int</span> <span class="n">stringIdx</span> <span class="o">=</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span><span class="n">Wt</span><span class="o">::</span><span class="n">asNumber</span><span class="p">(</span><span class="n">editState</span><span class="p">);</span>
	<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">stringIdx</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
	<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">items_</span><span class="o">-&gt;</span><span class="n">data</span><span class="p">(</span><span class="n">stringIdx</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">editState</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WWidget</span><span class="o">*</span> <span class="n">editor</span><span class="p">)</span> <span class="k">const</span>
    <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="o">*</span> <span class="n">combo</span> <span class="o">=</span> <span class="k">dynamic_cast</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="o">*&gt;</span>
	    <span class="p">(</span><span class="k">dynamic_cast</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="o">*&gt;</span><span class="p">(</span><span class="n">editor</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">widget</span><span class="p">(</span><span class="mi">0</span><span class="p">));</span>
	<span class="k">return</span> <span class="n">combo</span><span class="o">-&gt;</span><span class="n">currentIndex</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">setEditState</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WWidget</span><span class="o">*</span> <span class="n">editor</span><span class="p">,</span> <span class="k">const</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="o">&amp;</span><span class="n">value</span><span class="p">)</span> <span class="k">const</span>
    <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="o">*</span> <span class="n">combo</span> <span class="o">=</span> <span class="k">dynamic_cast</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="o">*&gt;</span>
	    <span class="p">(</span><span class="k">dynamic_cast</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="o">*&gt;</span><span class="p">(</span><span class="n">editor</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">widget</span><span class="p">(</span><span class="mi">0</span><span class="p">));</span>
	<span class="n">combo</span><span class="o">-&gt;</span><span class="n">setCurrentIndex</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="n">Wt</span><span class="o">::</span><span class="n">asNumber</span><span class="p">(</span><span class="n">value</span><span class="p">));</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="k">virtual</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WWidget</span><span class="o">*</span> <span class="n">createEditor</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span> <span class="o">&amp;</span><span class="n">index</span><span class="p">,</span>
				      <span class="n">Wt</span><span class="o">::</span><span class="n">WFlags</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">ViewItemRenderFlag</span><span class="o">&gt;</span> <span class="n">flags</span><span class="p">)</span> <span class="k">const</span>
    <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="k">const</span> <span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="o">*</span> <span class="n">combo</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
	<span class="n">combo</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">items_</span><span class="p">);</span>
	<span class="n">combo</span><span class="o">-&gt;</span><span class="n">setCurrentIndex</span><span class="p">((</span><span class="kt">int</span><span class="p">)</span><span class="n">Wt</span><span class="o">::</span><span class="n">asNumber</span><span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">data</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">)));</span>

	<span class="n">combo</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">boost</span><span class="o">::</span><span class="n">bind</span><span class="p">(</span><span class="o">&amp;</span><span class="n">ComboDelegate</span><span class="o">::</span><span class="n">doCloseEditor</span><span class="p">,</span> <span class="k">this</span><span class="p">,</span>
					     <span class="n">container</span><span class="p">,</span> <span class="nb">true</span><span class="p">));</span>
	<span class="n">combo</span><span class="o">-&gt;</span><span class="n">enterPressed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">boost</span><span class="o">::</span><span class="n">bind</span><span class="p">(</span><span class="o">&amp;</span><span class="n">ComboDelegate</span><span class="o">::</span><span class="n">doCloseEditor</span><span class="p">,</span>
    					      <span class="k">this</span><span class="p">,</span> <span class="n">container</span><span class="p">,</span> <span class="nb">true</span><span class="p">));</span>
	<span class="n">combo</span><span class="o">-&gt;</span><span class="n">escapePressed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">boost</span><span class="o">::</span><span class="n">bind</span><span class="p">(</span><span class="o">&amp;</span><span class="n">ComboDelegate</span><span class="o">::</span><span class="n">doCloseEditor</span><span class="p">,</span>
						   <span class="k">this</span><span class="p">,</span> <span class="n">container</span><span class="p">,</span> <span class="nb">false</span><span class="p">));</span>

	<span class="k">return</span> <span class="n">container</span><span class="p">;</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span><span class="o">*</span> <span class="n">items_</span><span class="p">;</span>

    <span class="kt">void</span> <span class="nf">doCloseEditor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WWidget</span> <span class="o">*</span><span class="n">editor</span><span class="p">,</span> <span class="kt">bool</span> <span class="n">save</span><span class="p">)</span> <span class="k">const</span>
    <span class="p">{</span>
	<span class="n">closeEditor</span><span class="p">().</span><span class="n">emit</span><span class="p">(</span><span class="n">editor</span><span class="p">,</span> <span class="n">save</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span><span class="p">();</span>

<span class="c1">// create model</span>
<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">&gt;</span> <span class="n">options</span><span class="p">;</span>
<span class="n">options</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;apples&quot;</span><span class="p">);</span>
<span class="n">options</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;pears&quot;</span><span class="p">);</span>
<span class="n">options</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;bananas&quot;</span><span class="p">);</span>
<span class="n">options</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;cherries&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span><span class="p">(</span><span class="n">table</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
  <span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">j</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">;</span> <span class="n">j</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItem</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItem</span><span class="p">();</span>
    <span class="n">item</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
    <span class="n">item</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">options</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">);</span>
    <span class="n">item</span><span class="o">-&gt;</span><span class="n">setFlags</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ItemIsEditable</span><span class="p">);</span>
    <span class="n">model</span><span class="o">-&gt;</span><span class="n">setItem</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">j</span><span class="p">,</span> <span class="n">item</span><span class="p">);</span>
  <span class="p">}</span>
<span class="p">}</span>

<span class="c1">// create table</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">SingleClicked</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WStringListModel</span><span class="o">*</span> <span class="n">slModel</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStringListModel</span><span class="p">(</span><span class="n">table</span><span class="p">);</span>
<span class="n">slModel</span><span class="o">-&gt;</span><span class="n">setStringList</span><span class="p">(</span><span class="n">options</span><span class="p">);</span>
<span class="n">ComboDelegate</span><span class="o">*</span> <span class="n">customdelegate</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ComboDelegate</span><span class="p">(</span><span class="n">slModel</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setItemDelegate</span><span class="p">(</span><span class="n">customdelegate</span><span class="p">);</span>

<span class="n">table</span><span class="o">-&gt;</span><span class="n">setSortingEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnResizeEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setRowHeight</span><span class="p">(</span><span class="mi">40</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderHeight</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>

<span class="k">const</span> <span class="kt">int</span> <span class="n">WIDTH</span> <span class="o">=</span> <span class="mi">120</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">table</span><span class="o">-&gt;</span><span class="n">model</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnWidth</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">WIDTH</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setWidth</span><span class="p">((</span><span class="n">WIDTH</span> <span class="o">+</span> <span class="mi">7</span><span class="p">)</span> <span class="o">*</span> <span class="n">table</span><span class="o">-&gt;</span><span class="n">model</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">()</span> <span class="o">+</span> <span class="mi">2</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Container">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">container</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;A first widget&quot;</span><span class="p">));</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// A widget can be added to a container by passing the container as</span>
    <span class="c1">// the last constructor argument.</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Text {1}&lt;/p&gt;&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">i</span><span class="p">),</span> <span class="n">container</span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-DataModels">
<div class="highlight"><pre><span class="cp">#include &quot;DataModels.h&quot;</span>

<span class="cp">#include &quot;Wt/WColor&quot;</span>

<span class="cp">#include &lt;cmath&gt;</span>

<span class="k">using</span> <span class="k">namespace</span> <span class="n">Wt</span><span class="p">;</span>

<span class="n">SombreroData</span><span class="o">::</span><span class="n">SombreroData</span><span class="p">(</span><span class="kt">unsigned</span> <span class="n">nbXpts</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">nbYpts</span><span class="p">,</span> <span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span><span class="p">)</span>
  <span class="o">:</span> <span class="n">WStandardItemModel</span><span class="p">(</span><span class="n">nbXpts</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">nbYpts</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">parent</span><span class="p">),</span>
    <span class="n">xStart_</span><span class="p">(</span><span class="o">-</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">xEnd_</span><span class="p">(</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">yStart_</span><span class="p">(</span><span class="o">-</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">yEnd_</span><span class="p">(</span><span class="mf">10.0</span><span class="p">)</span>
<span class="p">{}</span>

<span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">SombreroData</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">,</span> <span class="kt">int</span> <span class="n">role</span><span class="p">)</span> <span class="k">const</span>
<span class="p">{</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">!=</span> <span class="n">DisplayRole</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">WStandardItemModel</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">role</span><span class="p">);</span>
  <span class="p">}</span>

  <span class="kt">double</span> <span class="n">delta_y</span> <span class="o">=</span> <span class="p">(</span><span class="n">yEnd_</span> <span class="o">-</span> <span class="n">yStart_</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">columnCount</span><span class="p">()</span><span class="o">-</span><span class="mi">2</span><span class="p">);</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// give back y-abscis</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span>
      <span class="k">return</span> <span class="mf">0.0</span><span class="p">;</span>
    <span class="k">return</span> <span class="n">yStart_</span> <span class="o">+</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">delta_y</span><span class="p">;</span>
  <span class="p">}</span>
  
  <span class="kt">double</span> <span class="n">delta_x</span> <span class="o">=</span> <span class="p">(</span><span class="n">xEnd_</span> <span class="o">-</span> <span class="n">xStart_</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">rowCount</span><span class="p">()</span><span class="o">-</span><span class="mi">2</span><span class="p">);</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// give back x-abscis</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span>
      <span class="k">return</span> <span class="mf">0.0</span><span class="p">;</span>
    <span class="k">return</span> <span class="n">xStart_</span> <span class="o">+</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">delta_x</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="kt">double</span> <span class="n">x</span><span class="p">,</span> <span class="n">y</span><span class="p">;</span>
  <span class="n">y</span> <span class="o">=</span> <span class="n">yStart_</span> <span class="o">+</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">delta_y</span><span class="p">;</span>
  <span class="n">x</span> <span class="o">=</span> <span class="n">xStart_</span> <span class="o">+</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">)</span><span class="o">*</span><span class="n">delta_x</span><span class="p">;</span>
  <span class="k">return</span> <span class="mi">4</span><span class="o">*</span><span class="n">std</span><span class="o">::</span><span class="n">sin</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">sqrt</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="n">std</span><span class="o">::</span><span class="n">pow</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="mi">2</span><span class="p">)))</span> 
    <span class="o">/</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">sqrt</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">pow</span><span class="p">(</span><span class="n">x</span><span class="p">,</span><span class="mi">2</span><span class="p">)</span> <span class="o">+</span> <span class="n">std</span><span class="o">::</span><span class="n">pow</span><span class="p">(</span><span class="n">y</span><span class="p">,</span><span class="mi">2</span><span class="p">)));</span>
<span class="p">}</span>

<span class="n">PlaneData</span><span class="o">::</span><span class="n">PlaneData</span><span class="p">(</span><span class="kt">unsigned</span> <span class="n">nbXpts</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">nbYpts</span><span class="p">,</span> <span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span><span class="p">)</span>
  <span class="o">:</span> <span class="n">WStandardItemModel</span><span class="p">(</span><span class="n">nbXpts</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">nbYpts</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">parent</span><span class="p">),</span>
    <span class="n">xStart_</span><span class="p">(</span><span class="o">-</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">xEnd_</span><span class="p">(</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">yStart_</span><span class="p">(</span><span class="o">-</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">yEnd_</span><span class="p">(</span><span class="mf">10.0</span><span class="p">)</span>
<span class="p">{}</span>

<span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">PlaneData</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">,</span> <span class="kt">int</span> <span class="n">role</span><span class="p">)</span> <span class="k">const</span>
<span class="p">{</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">!=</span> <span class="n">DisplayRole</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">WStandardItemModel</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">role</span><span class="p">);</span>
  <span class="p">}</span>

  <span class="kt">double</span> <span class="n">delta_x</span> <span class="o">=</span> <span class="p">(</span><span class="n">xEnd_</span> <span class="o">-</span> <span class="n">xStart_</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">rowCount</span><span class="p">()</span><span class="o">-</span><span class="mi">2</span><span class="p">);</span>
  <span class="kt">double</span> <span class="n">delta_y</span> <span class="o">=</span> <span class="p">(</span><span class="n">yEnd_</span> <span class="o">-</span> <span class="n">yStart_</span><span class="p">)</span><span class="o">/</span><span class="p">(</span><span class="n">columnCount</span><span class="p">()</span><span class="o">-</span><span class="mi">2</span><span class="p">);</span>
  <span class="kt">double</span> <span class="n">x</span> <span class="o">=</span> <span class="n">xStart_</span> <span class="o">+</span> <span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span> <span class="o">*</span> <span class="n">delta_x</span><span class="p">;</span>
  <span class="kt">double</span> <span class="n">y</span> <span class="o">=</span> <span class="n">yStart_</span> <span class="o">+</span> <span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">*</span> <span class="n">delta_y</span><span class="p">;</span>

  <span class="k">return</span> <span class="mf">0.2</span><span class="o">*</span><span class="n">x</span> <span class="o">-</span> <span class="mf">0.2</span><span class="o">*</span><span class="n">y</span><span class="p">;</span>
<span class="p">}</span>

<span class="n">HorizontalPlaneData</span><span class="o">::</span><span class="n">HorizontalPlaneData</span><span class="p">(</span><span class="kt">unsigned</span> <span class="n">nbXpts</span><span class="p">,</span> <span class="kt">unsigned</span> <span class="n">nbYpts</span><span class="p">,</span> <span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span><span class="p">)</span>
  <span class="o">:</span> <span class="n">WStandardItemModel</span><span class="p">(</span><span class="n">nbXpts</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">nbYpts</span><span class="o">+</span><span class="mi">1</span><span class="p">,</span> <span class="n">parent</span><span class="p">),</span>
    <span class="n">xStart_</span><span class="p">(</span><span class="o">-</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">xEnd_</span><span class="p">(</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">yStart_</span><span class="p">(</span><span class="o">-</span><span class="mf">10.0</span><span class="p">),</span> <span class="n">yEnd_</span><span class="p">(</span><span class="mf">10.0</span><span class="p">)</span>
<span class="p">{}</span>

<span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">HorizontalPlaneData</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">,</span> <span class="kt">int</span> <span class="n">role</span><span class="p">)</span> <span class="k">const</span>
<span class="p">{</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">!=</span> <span class="n">DisplayRole</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">WStandardItemModel</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">role</span><span class="p">);</span>
  <span class="p">}</span>

  <span class="k">return</span> <span class="mf">0.0</span><span class="p">;</span>
<span class="p">}</span>

<span class="n">SpiralData</span><span class="o">::</span><span class="n">SpiralData</span><span class="p">(</span><span class="kt">unsigned</span> <span class="n">nbPts</span><span class="p">,</span> <span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span><span class="p">)</span>
  <span class="o">:</span> <span class="n">WStandardItemModel</span><span class="p">(</span><span class="n">nbPts</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">parent</span><span class="p">),</span> <span class="n">nbPts_</span><span class="p">(</span><span class="n">nbPts</span><span class="p">)</span>
<span class="p">{}</span>

<span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">SpiralData</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">,</span> <span class="kt">int</span> <span class="n">role</span><span class="p">)</span> <span class="k">const</span>
<span class="p">{</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">!=</span> <span class="n">DisplayRole</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">WStandardItemModel</span><span class="o">::</span><span class="n">data</span><span class="p">(</span><span class="n">index</span><span class="p">,</span> <span class="n">role</span><span class="p">);</span>
  <span class="p">}</span>

  <span class="k">const</span> <span class="kt">double</span> <span class="n">pi</span> <span class="o">=</span> <span class="mf">3.141592</span><span class="p">;</span>
  <span class="kt">double</span> <span class="n">XYangle</span> <span class="o">=</span> <span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span> <span class="o">*</span> <span class="p">(</span><span class="mi">8</span><span class="o">*</span><span class="n">pi</span><span class="o">/</span><span class="n">nbPts_</span><span class="p">);</span>
  <span class="kt">double</span> <span class="n">heightRatio</span> <span class="o">=</span> <span class="p">(</span><span class="kt">float</span><span class="p">)</span><span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span> <span class="o">/</span> <span class="n">rowCount</span><span class="p">();</span>
  <span class="kt">double</span> <span class="n">radius</span> <span class="o">=</span> <span class="mf">1.0</span> <span class="o">+</span> <span class="n">heightRatio</span> <span class="o">*</span> <span class="mf">5.0</span><span class="p">;</span>
  <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">radius</span> <span class="o">*</span> <span class="n">std</span><span class="o">::</span><span class="n">cos</span><span class="p">(</span><span class="n">XYangle</span><span class="p">);</span>
  <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">radius</span> <span class="o">*</span> <span class="n">std</span><span class="o">::</span><span class="n">sin</span><span class="p">(</span><span class="n">XYangle</span><span class="p">);</span>
  <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">return</span> <span class="mf">5.0</span> <span class="o">-</span> <span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()</span> <span class="o">*</span> <span class="p">(</span><span class="mf">10.0</span><span class="o">/</span><span class="n">nbPts_</span><span class="p">);</span>
  <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
    <span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
  <span class="p">}</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-DateEdit">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCalendar&gt;</span>
<span class="cp">#include &lt;Wt/WDate&gt;</span>
<span class="cp">#include &lt;Wt/WDateEdit&gt;</span>
<span class="cp">#include &lt;Wt/WLabel&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>
<span class="cp">#include &lt;Wt/WString&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">form</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;dateEdit-template&quot;</span><span class="p">));</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span> <span class="o">*</span><span class="n">de1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;from&quot;</span><span class="p">,</span> <span class="n">de1</span><span class="p">);</span>
<span class="n">de1</span><span class="o">-&gt;</span><span class="n">setDate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">::</span><span class="n">currentServerDate</span><span class="p">().</span><span class="n">addDays</span><span class="p">(</span><span class="mi">1</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span> <span class="o">*</span><span class="n">de2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;to&quot;</span><span class="p">,</span> <span class="n">de2</span><span class="p">);</span>
<span class="n">de2</span><span class="o">-&gt;</span><span class="n">setFormat</span><span class="p">(</span><span class="s">&quot;dd MM yyyy&quot;</span><span class="p">);</span> <span class="c1">// Apply a different date format.</span>
<span class="n">de2</span><span class="o">-&gt;</span><span class="n">calendar</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">setHorizontalHeaderFormat</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WCalendar</span><span class="o">::</span><span class="n">SingleLetterDayNames</span><span class="p">);</span>
<span class="n">de2</span><span class="o">-&gt;</span><span class="n">setBottom</span><span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">());</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">);</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;save&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;out&quot;</span><span class="p">,</span> <span class="n">out</span><span class="p">);</span>

<span class="n">de1</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">de2</span><span class="o">-&gt;</span><span class="n">setBottom</span><span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">());</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Date picker 1 is changed.&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>

<span class="n">de2</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">de1</span><span class="o">-&gt;</span><span class="n">setTop</span><span class="p">(</span><span class="n">de2</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">());</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Date picker 2 is changed.&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">().</span><span class="n">empty</span><span class="p">()</span> <span class="o">||</span> <span class="n">de2</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">().</span><span class="n">empty</span><span class="p">())</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You should enter two dates!&quot;</span><span class="p">);</span>
    <span class="k">else</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">days</span> <span class="o">=</span> <span class="n">de1</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">().</span><span class="n">daysTo</span><span class="p">(</span><span class="n">de2</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">())</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">days</span> <span class="o">==</span> <span class="mi">1</span><span class="p">)</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;It&#39;s fine to take holiday just for one day!&quot;</span><span class="p">);</span>
	<span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">days</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">)</span> 
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;So, you want to take holiday for a period of &quot;</span>
				     <span class="s">&quot;{1} days?...&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">days</span><span class="p">));</span>
	<span class="k">else</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Invalid period!&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-DatePicker">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WCalendar&gt;</span>
<span class="cp">#include &lt;Wt/WDate&gt;</span>
<span class="cp">#include &lt;Wt/WDatePicker&gt;</span>
<span class="cp">#include &lt;Wt/WLabel&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">form</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;dateEdit-template&quot;</span><span class="p">));</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WDatePicker</span> <span class="o">*</span><span class="n">dp1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDatePicker</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;from&quot;</span><span class="p">,</span> <span class="n">dp1</span><span class="p">);</span>
<span class="n">dp1</span><span class="o">-&gt;</span><span class="n">setDate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">::</span><span class="n">currentServerDate</span><span class="p">().</span><span class="n">addDays</span><span class="p">(</span><span class="mi">1</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WDatePicker</span> <span class="o">*</span><span class="n">dp2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDatePicker</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;to&quot;</span><span class="p">,</span> <span class="n">dp2</span><span class="p">);</span>
<span class="n">dp2</span><span class="o">-&gt;</span><span class="n">setFormat</span><span class="p">(</span><span class="s">&quot;dd MM yyyy&quot;</span><span class="p">);</span> <span class="c1">// Apply a different date format.</span>
<span class="n">dp2</span><span class="o">-&gt;</span><span class="n">calendar</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">setHorizontalHeaderFormat</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WCalendar</span><span class="o">::</span><span class="n">SingleLetterDayNames</span><span class="p">);</span>
<span class="n">dp2</span><span class="o">-&gt;</span><span class="n">setBottom</span><span class="p">(</span><span class="n">dp1</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">());</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">);</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;save&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;out&quot;</span><span class="p">,</span> <span class="n">out</span><span class="p">);</span>

<span class="n">dp1</span><span class="o">-&gt;</span><span class="n">lineEdit</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">dp2</span><span class="o">-&gt;</span><span class="n">setBottom</span><span class="p">(</span><span class="n">dp1</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">());</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Date picker 1 is changed.&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">dp2</span><span class="o">-&gt;</span><span class="n">lineEdit</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">dp1</span><span class="o">-&gt;</span><span class="n">setTop</span><span class="p">(</span><span class="n">dp2</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">());</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Date picker 2 is changed.&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">dp1</span><span class="o">-&gt;</span><span class="n">lineEdit</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">().</span><span class="n">empty</span><span class="p">()</span> <span class="o">||</span> <span class="n">dp2</span><span class="o">-&gt;</span><span class="n">lineEdit</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">().</span><span class="n">empty</span><span class="p">())</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You should enter two dates!&quot;</span><span class="p">);</span>
    <span class="k">else</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">days</span> <span class="o">=</span> <span class="n">dp1</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">().</span><span class="n">daysTo</span><span class="p">(</span><span class="n">dp2</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">())</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">days</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;It&#39;s fine to take holiday just for one day!&quot;</span><span class="p">);</span>
	<span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">days</span> <span class="o">&gt;</span> <span class="mi">1</span><span class="p">)</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;So, you want to take holiday for a period &quot;</span>
				     <span class="s">&quot;of {1} days?...&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">days</span><span class="p">));</span>
	<span class="k">else</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Invalid period!&quot;</span><span class="p">);</span>
   <span class="p">}</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-Dialog">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WDialog&gt;</span>
<span class="cp">#include &lt;Wt/WEnvironment&gt;</span>
<span class="cp">#include &lt;Wt/WLabel&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WRegExpValidator&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>

<span class="kt">void</span> <span class="n">showDialog</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span><span class="p">)</span>
<span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WDialog</span> <span class="o">*</span><span class="n">dialog</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDialog</span><span class="p">(</span><span class="s">&quot;Go to cell&quot;</span><span class="p">);</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WLabel</span> <span class="o">*</span><span class="n">label</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLabel</span><span class="p">(</span><span class="s">&quot;Cell location (A1..Z999)&quot;</span><span class="p">,</span>
				       <span class="n">dialog</span><span class="o">-&gt;</span><span class="n">contents</span><span class="p">());</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">dialog</span><span class="o">-&gt;</span><span class="n">contents</span><span class="p">());</span>
    <span class="n">label</span><span class="o">-&gt;</span><span class="n">setBuddy</span><span class="p">(</span><span class="n">edit</span><span class="p">);</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WRegExpValidator</span> <span class="o">*</span><span class="n">validator</span> <span class="o">=</span> 
        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRegExpValidator</span><span class="p">(</span><span class="s">&quot;[A-Za-z][1-9][0-9]{0,2}&quot;</span><span class="p">);</span>
    <span class="n">validator</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
    <span class="n">edit</span><span class="o">-&gt;</span><span class="n">setValidator</span><span class="p">(</span><span class="n">validator</span><span class="p">);</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">ok</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;OK&quot;</span><span class="p">,</span> <span class="n">dialog</span><span class="o">-&gt;</span><span class="n">footer</span><span class="p">());</span>
    <span class="n">ok</span><span class="o">-&gt;</span><span class="n">setDefault</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">wApp</span><span class="o">-&gt;</span><span class="n">environment</span><span class="p">().</span><span class="n">ajax</span><span class="p">())</span>
      <span class="n">ok</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">cancel</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Cancel&quot;</span><span class="p">,</span> <span class="n">dialog</span><span class="o">-&gt;</span><span class="n">footer</span><span class="p">());</span>
    <span class="n">dialog</span><span class="o">-&gt;</span><span class="n">rejectWhenEscapePressed</span><span class="p">();</span>

    <span class="n">edit</span><span class="o">-&gt;</span><span class="n">keyWentUp</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	<span class="n">ok</span><span class="o">-&gt;</span><span class="n">setDisabled</span><span class="p">(</span><span class="n">edit</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">()</span> <span class="o">!=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">);</span>
    <span class="p">}));</span>

    <span class="cm">/*</span>
<span class="cm">     * Accept the dialog</span>
<span class="cm">     */</span>
    <span class="n">ok</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">edit</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">())</span>
	    <span class="n">dialog</span><span class="o">-&gt;</span><span class="n">accept</span><span class="p">();</span>
    <span class="p">}));</span>

    <span class="cm">/*</span>
<span class="cm">     * Reject the dialog</span>
<span class="cm">     */</span>
    <span class="n">cancel</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">dialog</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDialog</span><span class="o">::</span><span class="n">reject</span><span class="p">);</span>

    <span class="cm">/*</span>
<span class="cm">     * Process the dialog result.</span>
<span class="cm">     */</span>
    <span class="n">dialog</span><span class="o">-&gt;</span><span class="n">finished</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">dialog</span><span class="o">-&gt;</span><span class="n">result</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDialog</span><span class="o">::</span><span class="n">Accepted</span><span class="p">)</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;New location: &quot;</span> <span class="o">+</span> <span class="n">edit</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">());</span>
	<span class="k">else</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;No location selected.&quot;</span><span class="p">);</span>

	<span class="k">delete</span> <span class="n">dialog</span><span class="p">;</span>
    <span class="p">}));</span>

    <span class="n">dialog</span><span class="o">-&gt;</span><span class="n">show</span><span class="p">();</span>
<span class="p">}</span>

<span class="p">}</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Jump&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
      <span class="n">showDialog</span><span class="p">(</span><span class="n">out</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-FileUpload">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WFileUpload&gt;</span>
<span class="cp">#include &lt;Wt/WProgressBar&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WFileUpload</span> <span class="o">*</span><span class="n">fu</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFileUpload</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">fu</span><span class="o">-&gt;</span><span class="n">setFileTextSize</span><span class="p">(</span><span class="mi">50</span><span class="p">);</span> <span class="c1">// Set the maximum file size to 50 kB.</span>
<span class="n">fu</span><span class="o">-&gt;</span><span class="n">setProgressBar</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WProgressBar</span><span class="p">());</span>
<span class="n">fu</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="c1">// Provide a button to start uploading.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">uploadButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Send&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">uploadButton</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="c1">// Upload when the button is clicked.</span>
<span class="n">uploadButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">fu</span><span class="o">-&gt;</span><span class="n">upload</span><span class="p">();</span>
    <span class="n">uploadButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
<span class="p">}));</span>

<span class="c1">// Upload automatically when the user entered a file.</span>
<span class="n">fu</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">fu</span><span class="o">-&gt;</span><span class="n">upload</span><span class="p">();</span>
    <span class="n">uploadButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;File upload is changed.&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="c1">// React to a succesfull upload.</span>
<span class="n">fu</span><span class="o">-&gt;</span><span class="n">uploaded</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;File upload is finished.&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="c1">// React to a file upload problem.</span>
<span class="n">fu</span><span class="o">-&gt;</span><span class="n">fileTooLarge</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;File is too large.&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-Flash">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/WFlashObject&gt;</span>

<span class="c1">// Define poster image location</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">poster</span> <span class="o">=</span> <span class="s">&quot;pics/sintel_trailer.jpg&quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WFlashObject</span> <span class="o">*</span><span class="n">flash</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFlashObject</span><span class="p">(</span><span class="s">&quot;http://www.youtube.com/v/HOfdboHvshg&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setFlashParameter</span><span class="p">(</span><span class="s">&quot;allowFullScreen&quot;</span><span class="p">,</span> <span class="s">&quot;true&quot;</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setAlternativeContent</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">poster</span><span class="p">));</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">360</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-FormModel">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WBoostAny&gt;</span>
<span class="cp">#include &lt;Wt/WComboBox&gt;</span>
<span class="cp">#include &lt;Wt/WDate&gt;</span>
<span class="cp">#include &lt;Wt/WDateEdit&gt;</span>
<span class="cp">#include &lt;Wt/WDateValidator&gt;</span>
<span class="cp">#include &lt;Wt/WFormModel&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/WIntValidator&gt;</span>
<span class="cp">#include &lt;Wt/WLengthValidator&gt;</span>
<span class="cp">#include &lt;Wt/WModelIndex&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WSpinBox&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItem&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WString&gt;</span>
<span class="cp">#include &lt;Wt/WTemplateFormView&gt;</span>
<span class="cp">#include &lt;Wt/WTextArea&gt;</span>
<span class="cp">#include &lt;Wt/WValidator&gt;</span>

<span class="k">class</span> <span class="nc">UserFormModel</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="c1">// Associate each field with a unique string literal.</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">Field</span> <span class="n">FirstNameField</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">Field</span> <span class="n">LastNameField</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">Field</span> <span class="n">CountryField</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">Field</span> <span class="n">CityField</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">Field</span> <span class="n">BirthField</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">Field</span> <span class="n">ChildrenField</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">Field</span> <span class="n">RemarksField</span><span class="p">;</span>

    <span class="n">UserFormModel</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
        <span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="n">initializeModels</span><span class="p">();</span>

        <span class="n">addField</span><span class="p">(</span><span class="n">FirstNameField</span><span class="p">);</span>
        <span class="n">addField</span><span class="p">(</span><span class="n">LastNameField</span><span class="p">);</span>
        <span class="n">addField</span><span class="p">(</span><span class="n">CountryField</span><span class="p">);</span>
        <span class="n">addField</span><span class="p">(</span><span class="n">CityField</span><span class="p">);</span>
        <span class="n">addField</span><span class="p">(</span><span class="n">BirthField</span><span class="p">);</span>
        <span class="n">addField</span><span class="p">(</span><span class="n">ChildrenField</span><span class="p">);</span>
        <span class="n">addField</span><span class="p">(</span><span class="n">RemarksField</span><span class="p">);</span>

        <span class="n">setValidator</span><span class="p">(</span><span class="n">FirstNameField</span><span class="p">,</span> <span class="n">createNameValidator</span><span class="p">(</span><span class="n">FirstNameField</span><span class="p">));</span>
        <span class="n">setValidator</span><span class="p">(</span><span class="n">LastNameField</span><span class="p">,</span> <span class="n">createNameValidator</span><span class="p">(</span><span class="n">LastNameField</span><span class="p">));</span>
        <span class="n">setValidator</span><span class="p">(</span><span class="n">CountryField</span><span class="p">,</span> <span class="n">createCountryValidator</span><span class="p">());</span>
        <span class="n">setValidator</span><span class="p">(</span><span class="n">CityField</span><span class="p">,</span> <span class="n">createCityValidator</span><span class="p">());</span>
        <span class="n">setValidator</span><span class="p">(</span><span class="n">BirthField</span><span class="p">,</span> <span class="n">createBirthValidator</span><span class="p">());</span>
        <span class="n">setValidator</span><span class="p">(</span><span class="n">ChildrenField</span><span class="p">,</span> <span class="n">createChildrenValidator</span><span class="p">());</span>

        <span class="c1">// Here you could populate the model with initial data using</span>
        <span class="c1">// setValue() for each field.</span>

        <span class="n">setValue</span><span class="p">(</span><span class="n">BirthField</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="p">());</span>
        <span class="n">setValue</span><span class="p">(</span><span class="n">CountryField</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">());</span>
    <span class="p">}</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span> <span class="o">*</span><span class="n">countryModel</span><span class="p">()</span> <span class="p">{</span>
        <span class="k">return</span> <span class="n">countryModel_</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="kt">int</span> <span class="n">countryModelRow</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">code</span><span class="p">)</span> <span class="p">{</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">countryModel_</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
	    <span class="k">if</span> <span class="p">(</span><span class="n">countryCode</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">==</span> <span class="n">code</span><span class="p">)</span>
	        <span class="k">return</span> <span class="n">i</span><span class="p">;</span>

	<span class="k">return</span> <span class="o">-</span><span class="mi">1</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span> <span class="o">*</span><span class="n">cityModel</span><span class="p">()</span> <span class="p">{</span>
        <span class="k">return</span> <span class="n">cityModel_</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">updateCityModel</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">countryCode</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">cityModel_</span><span class="o">-&gt;</span><span class="n">clear</span><span class="p">();</span>

        <span class="n">CityMap</span><span class="o">::</span><span class="n">const_iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">cities</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="n">countryCode</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="n">i</span> <span class="o">!=</span> <span class="n">cities</span><span class="p">.</span><span class="n">end</span><span class="p">())</span> <span class="p">{</span>
            <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;&amp;</span> <span class="n">cities</span> <span class="o">=</span> <span class="n">i</span><span class="o">-&gt;</span><span class="n">second</span><span class="p">;</span>

            <span class="c1">// The initial text shown in the city combo box should be an empty</span>
            <span class="c1">// string.</span>
            <span class="n">cityModel_</span><span class="o">-&gt;</span><span class="n">appendRow</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItem</span><span class="p">());</span>

            <span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="n">cities</span><span class="p">.</span><span class="n">size</span><span class="p">();</span> <span class="o">++</span><span class="n">j</span><span class="p">)</span>
                <span class="n">cityModel_</span><span class="o">-&gt;</span><span class="n">appendRow</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItem</span><span class="p">(</span><span class="n">cities</span><span class="p">[</span><span class="n">j</span><span class="p">]));</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="n">cityModel_</span><span class="o">-&gt;</span><span class="n">appendRow</span><span class="p">(</span>
                        <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItem</span><span class="p">(</span><span class="s">&quot;(Choose Country first)&quot;</span><span class="p">));</span>
        <span class="p">}</span>
    <span class="p">}</span>

    <span class="c1">// Get the user data from the model</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">userData</span><span class="p">()</span> <span class="p">{</span>
        <span class="k">return</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">value</span><span class="p">(</span><span class="n">FirstNameField</span><span class="p">))</span> <span class="o">+</span> <span class="s">&quot; &quot;</span> <span class="o">+</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">value</span><span class="p">(</span><span class="n">LastNameField</span><span class="p">))</span>
        <span class="o">+</span> <span class="s">&quot;: country code=&quot;</span> <span class="o">+</span> <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">value</span><span class="p">(</span><span class="n">CountryField</span><span class="p">))</span>
        <span class="o">+</span> <span class="s">&quot;, city=&quot;</span> <span class="o">+</span> <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">value</span><span class="p">(</span><span class="n">CityField</span><span class="p">))</span>
        <span class="o">+</span> <span class="s">&quot;, birth=&quot;</span> <span class="o">+</span> <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">value</span><span class="p">(</span><span class="n">BirthField</span><span class="p">))</span>
        <span class="o">+</span> <span class="s">&quot;, children=&quot;</span> <span class="o">+</span> <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">value</span><span class="p">(</span><span class="n">ChildrenField</span><span class="p">))</span>
        <span class="o">+</span> <span class="s">&quot;, remarks=&quot;</span> <span class="o">+</span> <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">value</span><span class="p">(</span><span class="n">RemarksField</span><span class="p">))</span>
        <span class="o">+</span> <span class="s">&quot;.&quot;</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="c1">// Get the right code for the current index.</span>
    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">countryCode</span> <span class="p">(</span><span class="kt">int</span> <span class="n">row</span><span class="p">)</span> <span class="p">{</span>
        <span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span>
	  <span class="p">(</span><span class="n">countryModel_</span><span class="o">-&gt;</span><span class="n">data</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">));</span>
    <span class="p">}</span>

    <span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o">&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span> <span class="o">&gt;</span> <span class="n">CityMap</span><span class="p">;</span>
    <span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span> <span class="n">CountryMap</span><span class="p">;</span>

<span class="nl">private:</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">CityMap</span> <span class="n">cities</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="n">CountryMap</span> <span class="n">countries</span><span class="p">;</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">countryModel_</span><span class="p">,</span> <span class="o">*</span><span class="n">cityModel_</span><span class="p">;</span>

    <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">MAX_LENGTH</span> <span class="o">=</span> <span class="mi">25</span><span class="p">;</span>
    <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">MAX_CHILDREN</span> <span class="o">=</span> <span class="mi">15</span><span class="p">;</span>

    <span class="kt">void</span> <span class="nf">initializeModels</span><span class="p">()</span> <span class="p">{</span>
        <span class="c1">// Create a country model.</span>
        <span class="kt">unsigned</span> <span class="n">countryModelRows</span> <span class="o">=</span> <span class="n">countries</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>
        <span class="k">const</span> <span class="kt">unsigned</span> <span class="n">countryModelColumns</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
        <span class="n">countryModel_</span> <span class="o">=</span>
          <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span><span class="p">(</span><span class="n">countryModelRows</span><span class="p">,</span> <span class="n">countryModelColumns</span><span class="p">,</span>
                                     <span class="k">this</span><span class="p">);</span>

        <span class="c1">// The initial text shown in the country combo box should be an empty</span>
        <span class="c1">// string.</span>
        <span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
        <span class="n">countryModel_</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot; &quot;</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">);</span>
        <span class="n">countryModel_</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>

        <span class="c1">// For each country, update the model based on the key (corresponding</span>
        <span class="c1">// to the country code):</span>
        <span class="c1">// - set the country name for the display role,</span>
        <span class="c1">// - set the city names for the user role.</span>
        <span class="n">row</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
        <span class="k">for</span> <span class="p">(</span><span class="n">CountryMap</span><span class="o">::</span><span class="n">const_iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">countries</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span>
                                        <span class="n">i</span> <span class="o">!=</span> <span class="n">countries</span><span class="p">.</span><span class="n">end</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
            <span class="n">countryModel_</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">i</span><span class="o">-&gt;</span><span class="n">second</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">);</span>
            <span class="n">countryModel_</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">row</span><span class="o">++</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">i</span><span class="o">-&gt;</span><span class="n">first</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
        <span class="p">}</span>

        <span class="c1">// Create a city model.</span>
        <span class="n">cityModel_</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
        <span class="n">updateCityModel</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">());</span>
    <span class="p">}</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span> <span class="o">*</span><span class="n">createNameValidator</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">field</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WLengthValidator</span> <span class="o">*</span><span class="n">v</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLengthValidator</span><span class="p">();</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setMinimumLength</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setMaximumLength</span><span class="p">(</span><span class="n">MAX_LENGTH</span><span class="p">);</span>
        <span class="k">return</span> <span class="n">v</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span> <span class="o">*</span><span class="n">createCountryValidator</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WLengthValidator</span> <span class="o">*</span><span class="n">v</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLengthValidator</span><span class="p">();</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="k">return</span> <span class="n">v</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span> <span class="o">*</span><span class="n">createCityValidator</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WLengthValidator</span> <span class="o">*</span><span class="n">v</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLengthValidator</span><span class="p">();</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="k">return</span> <span class="n">v</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span> <span class="o">*</span><span class="n">createBirthValidator</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WDateValidator</span> <span class="o">*</span><span class="n">v</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDateValidator</span><span class="p">();</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setBottom</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="p">(</span><span class="mi">1900</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">));</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setTop</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">::</span><span class="n">currentDate</span><span class="p">());</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setFormat</span><span class="p">(</span><span class="s">&quot;dd/MM/yyyy&quot;</span><span class="p">);</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="k">return</span> <span class="n">v</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span> <span class="o">*</span><span class="n">createChildrenValidator</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WIntValidator</span> <span class="o">*</span><span class="n">v</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WIntValidator</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">MAX_CHILDREN</span><span class="p">);</span>
        <span class="n">v</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="k">return</span> <span class="n">v</span><span class="p">;</span>
    <span class="p">}</span>

<span class="p">};</span>

<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">FirstNameField</span> <span class="o">=</span> <span class="s">&quot;first-name&quot;</span><span class="p">;</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">LastNameField</span> <span class="o">=</span> <span class="s">&quot;last-name&quot;</span><span class="p">;</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">CountryField</span> <span class="o">=</span> <span class="s">&quot;country&quot;</span><span class="p">;</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">CityField</span> <span class="o">=</span> <span class="s">&quot;city&quot;</span><span class="p">;</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">BirthField</span> <span class="o">=</span> <span class="s">&quot;birth&quot;</span><span class="p">;</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">ChildrenField</span> <span class="o">=</span> <span class="s">&quot;children&quot;</span><span class="p">;</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">RemarksField</span> <span class="o">=</span> <span class="s">&quot;remarks&quot;</span><span class="p">;</span>

<span class="c1">// In C++11, this initializing can be done inline, within the declaration:</span>
<span class="c1">//</span>
<span class="c1">// const UserFormModel::CityMap UserFormModel::cities = {</span>
<span class="c1">//    { &quot;BE&quot;, { &quot;Antwerp&quot;, &quot;Bruges&quot;, &quot;Brussels&quot;, &quot;Ghent&quot; } },</span>
<span class="c1">//    { &quot;NL&quot;, { &quot;Amsterdam&quot;, &quot;Eindhoven&quot;, &quot;Rotterdam&quot;, &quot;The Hague&quot;} },</span>
<span class="c1">//    { &quot;UK&quot;, { &quot;London&quot;, &quot;Bristol&quot;, &quot;Oxford&quot;, &quot;Stonehenge&quot;} },</span>
<span class="c1">//    { &quot;US&quot;, { &quot;Boston&quot;, &quot;Chicago&quot;, &quot;Los Angeles&quot;, &quot;New York&quot;} }</span>
<span class="c1">// };</span>

<span class="k">namespace</span> <span class="p">{</span>
    <span class="n">UserFormModel</span><span class="o">::</span><span class="n">CountryMap</span> <span class="n">getCountryMap</span><span class="p">()</span> <span class="p">{</span>
	<span class="n">UserFormModel</span><span class="o">::</span><span class="n">CountryMap</span> <span class="n">retval</span><span class="p">;</span>
	<span class="n">retval</span><span class="p">[</span><span class="s">&quot;BE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Belgium&quot;</span><span class="p">;</span>
	<span class="n">retval</span><span class="p">[</span><span class="s">&quot;NL&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;Netherlands&quot;</span><span class="p">;</span>
	<span class="n">retval</span><span class="p">[</span><span class="s">&quot;UK&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;United Kingdom&quot;</span><span class="p">;</span>
	<span class="n">retval</span><span class="p">[</span><span class="s">&quot;US&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s">&quot;United States&quot;</span><span class="p">;</span>
	<span class="k">return</span> <span class="n">retval</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">}</span>
<span class="k">const</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">CountryMap</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">countries</span> <span class="o">=</span> <span class="n">getCountryMap</span><span class="p">();</span>

<span class="k">namespace</span> <span class="p">{</span>
    <span class="n">UserFormModel</span><span class="o">::</span><span class="n">CityMap</span> <span class="n">getCityMap</span><span class="p">()</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span> <span class="n">beCities</span><span class="p">;</span>
	<span class="n">beCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Antwerp&quot;</span><span class="p">);</span>
	<span class="n">beCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Bruges&quot;</span><span class="p">);</span>
	<span class="n">beCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Brussels&quot;</span><span class="p">);</span>
	<span class="n">beCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Ghent&quot;</span><span class="p">);</span>

	<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span> <span class="n">nlCities</span><span class="p">;</span>
	<span class="n">nlCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Amsterdam&quot;</span><span class="p">);</span>
	<span class="n">nlCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Eindhoven&quot;</span><span class="p">);</span>
	<span class="n">nlCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Rotterdam&quot;</span><span class="p">);</span>
	<span class="n">nlCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;The Hague&quot;</span><span class="p">);</span>

	<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span> <span class="n">ukCities</span><span class="p">;</span>
	<span class="n">ukCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;London&quot;</span><span class="p">);</span>
	<span class="n">ukCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Bristol&quot;</span><span class="p">);</span>
	<span class="n">ukCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Oxford&quot;</span><span class="p">);</span>
	<span class="n">ukCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Stonehenge&quot;</span><span class="p">);</span>

	<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span> <span class="n">usCities</span><span class="p">;</span>
	<span class="n">usCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Boston&quot;</span><span class="p">);</span>
	<span class="n">usCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Chicago&quot;</span><span class="p">);</span>
        <span class="n">usCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;Los Angeles&quot;</span><span class="p">);</span>
	<span class="n">usCities</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="s">&quot;New York&quot;</span><span class="p">);</span>

	<span class="n">UserFormModel</span><span class="o">::</span><span class="n">CityMap</span> <span class="n">retval</span><span class="p">;</span>
	<span class="n">retval</span><span class="p">[</span><span class="s">&quot;BE&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">beCities</span><span class="p">;</span>
	<span class="n">retval</span><span class="p">[</span><span class="s">&quot;NL&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">nlCities</span><span class="p">;</span>
	<span class="n">retval</span><span class="p">[</span><span class="s">&quot;UK&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">ukCities</span><span class="p">;</span>
        <span class="n">retval</span><span class="p">[</span><span class="s">&quot;US&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">usCities</span><span class="p">;</span>
	<span class="k">return</span> <span class="n">retval</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="k">const</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">CityMap</span> <span class="n">UserFormModel</span><span class="o">::</span><span class="n">cities</span> <span class="o">=</span> <span class="n">getCityMap</span><span class="p">();</span>

<span class="k">class</span> <span class="nc">UserFormView</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplateFormView</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="c1">// inline constructor</span>
    <span class="n">UserFormView</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">model</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UserFormModel</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>

        <span class="n">setTemplateText</span><span class="p">(</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;userForm-template&quot;</span><span class="p">));</span>
        <span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>
        <span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;block&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

        <span class="cm">/*</span>
<span class="cm">	 * First Name</span>
<span class="cm">	 */</span>
	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">FirstNameField</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">());</span>

	<span class="cm">/*</span>
<span class="cm">	 * Last Name</span>
<span class="cm">	 */</span>
	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">LastNameField</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">());</span>

	<span class="cm">/*</span>
<span class="cm">	 * Country</span>
<span class="cm">	 */</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span> <span class="o">*</span><span class="n">countryCB</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">();</span>
	<span class="n">countryCB</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">countryModel</span><span class="p">());</span>

	<span class="n">countryCB</span><span class="o">-&gt;</span><span class="n">activated</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">code</span> <span class="o">=</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">countryCode</span><span class="p">(</span><span class="n">countryCB</span><span class="o">-&gt;</span><span class="n">currentIndex</span><span class="p">());</span>
	    <span class="n">model</span><span class="o">-&gt;</span><span class="n">updateCityModel</span><span class="p">(</span><span class="n">code</span><span class="p">);</span>
	<span class="p">}));</span>

	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">CountryField</span><span class="p">,</span> <span class="n">countryCB</span><span class="p">,</span>
            <span class="p">[</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span> <span class="c1">// updateViewValue()</span>
	        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">code</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">any_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span>
		    <span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">CountryField</span><span class="p">));</span>
		<span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">countryModelRow</span><span class="p">(</span><span class="n">code</span><span class="p">);</span>
		<span class="n">countryCB</span><span class="o">-&gt;</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="n">row</span><span class="p">);</span>
	    <span class="p">},</span>

            <span class="p">[</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span> <span class="c1">// updateModelValue()</span>
	        <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">code</span> <span class="o">=</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">countryCode</span><span class="p">(</span><span class="n">countryCB</span><span class="o">-&gt;</span><span class="n">currentIndex</span><span class="p">());</span>
		<span class="n">model</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">CountryField</span><span class="p">,</span> <span class="n">code</span><span class="p">);</span>
            <span class="p">});</span>

	<span class="cm">/*</span>
<span class="cm">	 * City</span>
<span class="cm">	 */</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span> <span class="o">*</span><span class="n">cityCB</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">();</span>
	<span class="n">cityCB</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">cityModel</span><span class="p">());</span>
	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">CityField</span><span class="p">,</span> <span class="n">cityCB</span><span class="p">);</span>

	<span class="cm">/*</span>
<span class="cm">	 * Birth Date</span>
<span class="cm">	 */</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span> <span class="o">*</span><span class="n">dateEdit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span><span class="p">();</span>
	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">BirthField</span><span class="p">,</span> <span class="n">dateEdit</span><span class="p">,</span>
	    <span class="p">[</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span> <span class="c1">// updateViewValue()</span>
	        <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span> <span class="n">date</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">any_cast</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">&gt;</span>
		    <span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">BirthField</span><span class="p">));</span>
                <span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">setDate</span><span class="p">(</span><span class="n">date</span><span class="p">);</span>
	    <span class="p">},</span> 

            <span class="p">[</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span> <span class="c1">// updateModelValue()</span>
	        <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span> <span class="n">date</span> <span class="o">=</span> <span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">();</span>
                <span class="n">model</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">BirthField</span><span class="p">,</span> <span class="n">date</span><span class="p">);</span>
	    <span class="p">});</span>

        <span class="cm">/*</span>
<span class="cm">	 * Children</span>
<span class="cm">	 */</span> 
	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">ChildrenField</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSpinBox</span><span class="p">());</span>

	<span class="cm">/*</span>
<span class="cm">	 * Remarks</span>
<span class="cm">	 */</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span> <span class="o">*</span><span class="n">remarksTA</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">();</span>
	<span class="n">remarksTA</span><span class="o">-&gt;</span><span class="n">setColumns</span><span class="p">(</span><span class="mi">40</span><span class="p">);</span>
	<span class="n">remarksTA</span><span class="o">-&gt;</span><span class="n">setRows</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>
	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">RemarksField</span><span class="p">,</span> <span class="n">remarksTA</span><span class="p">);</span>

	<span class="cm">/*</span>
<span class="cm">	 * Title &amp; Buttons</span>
<span class="cm">	 */</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">title</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Create new user&quot;</span><span class="p">);</span>
        <span class="n">bindString</span><span class="p">(</span><span class="s">&quot;title&quot;</span><span class="p">,</span> <span class="n">title</span><span class="p">);</span>

        <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">);</span>
        <span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;submit-button&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

        <span class="n">bindString</span><span class="p">(</span><span class="s">&quot;submit-info&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">());</span>

        <span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">UserFormView</span><span class="o">::</span><span class="n">process</span><span class="p">);</span>

        <span class="n">updateView</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">void</span> <span class="n">process</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">updateModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>

        <span class="k">if</span> <span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">())</span> <span class="p">{</span>
            <span class="c1">// Do something with the data in the model: show it.</span>
            <span class="n">bindString</span><span class="p">(</span><span class="s">&quot;submit-info&quot;</span><span class="p">,</span>
                       <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;Saved user data for &quot;</span><span class="p">)</span>
		       <span class="o">+</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">userData</span><span class="p">(),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">PlainText</span><span class="p">);</span>
            <span class="c1">// Udate the view: Delete any validation message in the view, etc.</span>
            <span class="n">updateView</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
            <span class="c1">// Set the focus on the first field in the form.</span>
            <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">viewField</span> <span class="o">=</span>
                    <span class="n">resolve</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="o">*&gt;</span><span class="p">(</span><span class="n">UserFormModel</span><span class="o">::</span><span class="n">FirstNameField</span><span class="p">);</span>
            <span class="n">viewField</span><span class="o">-&gt;</span><span class="n">setFocus</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="n">bindEmpty</span><span class="p">(</span><span class="s">&quot;submit-info&quot;</span><span class="p">);</span> <span class="c1">// Delete the previous user data.</span>
            <span class="n">updateView</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">}</span>

    <span class="n">UserFormModel</span> <span class="o">*</span><span class="n">model</span><span class="p">;</span>
<span class="p">};</span>


<span class="n">UserFormView</span> <span class="o">*</span><span class="n">view</span> <span class="o">=</span> <span class="k">new</span> <span class="n">UserFormView</span><span class="p">();</span>
</pre></div>
  </message>
  <message id="src-GitModel">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WAbstractItemModel&gt;</span>

<span class="cp">#include &quot;Git.h&quot;</span>

<span class="k">class</span> <span class="nc">GitModel</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="cm">/*</span>
<span class="cm">     * A custom role for the file contents of a Git BLOB object.</span>
<span class="cm">     */</span>
    <span class="k">static</span> <span class="k">const</span> <span class="kt">int</span> <span class="n">ContentsRole</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>

    <span class="n">GitModel</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">repository</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">WAbstractItemModel</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span> 
	<span class="n">git_</span><span class="p">.</span><span class="n">setRepositoryPath</span><span class="p">(</span><span class="n">repository</span><span class="p">);</span>
	<span class="n">loadRevision</span><span class="p">(</span><span class="s">&quot;master&quot;</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">loadRevision</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">revName</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Git</span><span class="o">::</span><span class="n">ObjectId</span> <span class="n">treeRoot</span> <span class="o">=</span> <span class="n">git_</span><span class="p">.</span><span class="n">getCommitTree</span><span class="p">(</span><span class="n">revName</span><span class="p">);</span>

	<span class="n">layoutAboutToBeChanged</span><span class="p">().</span><span class="n">emit</span><span class="p">();</span> <span class="c1">// Invalidates model indexes</span>

	<span class="n">treeData_</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
	<span class="n">childPointer_</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>

	<span class="cm">/*</span>
<span class="cm">	 * This stores the tree root as treeData_[0]</span>
<span class="cm">	 */</span>
	<span class="n">treeData_</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Tree</span><span class="p">(</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">treeRoot</span><span class="p">,</span> <span class="n">git_</span><span class="p">.</span><span class="n">treeSize</span><span class="p">(</span><span class="n">treeRoot</span><span class="p">)));</span>

	<span class="n">layoutChanged</span><span class="p">().</span><span class="n">emit</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="k">virtual</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span> <span class="n">parent</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">index</span><span class="p">.</span><span class="n">isValid</span><span class="p">()</span> <span class="o">||</span> <span class="n">index</span><span class="p">.</span><span class="n">internalId</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
	    <span class="k">return</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="p">();</span> <span class="c1">// treeData_[0] is the tree root</span>
	<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
	    <span class="k">const</span> <span class="n">Tree</span><span class="o">&amp;</span> <span class="n">item</span> <span class="o">=</span> <span class="n">treeData_</span><span class="p">[</span><span class="n">index</span><span class="p">.</span><span class="n">internalId</span><span class="p">()];</span>
	    <span class="k">return</span> <span class="nf">createIndex</span><span class="p">(</span><span class="n">item</span><span class="p">.</span><span class="n">index</span><span class="p">(),</span> <span class="mi">0</span><span class="p">,</span> <span class="n">item</span><span class="p">.</span><span class="n">parentId</span><span class="p">());</span>
	<span class="p">}</span>
    <span class="p">}</span>

    <span class="k">virtual</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span> <span class="n">index</span><span class="p">(</span><span class="kt">int</span> <span class="n">row</span><span class="p">,</span> <span class="kt">int</span> <span class="n">column</span><span class="p">,</span>
				  <span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">parent</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="p">())</span> <span class="k">const</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">parentId</span><span class="p">;</span>

	<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">parent</span><span class="p">.</span><span class="n">isValid</span><span class="p">())</span>
	    <span class="n">parentId</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
	<span class="k">else</span> <span class="p">{</span>
	    <span class="kt">int</span> <span class="n">grandParentId</span> <span class="o">=</span> <span class="n">parent</span><span class="p">.</span><span class="n">internalId</span><span class="p">();</span>
	    <span class="n">parentId</span> <span class="o">=</span> <span class="n">getTreeId</span><span class="p">(</span><span class="n">grandParentId</span><span class="p">,</span> <span class="n">parent</span><span class="p">.</span><span class="n">row</span><span class="p">());</span>
	<span class="p">}</span>

	<span class="k">return</span> <span class="n">createIndex</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">,</span> <span class="n">parentId</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="k">virtual</span> <span class="kt">int</span> <span class="n">columnCount</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">parent</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="p">())</span> <span class="k">const</span> <span class="p">{</span>
	<span class="k">return</span> <span class="mi">2</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="k">virtual</span> <span class="kt">int</span> <span class="n">rowCount</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">parent</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="p">())</span> <span class="k">const</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">treeId</span><span class="p">;</span>

	<span class="k">if</span> <span class="p">(</span><span class="n">parent</span><span class="p">.</span><span class="n">isValid</span><span class="p">())</span> <span class="p">{</span>
	    <span class="k">if</span> <span class="p">(</span><span class="n">parent</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">)</span>
		<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
	    <span class="n">Git</span><span class="o">::</span><span class="n">Object</span> <span class="n">o</span> <span class="o">=</span> <span class="n">getObject</span><span class="p">(</span><span class="n">parent</span><span class="p">);</span>
	    <span class="k">if</span> <span class="p">(</span><span class="n">o</span><span class="p">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">Git</span><span class="o">::</span><span class="n">Tree</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// is a folder</span>
		<span class="n">treeId</span> <span class="o">=</span> <span class="n">getTreeId</span><span class="p">(</span><span class="n">parent</span><span class="p">.</span><span class="n">internalId</span><span class="p">(),</span> <span class="n">parent</span><span class="p">.</span><span class="n">row</span><span class="p">());</span>
	    <span class="p">}</span> <span class="k">else</span>                     <span class="c1">// is a file</span>
		<span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
	<span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
	    <span class="n">treeId</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>
	<span class="p">}</span>

	<span class="k">return</span> <span class="n">treeData_</span><span class="p">[</span><span class="n">treeId</span><span class="p">].</span><span class="n">rowCount</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="k">virtual</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">data</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">,</span> <span class="kt">int</span> <span class="n">role</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">index</span><span class="p">.</span><span class="n">isValid</span><span class="p">())</span>
	    <span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>

	<span class="n">Git</span><span class="o">::</span><span class="n">Object</span> <span class="n">object</span> <span class="o">=</span> <span class="n">getObject</span><span class="p">(</span><span class="n">index</span><span class="p">);</span>

	<span class="k">switch</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">())</span> <span class="p">{</span>
	<span class="k">case</span> <span class="mi">0</span>:
	    <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">)</span> <span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="n">object</span><span class="p">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">Git</span><span class="o">::</span><span class="n">Tree</span><span class="p">)</span>
		    <span class="k">return</span> <span class="n">object</span><span class="p">.</span><span class="n">name</span> <span class="o">+</span> <span class="sc">&#39;/&#39;</span><span class="p">;</span>
		<span class="k">else</span>
		    <span class="k">return</span> <span class="n">object</span><span class="p">.</span><span class="n">name</span><span class="p">;</span>
	    <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DecorationRole</span><span class="p">)</span> <span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="n">object</span><span class="p">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">Git</span><span class="o">::</span><span class="n">Blob</span><span class="p">)</span>
		    <span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;icons/git-blob.png&quot;</span><span class="p">);</span>
		<span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">object</span><span class="p">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">Git</span><span class="o">::</span><span class="n">Tree</span><span class="p">)</span>
		    <span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;icons/git-tree.png&quot;</span><span class="p">);</span>
	    <span class="p">}</span> <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">==</span> <span class="n">ContentsRole</span><span class="p">)</span> <span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="n">object</span><span class="p">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">Git</span><span class="o">::</span><span class="n">Blob</span><span class="p">)</span>
		    <span class="k">return</span> <span class="n">git_</span><span class="p">.</span><span class="n">catFile</span><span class="p">(</span><span class="n">object</span><span class="p">.</span><span class="n">id</span><span class="p">);</span>
	    <span class="p">}</span>

	    <span class="k">break</span><span class="p">;</span>
	<span class="k">case</span> <span class="mi">1</span>:
	    <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">)</span> <span class="p">{</span>
		<span class="k">if</span> <span class="p">(</span><span class="n">object</span><span class="p">.</span><span class="n">type</span> <span class="o">==</span> <span class="n">Git</span><span class="o">::</span><span class="n">Tree</span><span class="p">)</span>
		    <span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;Folder&quot;</span><span class="p">);</span>
		<span class="k">else</span> <span class="p">{</span>
		    <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">suffix</span> <span class="o">=</span> <span class="n">getSuffix</span><span class="p">(</span><span class="n">object</span><span class="p">.</span><span class="n">name</span><span class="p">);</span>

		    <span class="k">if</span> <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;C&quot;</span> <span class="o">||</span> <span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;cpp&quot;</span><span class="p">)</span>
			<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;C++ Source&quot;</span><span class="p">);</span>
		    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;h&quot;</span> <span class="o">||</span> 
			     <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;&quot;</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="n">topLevel</span><span class="p">(</span><span class="n">index</span><span class="p">)))</span>
			<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;C++ Header&quot;</span><span class="p">);</span>
		    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;css&quot;</span><span class="p">)</span>
			<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;CSS Stylesheet&quot;</span><span class="p">);</span>
		    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;js&quot;</span><span class="p">)</span>
			<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;JavaScript Source&quot;</span><span class="p">);</span>
		    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;md&quot;</span><span class="p">)</span>
			<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;Markdown&quot;</span><span class="p">);</span>
		    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;png&quot;</span> <span class="o">||</span> <span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;gif&quot;</span><span class="p">)</span>
			<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;Image&quot;</span><span class="p">);</span>
		    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">suffix</span> <span class="o">==</span> <span class="s">&quot;txt&quot;</span><span class="p">)</span>
			<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;Text&quot;</span><span class="p">);</span>
		    <span class="k">else</span>
			<span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
		<span class="p">}</span>
	    <span class="p">}</span>
	<span class="p">}</span>

	<span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
    <span class="p">}</span>
  
    <span class="k">virtual</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">headerData</span><span class="p">(</span><span class="kt">int</span> <span class="n">section</span><span class="p">,</span>
				  <span class="n">Wt</span><span class="o">::</span><span class="n">Orientation</span> <span class="n">orientation</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Horizontal</span><span class="p">,</span>
				  <span class="kt">int</span> <span class="n">role</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">orientation</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Horizontal</span> <span class="o">&amp;&amp;</span> <span class="n">role</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">)</span> <span class="p">{</span>
	    <span class="k">switch</span> <span class="p">(</span><span class="n">section</span><span class="p">)</span> <span class="p">{</span>
	    <span class="k">case</span> <span class="mi">0</span>:
		<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;File&quot;</span><span class="p">);</span>
	    <span class="k">case</span> <span class="mi">1</span>:
		<span class="k">return</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">(</span><span class="s">&quot;Type&quot;</span><span class="p">);</span>
	    <span class="nl">default:</span>
		<span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
	    <span class="p">}</span>
	<span class="p">}</span> <span class="k">else</span>
	    <span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="n">Git</span> <span class="n">git_</span><span class="p">;</span>

    <span class="cm">/*</span>
<span class="cm">     * Identifies a folder given parent and index</span>
<span class="cm">     */</span>
    <span class="k">struct</span> <span class="n">ChildIndex</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">parentId</span><span class="p">;</span>
	<span class="kt">int</span> <span class="n">index</span><span class="p">;</span>

	<span class="n">ChildIndex</span><span class="p">(</span><span class="kt">int</span> <span class="n">aParent</span><span class="p">,</span> <span class="kt">int</span> <span class="n">anIndex</span><span class="p">)</span>
	    <span class="o">:</span> <span class="n">parentId</span><span class="p">(</span><span class="n">aParent</span><span class="p">),</span> <span class="n">index</span><span class="p">(</span><span class="n">anIndex</span><span class="p">)</span> <span class="p">{</span> <span class="p">}</span>

	<span class="kt">bool</span> <span class="k">operator</span><span class="o">&lt;</span> <span class="p">(</span><span class="k">const</span> <span class="n">ChildIndex</span><span class="o">&amp;</span> <span class="n">other</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span>
	    <span class="k">if</span> <span class="p">(</span><span class="n">parentId</span> <span class="o">&lt;</span> <span class="n">other</span><span class="p">.</span><span class="n">parentId</span><span class="p">)</span>
		<span class="k">return</span> <span class="nb">true</span><span class="p">;</span>
	    <span class="k">else</span> <span class="k">if</span> <span class="p">(</span><span class="n">parentId</span> <span class="o">&gt;</span> <span class="n">other</span><span class="p">.</span><span class="n">parentId</span><span class="p">)</span>
		<span class="k">return</span> <span class="nb">false</span><span class="p">;</span>
	    <span class="k">else</span> <span class="k">return</span> <span class="n">index</span> <span class="o">&lt;</span> <span class="n">other</span><span class="p">.</span><span class="n">index</span><span class="p">;</span>
	<span class="p">}</span>

        <span class="kt">bool</span> <span class="n">equals</span><span class="p">(</span><span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">o</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">ChildIndex</span> <span class="o">*</span><span class="n">other</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">any_cast</span><span class="o">&lt;</span><span class="n">ChildIndex</span> <span class="o">*&gt;</span><span class="p">(</span><span class="n">o</span><span class="p">);</span>
	    <span class="k">return</span> <span class="n">parentId</span> <span class="o">==</span> <span class="n">other</span><span class="o">-&gt;</span><span class="n">parentId</span> <span class="o">&amp;&amp;</span>
	        <span class="n">index</span> <span class="o">==</span> <span class="n">other</span><span class="o">-&gt;</span><span class="n">index</span><span class="p">;</span>
	<span class="p">}</span>

        <span class="kt">int</span> <span class="n">hashCode</span><span class="p">()</span> <span class="p">{</span>
	    <span class="kt">int</span> <span class="n">hash</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span>
	    <span class="n">hash</span> <span class="o">=</span> <span class="n">hash</span> <span class="o">*</span> <span class="mi">31</span> <span class="o">+</span> <span class="n">parentId</span><span class="p">;</span>
	    <span class="n">hash</span> <span class="o">=</span> <span class="n">hash</span> <span class="o">*</span> <span class="mi">31</span> <span class="o">+</span> <span class="n">index</span><span class="p">;</span>
	    <span class="k">return</span> <span class="n">hash</span><span class="p">;</span>
	<span class="p">}</span>
    <span class="p">};</span>

    <span class="cm">/*</span>
<span class="cm">     * Data to be stored for an (expanded) folder</span>
<span class="cm">     */</span>
    <span class="k">class</span> <span class="nc">Tree</span> <span class="p">{</span>
    <span class="nl">public:</span>
	<span class="n">Tree</span><span class="p">(</span><span class="kt">int</span> <span class="n">parentId</span><span class="p">,</span> <span class="kt">int</span> <span class="n">index</span><span class="p">,</span> <span class="k">const</span> <span class="n">Git</span><span class="o">::</span><span class="n">ObjectId</span><span class="o">&amp;</span> <span class="n">object</span><span class="p">,</span> <span class="kt">int</span> <span class="n">rowCount</span><span class="p">)</span>
	    <span class="o">:</span> <span class="n">index_</span><span class="p">(</span><span class="n">parentId</span><span class="p">,</span> <span class="n">index</span><span class="p">),</span>
	      <span class="n">treeObject_</span><span class="p">(</span><span class="n">object</span><span class="p">),</span>
	      <span class="n">rowCount_</span><span class="p">(</span><span class="n">rowCount</span><span class="p">)</span>
	<span class="p">{</span> <span class="p">}</span>

	<span class="kt">int</span> <span class="n">parentId</span><span class="p">()</span> <span class="k">const</span> <span class="p">{</span> <span class="k">return</span> <span class="n">index_</span><span class="p">.</span><span class="n">parentId</span><span class="p">;</span> <span class="p">}</span>
	<span class="kt">int</span> <span class="n">index</span><span class="p">()</span> <span class="k">const</span> <span class="p">{</span> <span class="k">return</span> <span class="n">index_</span><span class="p">.</span><span class="n">index</span><span class="p">;</span> <span class="p">}</span>
	<span class="k">const</span> <span class="n">Git</span><span class="o">::</span><span class="n">ObjectId</span><span class="o">&amp;</span> <span class="n">treeObject</span><span class="p">()</span> <span class="k">const</span> <span class="p">{</span> <span class="k">return</span> <span class="n">treeObject_</span><span class="p">;</span> <span class="p">}</span>
	<span class="kt">int</span> <span class="n">rowCount</span><span class="p">()</span> <span class="k">const</span> <span class="p">{</span> <span class="k">return</span> <span class="n">rowCount_</span><span class="p">;</span> <span class="p">}</span>

    <span class="nl">private:</span>
	<span class="n">ChildIndex</span>    <span class="n">index_</span><span class="p">;</span>
	<span class="n">Git</span><span class="o">::</span><span class="n">ObjectId</span> <span class="n">treeObject_</span><span class="p">;</span>
	<span class="kt">int</span>           <span class="n">rowCount_</span><span class="p">;</span>
    <span class="p">};</span>

    <span class="k">typedef</span> <span class="n">std</span><span class="o">::</span><span class="n">map</span><span class="o">&lt;</span><span class="n">ChildIndex</span><span class="p">,</span> <span class="kt">int</span><span class="o">&gt;</span> <span class="n">ChildPointerMap</span><span class="p">;</span>

    <span class="cm">/*</span>
<span class="cm">     * Expanded folder data</span>
<span class="cm">     */</span>
    <span class="k">mutable</span> <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Tree</span><span class="o">&gt;</span> <span class="n">treeData_</span><span class="p">;</span>

    <span class="cm">/*</span>
<span class="cm">     * Indexes into treeData_</span>
<span class="cm">     */</span>
    <span class="k">mutable</span> <span class="n">ChildPointerMap</span> <span class="n">childPointer_</span><span class="p">;</span>

    <span class="cm">/*</span>
<span class="cm">     * Gets or allocates an id for a folder.</span>
<span class="cm">     */</span>
    <span class="kt">int</span> <span class="nf">getTreeId</span><span class="p">(</span><span class="kt">int</span> <span class="n">parentId</span><span class="p">,</span> <span class="kt">int</span> <span class="n">childIndex</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span>
	<span class="n">ChildIndex</span> <span class="n">index</span><span class="p">(</span><span class="n">parentId</span><span class="p">,</span> <span class="n">childIndex</span><span class="p">);</span>

	<span class="n">ChildPointerMap</span><span class="o">::</span><span class="n">const_iterator</span> <span class="n">i</span> <span class="o">=</span> <span class="n">childPointer_</span><span class="p">.</span><span class="n">find</span><span class="p">(</span><span class="n">index</span><span class="p">);</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">i</span> <span class="o">==</span> <span class="n">childPointer_</span><span class="p">.</span><span class="n">end</span><span class="p">())</span> <span class="p">{</span>
	    <span class="k">const</span> <span class="n">Tree</span><span class="o">&amp;</span> <span class="n">parentItem</span> <span class="o">=</span> <span class="n">treeData_</span><span class="p">[</span><span class="n">parentId</span><span class="p">];</span>
	    <span class="n">Git</span><span class="o">::</span><span class="n">Object</span> <span class="n">o</span> <span class="o">=</span> <span class="n">git_</span><span class="p">.</span><span class="n">treeGetObject</span><span class="p">(</span><span class="n">parentItem</span><span class="p">.</span><span class="n">treeObject</span><span class="p">(),</span> <span class="n">childIndex</span><span class="p">);</span>
 
	    <span class="n">treeData_</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Tree</span><span class="p">(</span><span class="n">parentId</span><span class="p">,</span> <span class="n">childIndex</span><span class="p">,</span> <span class="n">o</span><span class="p">.</span><span class="n">id</span><span class="p">,</span>
				     <span class="n">git_</span><span class="p">.</span><span class="n">treeSize</span><span class="p">(</span><span class="n">o</span><span class="p">.</span><span class="n">id</span><span class="p">)));</span>
	    <span class="kt">int</span> <span class="n">result</span> <span class="o">=</span> <span class="n">treeData_</span><span class="p">.</span><span class="n">size</span><span class="p">()</span> <span class="o">-</span> <span class="mi">1</span><span class="p">;</span>
	    <span class="n">childPointer_</span><span class="p">[</span><span class="n">index</span><span class="p">]</span> <span class="o">=</span> <span class="n">result</span><span class="p">;</span>
	    <span class="k">return</span> <span class="n">result</span><span class="p">;</span>
	<span class="p">}</span> <span class="k">else</span>
	    <span class="k">return</span> <span class="n">i</span><span class="o">-&gt;</span><span class="n">second</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="cm">/*</span>
<span class="cm">     * Gets the Git::Object that corresponds to an index.</span>
<span class="cm">     */</span>
    <span class="n">Git</span><span class="o">::</span><span class="n">Object</span> <span class="n">getObject</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">parentId</span> <span class="o">=</span> <span class="n">index</span><span class="p">.</span><span class="n">internalId</span><span class="p">();</span>
	<span class="k">const</span> <span class="n">Tree</span><span class="o">&amp;</span> <span class="n">parentItem</span> <span class="o">=</span> <span class="n">treeData_</span><span class="p">[</span><span class="n">parentId</span><span class="p">];</span>
	<span class="k">return</span> <span class="n">git_</span><span class="p">.</span><span class="n">treeGetObject</span><span class="p">(</span><span class="n">parentItem</span><span class="p">.</span><span class="n">treeObject</span><span class="p">(),</span> <span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">());</span>
    <span class="p">}</span>

    <span class="k">static</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">getSuffix</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">fileName</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="kt">size_t</span> <span class="n">dot</span> <span class="o">=</span> <span class="n">fileName</span><span class="p">.</span><span class="n">rfind</span><span class="p">(</span><span class="sc">&#39;.&#39;</span><span class="p">);</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">dot</span> <span class="o">==</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">::</span><span class="n">npos</span><span class="p">)</span>
	    <span class="k">return</span> <span class="s">&quot;&quot;</span><span class="p">;</span>
	<span class="k">else</span>
	    <span class="k">return</span> <span class="n">fileName</span><span class="p">.</span><span class="n">substr</span><span class="p">(</span><span class="n">dot</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="kt">bool</span> <span class="n">topLevel</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">)</span> <span class="k">const</span> <span class="p">{</span>
	<span class="k">return</span> <span class="o">!</span><span class="n">parent</span><span class="p">(</span><span class="n">index</span><span class="p">).</span><span class="n">isValid</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">};</span>
</pre></div>
  </message>
  <message id="src-GoogleMap">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCheckBox&gt;</span>
<span class="cp">#include &lt;Wt/WComboBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WHBoxLayout&gt;</span>
<span class="cp">#include &lt;Wt/WGoogleMap&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WStringListModel&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="k">class</span> <span class="nc">GoogleMapExample</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">GoogleMapExample</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span> <span class="o">*</span><span class="n">layout</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span><span class="p">();</span>
	<span class="n">setLayout</span><span class="p">(</span><span class="n">layout</span><span class="p">);</span>

	<span class="n">setHeight</span><span class="p">(</span><span class="mi">400</span><span class="p">);</span>

	<span class="n">map_</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Version3</span><span class="p">);</span>
	<span class="n">layout</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">map_</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>

	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">setMapTypeControl</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">DefaultControl</span><span class="p">);</span>
	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">enableScrollWheelZoom</span><span class="p">();</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">controls</span> <span class="o">=</span>
	    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;graphics-GoogleMap-controls&quot;</span><span class="p">));</span>
	<span class="n">layout</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">controls</span><span class="p">);</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">zoomIn</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;+&quot;</span><span class="p">);</span>
	<span class="n">zoomIn</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;zoom&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;zoom-in&quot;</span><span class="p">,</span> <span class="n">zoomIn</span><span class="p">);</span>

	<span class="n">zoomIn</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	    <span class="n">map_</span><span class="o">-&gt;</span><span class="n">zoomIn</span><span class="p">();</span>
	<span class="p">}));</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">zoomOut</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;-&quot;</span><span class="p">);</span>
	<span class="n">zoomOut</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;zoom&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;zoom-out&quot;</span><span class="p">,</span> <span class="n">zoomOut</span><span class="p">);</span>

	<span class="n">zoomOut</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">zoomOut</span><span class="p">();</span>
	<span class="p">}));</span>

	<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">cityNames</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span> <span class="s">&quot;Brussels&quot;</span><span class="p">,</span> <span class="s">&quot;Lisbon&quot;</span><span class="p">,</span> <span class="s">&quot;Paris&quot;</span> <span class="p">};</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span> <span class="n">cityCoords</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.85034</span><span class="p">,</span><span class="mf">4.35171</span><span class="p">),</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">38.703731</span><span class="p">,</span><span class="o">-</span><span class="mf">9.135475</span><span class="p">),</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">48.877474</span><span class="p">,</span> <span class="mf">2.312579</span><span class="p">)</span>
	<span class="p">};</span>
	    
	<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">city</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="n">cityNames</span><span class="p">[</span><span class="n">i</span><span class="p">]);</span>
	    <span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="n">cityNames</span><span class="p">[</span><span class="n">i</span><span class="p">],</span> <span class="n">city</span><span class="p">);</span>

            <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span> <span class="n">coord</span> <span class="o">=</span> <span class="n">cityCoords</span><span class="p">[</span><span class="n">i</span><span class="p">];</span>
	    <span class="n">city</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
		<span class="n">map_</span><span class="o">-&gt;</span><span class="n">panTo</span><span class="p">(</span><span class="n">coord</span><span class="p">);</span>
	    <span class="p">}));</span>
	<span class="p">}</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">reset</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Reset&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;emweb&quot;</span><span class="p">,</span> <span class="n">reset</span><span class="p">);</span>

	<span class="n">reset</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="k">this</span><span class="o">-&gt;</span><span class="n">panToEmWeb</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">savePosition</span> <span class="o">=</span>
	    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save current position&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;save-position&quot;</span><span class="p">,</span> <span class="n">savePosition</span><span class="p">);</span>

	<span class="n">savePosition</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="k">this</span><span class="o">-&gt;</span><span class="n">savePosition</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">returnToPosition_</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Return to saved position&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;return-to-saved-position&quot;</span><span class="p">,</span> <span class="n">returnToPosition_</span><span class="p">);</span>
	<span class="n">returnToPosition_</span><span class="o">-&gt;</span><span class="n">setEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>

	<span class="n">returnToPosition_</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">returnToSavedPosition</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">mapTypeModel_</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStringListModel</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>
	<span class="n">addMapTypeControl</span><span class="p">(</span><span class="s">&quot;No control&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">NoControl</span><span class="p">);</span>
	<span class="n">addMapTypeControl</span><span class="p">(</span><span class="s">&quot;Default&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">DefaultControl</span><span class="p">);</span>
	<span class="n">addMapTypeControl</span><span class="p">(</span><span class="s">&quot;Menu&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">MenuControl</span><span class="p">);</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">map_</span><span class="o">-&gt;</span><span class="n">apiVersion</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Version2</span><span class="p">)</span>
	    <span class="n">addMapTypeControl</span><span class="p">(</span><span class="s">&quot;Hierarchical&quot;</span><span class="p">,</span>
			      <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">HierarchicalControl</span><span class="p">);</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">map_</span><span class="o">-&gt;</span><span class="n">apiVersion</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Version3</span><span class="p">)</span>
	    <span class="n">addMapTypeControl</span><span class="p">(</span><span class="s">&quot;Horizontal bar&quot;</span><span class="p">,</span>
			      <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">HorizontalBarControl</span><span class="p">);</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="o">*</span> <span class="n">menuControls</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">();</span>
	<span class="n">menuControls</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">mapTypeModel_</span><span class="p">);</span>
	<span class="n">menuControls</span><span class="o">-&gt;</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;control-menu-combo&quot;</span><span class="p">,</span> <span class="n">menuControls</span><span class="p">);</span>

	<span class="n">menuControls</span><span class="o">-&gt;</span><span class="n">activated</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="kt">int</span> <span class="n">mapType</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="o">-&gt;</span><span class="n">setMapTypeControl</span><span class="p">(</span><span class="n">mapType</span><span class="p">);</span>
        <span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span> <span class="o">*</span><span class="n">draggingCB</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Enable dragging&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;dragging-cb&quot;</span><span class="p">,</span> <span class="n">draggingCB</span><span class="p">);</span>
	<span class="n">draggingCB</span><span class="o">-&gt;</span><span class="n">setChecked</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">enableDragging</span><span class="p">();</span>

	<span class="n">draggingCB</span><span class="o">-&gt;</span><span class="n">checked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">enableDragging</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">draggingCB</span><span class="o">-&gt;</span><span class="n">unChecked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">disableDragging</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span> <span class="o">*</span><span class="n">enableDoubleClickZoomCB</span> <span class="o">=</span>
            <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Enable double click zoom&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;double-click-zoom-cb&quot;</span><span class="p">,</span> <span class="n">enableDoubleClickZoomCB</span><span class="p">);</span>
	<span class="n">enableDoubleClickZoomCB</span><span class="o">-&gt;</span><span class="n">setChecked</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">disableDoubleClickZoom</span><span class="p">();</span>

	<span class="n">enableDoubleClickZoomCB</span><span class="o">-&gt;</span><span class="n">checked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">enableDoubleClickZoom</span><span class="p">();</span>
	<span class="p">}));</span>

	<span class="n">enableDoubleClickZoomCB</span><span class="o">-&gt;</span><span class="n">unChecked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">disableDoubleClickZoom</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span> <span class="o">*</span><span class="n">enableScrollWheelZoomCB</span> <span class="o">=</span>
            <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="s">&quot;Enable scroll wheel zoom&quot;</span><span class="p">);</span>
	<span class="n">controls</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;scroll-wheel-zoom-cb&quot;</span><span class="p">,</span> <span class="n">enableScrollWheelZoomCB</span><span class="p">);</span>
	<span class="n">enableScrollWheelZoomCB</span><span class="o">-&gt;</span><span class="n">setChecked</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">enableScrollWheelZoom</span><span class="p">();</span>

	<span class="n">enableScrollWheelZoomCB</span><span class="o">-&gt;</span><span class="n">checked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">enableScrollWheelZoom</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">enableScrollWheelZoomCB</span><span class="o">-&gt;</span><span class="n">unChecked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
            <span class="n">map_</span><span class="o">-&gt;</span><span class="n">disableScrollWheelZoom</span><span class="p">();</span>
        <span class="p">}));</span>

	<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="o">&gt;</span> <span class="n">road</span> <span class="o">=</span> <span class="n">roadDescription</span><span class="p">();</span>

	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">addPolyline</span><span class="p">(</span><span class="n">road</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">191</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>

	<span class="c1">//Koen&#39;s favourite bar!</span>
	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">addMarker</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.885069</span><span class="p">,</span><span class="mf">4.71958</span><span class="p">));</span>

	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">setCenter</span><span class="p">(</span><span class="n">road</span><span class="p">[</span><span class="n">road</span><span class="p">.</span><span class="n">size</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">]);</span>

	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">openInfoWindow</span><span class="p">(</span><span class="n">road</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span>
           <span class="s">&quot;&lt;img src=</span><span class="se">\&quot;</span><span class="s">http://www.emweb.be/css/emweb_small.jpg</span><span class="se">\&quot;</span><span class="s"> /&gt;&quot;</span>
           <span class="s">&quot;&lt;p&gt;&lt;strong&gt;Emweb office&lt;/strong&gt;&lt;/p&gt;&quot;</span><span class="p">);</span>

	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span> <span class="n">c</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="o">-&gt;</span><span class="n">googleMapClicked</span><span class="p">(</span><span class="n">c</span><span class="p">);</span>
        <span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>

	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">doubleClicked</span><span class="p">().</span><span class="n">connect</span>
	    <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span> <span class="n">c</span><span class="p">)</span> <span class="p">{</span>
            <span class="k">this</span><span class="o">-&gt;</span><span class="n">googleMapDoubleClicked</span><span class="p">(</span><span class="n">c</span><span class="p">);</span>
        <span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">void</span> <span class="n">panToEmWeb</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">map_</span><span class="o">-&gt;</span><span class="n">panTo</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.9082</span><span class="p">,</span> <span class="mf">4.66056</span><span class="p">));</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">savePosition</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">returnToPosition_</span><span class="o">-&gt;</span><span class="n">setEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="n">map_</span><span class="o">-&gt;</span><span class="n">savePosition</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">addMapTypeControl</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="o">&amp;</span><span class="n">description</span><span class="p">,</span>
			   <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">MapTypeControl</span> <span class="n">value</span><span class="p">)</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">r</span> <span class="o">=</span> <span class="n">mapTypeModel_</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span>
	<span class="n">mapTypeModel_</span><span class="o">-&gt;</span><span class="n">insertRow</span><span class="p">(</span><span class="n">r</span><span class="p">);</span>
	<span class="n">mapTypeModel_</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">description</span><span class="p">);</span>
	<span class="n">mapTypeModel_</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">r</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">value</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">setMapTypeControl</span><span class="p">(</span><span class="kt">int</span> <span class="n">row</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">mtc</span> <span class="o">=</span> <span class="n">mapTypeModel_</span><span class="o">-&gt;</span><span class="n">data</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">);</span>
	<span class="n">map_</span><span class="o">-&gt;</span><span class="n">setMapTypeControl</span><span class="p">(</span><span class="n">boost</span><span class="o">::</span><span class="n">any_cast</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">MapTypeControl</span><span class="o">&gt;</span>
				<span class="p">(</span><span class="n">mtc</span><span class="p">));</span>
    <span class="p">}</span>
    
    <span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="o">&gt;</span> <span class="n">roadDescription</span><span class="p">()</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="o">&gt;</span> <span class="n">result</span><span class="p">;</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.9082</span><span class="p">,</span> <span class="mf">4.66056</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90901</span><span class="p">,</span> <span class="mf">4.66426</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90944</span><span class="p">,</span> <span class="mf">4.66514</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90968</span><span class="p">,</span> <span class="mf">4.66574</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91021</span><span class="p">,</span> <span class="mf">4.66541</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.9111</span><span class="p">,</span> <span class="mf">4.66508</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.9119</span><span class="p">,</span> <span class="mf">4.66469</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91224</span><span class="p">,</span> <span class="mf">4.66463</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91227</span><span class="p">,</span> <span class="mf">4.66598</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.9122</span><span class="p">,</span> <span class="mf">4.66786</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91199</span><span class="p">,</span> <span class="mf">4.66962</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91169</span><span class="p">,</span> <span class="mf">4.67117</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91107</span><span class="p">,</span> <span class="mf">4.67365</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91061</span><span class="p">,</span> <span class="mf">4.67515</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.91023</span><span class="p">,</span> <span class="mf">4.67596</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.9098</span><span class="p">,</span> <span class="mf">4.67666</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90953</span><span class="p">,</span> <span class="mf">4.67691</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90912</span><span class="p">,</span> <span class="mf">4.67746</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90882</span><span class="p">,</span> <span class="mf">4.67772</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90838</span><span class="p">,</span> <span class="mf">4.67801</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.9083</span><span class="p">,</span> <span class="mf">4.67798</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90803</span><span class="p">,</span> <span class="mf">4.67814</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90742</span><span class="p">,</span> <span class="mf">4.67836</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90681</span><span class="p">,</span> <span class="mf">4.67845</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90209</span><span class="p">,</span> <span class="mf">4.67871</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90134</span><span class="p">,</span> <span class="mf">4.67893</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90066</span><span class="p">,</span> <span class="mf">4.6793</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.90015</span><span class="p">,</span> <span class="mf">4.67972</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.89945</span><span class="p">,</span> <span class="mf">4.68059</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.89613</span><span class="p">,</span> <span class="mf">4.68582</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.8952</span><span class="p">,</span> <span class="mf">4.68719</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.89464</span><span class="p">,</span> <span class="mf">4.68764</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.89183</span><span class="p">,</span> <span class="mf">4.69032</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.89131</span><span class="p">,</span> <span class="mf">4.69076</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88916</span><span class="p">,</span> <span class="mf">4.69189</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88897</span><span class="p">,</span> <span class="mf">4.69195</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88859</span><span class="p">,</span> <span class="mf">4.69195</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88813</span><span class="p">,</span> <span class="mf">4.69193</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88697</span><span class="p">,</span> <span class="mf">4.69135</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88669</span><span class="p">,</span> <span class="mf">4.6913</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88531</span><span class="p">,</span> <span class="mf">4.69155</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88425</span><span class="p">,</span> <span class="mf">4.69196</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88398</span><span class="p">,</span> <span class="mf">4.69219</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88391</span><span class="p">,</span> <span class="mf">4.69226</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88356</span><span class="p">,</span> <span class="mf">4.69292</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88323</span><span class="p">,</span> <span class="mf">4.69361</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88067</span><span class="p">,</span> <span class="mf">4.6934</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88055</span><span class="p">,</span> <span class="mf">4.69491</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88036</span><span class="p">,</span> <span class="mf">4.69616</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.88009</span><span class="p">,</span> <span class="mf">4.69755</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87973</span><span class="p">,</span> <span class="mf">4.69877</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87951</span><span class="p">,</span> <span class="mf">4.69856</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87933</span><span class="p">,</span> <span class="mf">4.69831</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87905</span><span class="p">,</span> <span class="mf">4.69811</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.879</span><span class="p">,</span> <span class="mf">4.69793</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87856</span><span class="p">,</span> <span class="mf">4.69745</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87849</span><span class="p">,</span> <span class="mf">4.69746</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87843</span><span class="p">,</span> <span class="mf">4.69758</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87822</span><span class="p">,</span> <span class="mf">4.69758</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87814</span><span class="p">,</span> <span class="mf">4.69766</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87813</span><span class="p">,</span> <span class="mf">4.69788</span><span class="p">));</span>
	<span class="n">result</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span><span class="p">(</span><span class="mf">50.87789</span><span class="p">,</span> <span class="mf">4.69862</span><span class="p">));</span>
	
	<span class="k">return</span> <span class="n">result</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">googleMapDoubleClicked</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span> <span class="n">c</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Double clicked at coordinate (&quot;</span>
		  <span class="o">&lt;&lt;</span> <span class="n">c</span><span class="p">.</span><span class="n">latitude</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;,&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">c</span><span class="p">.</span><span class="n">longitude</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;)&quot;</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">googleMapClicked</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span><span class="o">::</span><span class="n">Coordinate</span> <span class="n">c</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="n">cerr</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;Clicked at coordinate (&quot;</span>
		  <span class="o">&lt;&lt;</span> <span class="n">c</span><span class="p">.</span><span class="n">latitude</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;,&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">c</span><span class="p">.</span><span class="n">longitude</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;)&quot;</span><span class="p">;</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WGoogleMap</span> <span class="o">*</span><span class="n">map_</span><span class="p">;</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span> <span class="o">*</span><span class="n">mapTypeModel_</span><span class="p">;</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">returnToPosition_</span><span class="p">;</span>
<span class="p">};</span>

<span class="n">GoogleMapExample</span> <span class="o">*</span><span class="n">map</span> <span class="o">=</span> <span class="k">new</span> <span class="n">GoogleMapExample</span><span class="p">();</span>
</pre></div>
  </message>
  <message id="src-GridLayout">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WGridLayout&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setHeight</span><span class="p">(</span><span class="mi">400</span><span class="p">);</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WGridLayout</span> <span class="o">*</span><span class="n">grid</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGridLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">grid</span><span class="p">);</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">row</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="o">++</span><span class="n">row</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">column</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">column</span> <span class="o">&lt;</span> <span class="mi">4</span><span class="p">;</span> <span class="o">++</span><span class="n">column</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">cell</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Item ({1}, {2})&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">row</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">column</span><span class="p">);</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">t</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">cell</span><span class="p">);</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">row</span> <span class="o">==</span> <span class="mi">1</span> <span class="o">||</span> <span class="n">column</span> <span class="o">==</span> <span class="mi">1</span> <span class="o">||</span> <span class="n">column</span> <span class="o">==</span> <span class="mi">2</span><span class="p">)</span>
	    <span class="n">t</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;blue-box&quot;</span><span class="p">);</span>
	<span class="k">else</span>
	    <span class="n">t</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>

	<span class="n">grid</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">t</span><span class="p">,</span> <span class="n">row</span><span class="p">,</span> <span class="n">column</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="n">grid</span><span class="o">-&gt;</span><span class="n">setRowStretch</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
<span class="n">grid</span><span class="o">-&gt;</span><span class="n">setColumnStretch</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
<span class="n">grid</span><span class="o">-&gt;</span><span class="n">setColumnStretch</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-GroupBox">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WGroupBox&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WGroupBox</span> <span class="o">*</span><span class="n">groupBox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGroupBox</span><span class="p">(</span><span class="s">&quot;A group box&quot;</span><span class="p">);</span>
<span class="n">groupBox</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;centered-example&quot;</span><span class="p">);</span>
<span class="n">groupBox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Some contents.&lt;/p&gt;&quot;</span><span class="p">));</span>
<span class="n">groupBox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;More contents.&lt;/p&gt;&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-HBoxLayout">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WHBoxLayout&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span> <span class="o">*</span><span class="n">hbox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">hbox</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 1&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">hbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
  
<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 2&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;blue-box&quot;</span><span class="p">);</span>
<span class="n">hbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-HBoxLayoutStretch">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WHBoxLayout&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span> <span class="o">*</span><span class="n">hbox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">hbox</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 1&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">hbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
  
<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 2&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;blue-box&quot;</span><span class="p">);</span>
<span class="n">hbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Image">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span> <span class="o">*</span><span class="n">image</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;icons/wt_powered.jpg&quot;</span><span class="p">),</span>
                                   <span class="n">container</span><span class="p">);</span>
<span class="n">image</span><span class="o">-&gt;</span><span class="n">setAlternateText</span><span class="p">(</span><span class="s">&quot;Wt logo&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span><span class="p">);</span>

<span class="n">image</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMouseEvent</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You clicked the Wt logo at &quot;</span>
		 <span class="s">&quot;(&quot;</span> <span class="o">+</span> <span class="n">boost</span><span class="o">::</span><span class="n">lexical_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">widget</span><span class="p">().</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span>
		 <span class="s">&quot;,&quot;</span> <span class="o">+</span> <span class="n">boost</span><span class="o">::</span><span class="n">lexical_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">widget</span><span class="p">().</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span>
		 <span class="s">&quot;).&quot;</span><span class="p">);</span>
<span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-ImageArea">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WCircleArea&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/WPolygonArea&gt;</span>
<span class="cp">#include &lt;Wt/WRectArea&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span> <span class="o">*</span><span class="n">image</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;pics/sintel_trailer.jpg&quot;</span><span class="p">),</span>
				   <span class="n">container</span><span class="p">);</span>
<span class="n">image</span><span class="o">-&gt;</span><span class="n">setAlternateText</span><span class="p">(</span><span class="s">&quot;Sintel trailer&quot;</span><span class="p">);</span>

<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WCircleArea</span> <span class="o">*</span><span class="n">circle</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCircleArea</span><span class="p">(</span><span class="mi">427</span><span class="p">,</span> <span class="mi">149</span><span class="p">,</span> <span class="mi">58</span><span class="p">);</span>
<span class="n">circle</span><span class="o">-&gt;</span><span class="n">setToolTip</span><span class="p">(</span><span class="s">&quot;tree&quot;</span><span class="p">);</span>
<span class="n">circle</span><span class="o">-&gt;</span><span class="n">setCursor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">CrossCursor</span><span class="p">);</span>
<span class="n">image</span><span class="o">-&gt;</span><span class="n">addArea</span><span class="p">(</span><span class="n">circle</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WRectArea</span> <span class="o">*</span><span class="n">rect</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRectArea</span><span class="p">(</span><span class="mi">294</span><span class="p">,</span> <span class="mi">226</span><span class="p">,</span> <span class="mi">265</span><span class="p">,</span> <span class="mi">41</span><span class="p">);</span>
<span class="n">rect</span><span class="o">-&gt;</span><span class="n">setToolTip</span><span class="p">(</span><span class="s">&quot;title&quot;</span><span class="p">);</span>
<span class="n">rect</span><span class="o">-&gt;</span><span class="n">setCursor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">CrossCursor</span><span class="p">);</span>
<span class="n">image</span><span class="o">-&gt;</span><span class="n">addArea</span><span class="p">(</span><span class="n">rect</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPolygonArea</span> <span class="o">*</span><span class="n">polygon</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPolygonArea</span><span class="p">();</span>
<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="o">&gt;</span> <span class="n">points</span><span class="p">;</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">92</span><span class="p">,</span><span class="mi">330</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">66</span><span class="p">,</span><span class="mi">261</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">122</span><span class="p">,</span><span class="mi">176</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">143</span><span class="p">,</span><span class="mi">33</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">164</span><span class="p">,</span><span class="mi">33</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">157</span><span class="p">,</span><span class="mi">88</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">210</span><span class="p">,</span><span class="mi">90</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">263</span><span class="p">,</span><span class="mi">264</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">228</span><span class="p">,</span><span class="mi">330</span><span class="p">));</span>
<span class="n">points</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPoint</span><span class="p">(</span><span class="mi">92</span><span class="p">,</span><span class="mi">330</span><span class="p">));</span>
<span class="n">polygon</span><span class="o">-&gt;</span><span class="n">setPoints</span><span class="p">(</span><span class="n">points</span><span class="p">);</span>

<span class="c1">// In C++11, the above block is one statement:</span>
<span class="c1">//polygon-&gt;setPoints({ {92,330}, {66,261}, {122,176}, {143,33}, {164,33},</span>
<span class="c1">//                    {157,88}, {210,90}, {263,264}, {228,330}, {92,330} });</span>
<span class="n">polygon</span><span class="o">-&gt;</span><span class="n">setToolTip</span><span class="p">(</span><span class="s">&quot;person&quot;</span><span class="p">);</span>
<span class="n">polygon</span><span class="o">-&gt;</span><span class="n">setCursor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">CrossCursor</span><span class="p">);</span>
<span class="n">image</span><span class="o">-&gt;</span><span class="n">addArea</span><span class="p">(</span><span class="n">polygon</span><span class="p">);</span>

<span class="n">circle</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You clicked the tree.&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">rect</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You clicked the title.&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">polygon</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You clicked the person.&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">image</span><span class="o">-&gt;</span><span class="n">mouseMoved</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMouseEvent</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You&#39;re pointing the background at &quot;</span>
		 <span class="s">&quot;(&quot;</span> <span class="o">+</span> <span class="n">boost</span><span class="o">::</span><span class="n">lexical_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">widget</span><span class="p">().</span><span class="n">x</span><span class="p">)</span> <span class="o">+</span>
		 <span class="s">&quot;,&quot;</span> <span class="o">+</span> <span class="n">boost</span><span class="o">::</span><span class="n">lexical_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">e</span><span class="p">.</span><span class="n">widget</span><span class="p">().</span><span class="n">y</span><span class="p">)</span> <span class="o">+</span>
		 <span class="s">&quot;).&quot;</span><span class="p">);</span>
<span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-InPlaceEdit">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WInPlaceEdit&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WInPlaceEdit</span> <span class="o">*</span><span class="n">ipe</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WInPlaceEdit</span><span class="p">(</span><span class="s">&quot;This is editable text&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">ipe</span><span class="o">-&gt;</span><span class="n">setPlaceholderText</span><span class="p">(</span><span class="s">&quot;Enter something&quot;</span><span class="p">);</span>
<span class="n">ipe</span><span class="o">-&gt;</span><span class="n">setButtonsEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-InPlaceEditButtons">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WInPlaceEdit&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WInPlaceEdit</span> <span class="o">*</span><span class="n">ipe</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WInPlaceEdit</span><span class="p">(</span><span class="s">&quot;This is editable text&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">ipe</span><span class="o">-&gt;</span><span class="n">setPlaceholderText</span><span class="p">(</span><span class="s">&quot;Enter something&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-InputMask">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;lineEdit-template&quot;</span><span class="p">));</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setTextSize</span><span class="p">(</span><span class="mi">15</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setInputMask</span><span class="p">(</span><span class="s">&quot;009.009.009.009;_&quot;</span><span class="p">);</span>

<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindString</span><span class="p">(</span><span class="s">&quot;label&quot;</span><span class="p">,</span> <span class="s">&quot;IP Address:&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;edit&quot;</span><span class="p">,</span> <span class="n">edit</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-JavaPdfRenderer">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WResource&gt;</span>

<span class="k">class</span> <span class="nc">ReportResource</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span>
<span class="p">{</span>
<span class="nl">public:</span>
  <span class="n">ReportResource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">);</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;report.example&quot;</span><span class="p">),</span> <span class="n">container</span><span class="p">);</span>
<span class="n">text</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;reset&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Create pdf&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span> <span class="o">*</span><span class="n">pdf</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ReportResource</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-LargeTableView">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WTableView&gt;</span>

<span class="cp">#include &quot;VirtualModel.cpp&quot;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span> <span class="o">*</span><span class="n">tableView</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span><span class="p">();</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="k">new</span> <span class="n">VirtualModel</span><span class="p">(</span><span class="mi">10000</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="n">tableView</span><span class="p">));</span>

<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setRowHeaderCount</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span> <span class="c1">// treat first column as &#39;fixed&#39; row headers</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setSortingEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setAlternatingRowColors</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setRowHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setHeaderHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setSelectionMode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ExtendedSelection</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">NoEditTrigger</span><span class="p">);</span>

<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">650</span><span class="p">,</span> <span class="mi">400</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-LineEdit">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WIntValidator&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;lineEdit-template&quot;</span><span class="p">));</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setValidator</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WIntValidator</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">130</span><span class="p">));</span>

<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindString</span><span class="p">(</span><span class="s">&quot;label&quot;</span><span class="p">,</span> <span class="s">&quot;Age:&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;edit&quot;</span><span class="p">,</span> <span class="n">edit</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-LineEditEvent">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setPlaceholderText</span><span class="p">(</span><span class="s">&quot;Edit me&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">edit</span><span class="o">-&gt;</span><span class="n">keyPressed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WKeyEvent</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You pressed the &#39;&quot;</span> <span class="o">+</span> <span class="n">e</span><span class="p">.</span><span class="n">text</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;&#39; key.&quot;</span><span class="p">);</span>
<span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-MediaPlayerAudio">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WMediaPlayer&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="c1">// Define media source locations.</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">mp3Audio</span> <span class="o">=</span>
    <span class="s">&quot;http://www.webtoolkit.eu/audio/LaSera-NeverComeAround.mp3&quot;</span><span class="p">;</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">oggAudio</span> <span class="o">=</span>
    <span class="s">&quot;http://www.webtoolkit.eu/audio/LaSera-NeverComeAround.ogg&quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span> <span class="o">*</span><span class="n">player</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="o">::</span><span class="n">Audio</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">player</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="o">::</span><span class="n">MP3</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">mp3Audio</span><span class="p">));</span>
<span class="n">player</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="o">::</span><span class="n">OGA</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">oggAudio</span><span class="p">));</span>
<span class="n">player</span><span class="o">-&gt;</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;La Sera - Never Come Around&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">playbackStarted</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Song playing&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">playbackPaused</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Song paused&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">ended</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Song ended&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">volumeChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Volume changed&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-MediaPlayerVideo">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WMediaPlayer&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="c1">// Define media source locations</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">mp4Video</span> <span class="o">=</span> <span class="s">&quot;http://www.webtoolkit.eu/videos/sintel_trailer.mp4&quot;</span><span class="p">;</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">ogvVideo</span> <span class="o">=</span> <span class="s">&quot;http://www.webtoolkit.eu/videos/sintel_trailer.ogv&quot;</span><span class="p">;</span>

<span class="c1">// Define poster image location</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">poster</span> <span class="o">=</span> <span class="s">&quot;pics/sintel_trailer.jpg&quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span> <span class="o">*</span><span class="n">player</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="o">::</span><span class="n">Video</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">player</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="o">::</span><span class="n">M4V</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">mp4Video</span><span class="p">));</span>
<span class="n">player</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="o">::</span><span class="n">OGV</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">ogvVideo</span><span class="p">));</span>
<span class="n">player</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMediaPlayer</span><span class="o">::</span><span class="n">PosterImage</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">poster</span><span class="p">));</span>
<span class="n">player</span><span class="o">-&gt;</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;&lt;a href=</span><span class="se">\&quot;</span><span class="s">http://durian.blender.org/</span><span class="se">\&quot;</span><span class="s">&quot;</span>
		 <span class="s">&quot;target=</span><span class="se">\&quot;</span><span class="s">_blank</span><span class="se">\&quot;</span><span class="s">&gt;Sintel&lt;/a&gt;, (c) copyright Blender Foundation&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">playbackStarted</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video playing&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">playbackPaused</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video paused&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">ended</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video ended&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">player</span><span class="o">-&gt;</span><span class="n">volumeChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Volume changed&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-Menu">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WMenu&gt;</span>
<span class="cp">#include &lt;Wt/WStackedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WTextArea&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="c1">// Create a stack where the contents will be located.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WStackedWidget</span> <span class="o">*</span><span class="n">contents</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStackedWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WMenu</span> <span class="o">*</span><span class="n">menu</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMenu</span><span class="p">(</span><span class="n">contents</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Vertical</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">menu</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;nav nav-pills nav-stacked&quot;</span><span class="p">);</span>
<span class="n">menu</span><span class="o">-&gt;</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">150</span><span class="p">);</span>

<span class="c1">// Add menu items using the default lazy loading policy.</span>
<span class="n">menu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Internal paths&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;Internal paths contents&quot;</span><span class="p">));</span>
<span class="n">menu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Anchor&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;Anchor contents&quot;</span><span class="p">));</span>
<span class="n">menu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Stacked widget&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;Stacked widget contents&quot;</span><span class="p">));</span>
<span class="n">menu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Tab widget&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;Tab widget contents&quot;</span><span class="p">));</span>
<span class="n">menu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Menu&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;Menu contents&quot;</span><span class="p">));</span>

<span class="n">container</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">contents</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-MessageBox">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WMessageBox&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Status&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span><span class="p">);</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;The status button is clicked.&quot;</span><span class="p">);</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WMessageBox</span> <span class="o">*</span><span class="n">messageBox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMessageBox</span>
	<span class="p">(</span><span class="s">&quot;Status&quot;</span><span class="p">,</span>
	 <span class="s">&quot;&lt;p&gt;Ready to launch the rocket...&lt;/p&gt;&quot;</span>
	 <span class="s">&quot;&lt;p&gt;Launch the rocket immediately?&lt;/p&gt;&quot;</span><span class="p">,</span>
	 <span class="n">Wt</span><span class="o">::</span><span class="n">Information</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Yes</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">No</span><span class="p">);</span>

    <span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">setModal</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>

    <span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">buttonClicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">buttonResult</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Yes</span><span class="p">)</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;The rocket is launched!&quot;</span><span class="p">);</span>
	<span class="k">else</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;The rocket is ready for launch...&quot;</span><span class="p">);</span>

	<span class="k">delete</span> <span class="n">messageBox</span><span class="p">;</span>
    <span class="p">}));</span>

    <span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">show</span><span class="p">();</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-MessageBoxSync">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WMessageBox&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Start&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span><span class="p">);</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">StandardButton</span> <span class="n">answer</span> 
      <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMessageBox</span><span class="o">::</span><span class="n">show</span><span class="p">(</span><span class="s">&quot;Launch phase&quot;</span><span class="p">,</span>
			      <span class="s">&quot;&lt;p&gt;Launch the rocket?&lt;/p&gt;&quot;</span><span class="p">,</span>
			      <span class="n">Wt</span><span class="o">::</span><span class="n">Ok</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Cancel</span><span class="p">);</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">answer</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Ok</span><span class="p">)</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;The rocket is launched!&quot;</span><span class="p">);</span>
    <span class="k">else</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Waiting on your decision...&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-NavigationBar">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WMenu&gt;</span>
<span class="cp">#include &lt;Wt/WMessageBox&gt;</span>
<span class="cp">#include &lt;Wt/WNavigationBar&gt;</span>
<span class="cp">#include &lt;Wt/WPopupMenu&gt;</span>
<span class="cp">#include &lt;Wt/WPopupMenuItem&gt;</span>
<span class="cp">#include &lt;Wt/WStackedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="c1">// Create a navigation bar with a link to a web page.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WNavigationBar</span> <span class="o">*</span><span class="n">navigation</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WNavigationBar</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">navigation</span><span class="o">-&gt;</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;Corpy Inc.&quot;</span><span class="p">,</span>
		     <span class="s">&quot;http://www.google.com/search?q=corpy+inc&quot;</span><span class="p">);</span>
<span class="n">navigation</span><span class="o">-&gt;</span><span class="n">setResponsive</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStackedWidget</span> <span class="o">*</span><span class="n">contentsStack</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStackedWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">contentsStack</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;contents&quot;</span><span class="p">);</span>

<span class="c1">// Setup a Left-aligned menu.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WMenu</span> <span class="o">*</span><span class="n">leftMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMenu</span><span class="p">(</span><span class="n">contentsStack</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">navigation</span><span class="o">-&gt;</span><span class="n">addMenu</span><span class="p">(</span><span class="n">leftMenu</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">searchResult</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Buy or Sell... Bye!&quot;</span><span class="p">);</span>

<span class="n">leftMenu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Home&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;There is no better place!&quot;</span><span class="p">));</span>
<span class="n">leftMenu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Layout&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Layout contents&quot;</span><span class="p">))</span>
    <span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="o">::</span><span class="n">InternalPath</span><span class="p">,</span> <span class="s">&quot;/layout&quot;</span><span class="p">));</span>
<span class="n">leftMenu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Sales&quot;</span><span class="p">,</span> <span class="n">searchResult</span><span class="p">);</span>

<span class="c1">// Setup a Right-aligned menu.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WMenu</span> <span class="o">*</span><span class="n">rightMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMenu</span><span class="p">();</span>
<span class="n">navigation</span><span class="o">-&gt;</span><span class="n">addMenu</span><span class="p">(</span><span class="n">rightMenu</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignRight</span><span class="p">);</span>

<span class="c1">// Create a popup submenu for the Help menu.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span> <span class="o">*</span><span class="n">popup</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span><span class="p">();</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Contents&quot;</span><span class="p">);</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Index&quot;</span><span class="p">);</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;About&quot;</span><span class="p">);</span>

<span class="n">popup</span><span class="o">-&gt;</span><span class="n">itemSelected</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMenuItem</span> <span class="o">*</span><span class="n">item</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WMessageBox</span> <span class="o">*</span><span class="n">messageBox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMessageBox</span>
	<span class="p">(</span><span class="s">&quot;Help&quot;</span><span class="p">,</span>
	 <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Showing Help: {1}&lt;/p&gt;&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">()),</span>
	 <span class="n">Wt</span><span class="o">::</span><span class="n">Information</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Ok</span><span class="p">);</span>

    <span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">buttonClicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	<span class="k">delete</span> <span class="n">messageBox</span><span class="p">;</span>
    <span class="p">}));</span>

    <span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">show</span><span class="p">();</span>
<span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WMenuItem</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMenuItem</span><span class="p">(</span><span class="s">&quot;Help&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setMenu</span><span class="p">(</span><span class="n">popup</span><span class="p">);</span>
<span class="n">rightMenu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>

<span class="c1">// Add a Search control.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;Enter a search item&quot;</span><span class="p">);</span>

<span class="n">edit</span><span class="o">-&gt;</span><span class="n">enterPressed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">leftMenu</span><span class="o">-&gt;</span><span class="n">select</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span> <span class="c1">// is the index of the &quot;Sales&quot;</span>
    <span class="n">searchResult</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Nothing found for {1}.&quot;</span><span class="p">)</span>
			  <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">edit</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">()));</span>
<span class="p">}));</span>

<span class="n">navigation</span><span class="o">-&gt;</span><span class="n">addSearch</span><span class="p">(</span><span class="n">edit</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignRight</span><span class="p">);</span>

<span class="n">container</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">contentsStack</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-NestedLayout">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WHBoxLayout&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WVBoxLayout&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">200</span><span class="p">);</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box centered&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span> <span class="o">*</span><span class="n">vbox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">vbox</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 1&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span> <span class="o">*</span><span class="n">hbox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WHBoxLayout</span><span class="p">();</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addLayout</span><span class="p">(</span><span class="n">hbox</span><span class="p">);</span>

<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 2&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">hbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>

<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 3&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;blue-box&quot;</span><span class="p">);</span>
<span class="n">hbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-NumericalCharts3D">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WCssDecorationStyle&gt;</span>
<span class="cp">#include &lt;Wt/WBorder&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WCartesian3DChart&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WGridData&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WEquidistantGridData&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WScatterData&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WStandardColorMap&gt;</span>

<span class="cp">#include &quot;DataModels.h&quot;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="c1">// create the chart and add a border to the widget</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesian3DChart</span> <span class="o">*</span><span class="n">chart</span>
    <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesian3DChart</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setType</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ScatterPlot</span><span class="p">);</span>

<span class="c1">// disable server-side rendering fallback; our VPSes don&#39;t have that</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setRenderOptions</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WGLWidget</span><span class="o">::</span><span class="n">ClientSideRendering</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WGLWidget</span><span class="o">::</span><span class="n">AntiAliasing</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WCssDecorationStyle</span> <span class="n">style</span><span class="p">;</span>
<span class="n">style</span><span class="p">.</span><span class="n">setBorder</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="o">::</span><span class="n">Solid</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="o">::</span><span class="n">Medium</span><span class="p">,</span>
			    <span class="n">Wt</span><span class="o">::</span><span class="n">black</span><span class="p">));</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setDecorationStyle</span><span class="p">(</span><span class="n">style</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">900</span><span class="p">,</span> <span class="mi">700</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XY_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XY_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">YAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XZ_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XZ_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">YZ_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">YAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setGridEnabled</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">YZ_Plane</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">,</span> <span class="nb">true</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">axis</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XAxis_3D</span><span class="p">).</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;X&quot;</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">axis</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">YAxis_3D</span><span class="p">).</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;Y&quot;</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">axis</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">).</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;Z&quot;</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setIntersectionLinesEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setIntersectionLinesColor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>

<span class="c1">// make first dataset (WGridData)</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SombreroData</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">40</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WGridData</span> <span class="o">*</span><span class="n">dataset1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WGridData</span><span class="p">(</span><span class="n">model1</span><span class="p">);</span>
<span class="n">dataset1</span><span class="o">-&gt;</span><span class="n">setType</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">SurfaceSeries3D</span><span class="p">);</span>
<span class="n">dataset1</span><span class="o">-&gt;</span><span class="n">setSurfaceMeshEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WStandardColorMap</span> <span class="o">*</span><span class="n">colormap</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WStandardColorMap</span><span class="p">(</span><span class="n">dataset1</span><span class="o">-&gt;</span><span class="n">minimum</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">),</span>
				     <span class="n">dataset1</span><span class="o">-&gt;</span><span class="n">maximum</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZAxis_3D</span><span class="p">),</span>
				     <span class="nb">true</span><span class="p">);</span>
<span class="n">dataset1</span><span class="o">-&gt;</span><span class="n">setColorMap</span><span class="p">(</span><span class="n">colormap</span><span class="p">);</span>

<span class="c1">// make second dataset (WEquidistantGridData)</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">PlaneData</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">40</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">model2</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// set a few size-roles</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerScaleFactorRole</span><span class="p">);</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">model2</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerScaleFactorRole</span><span class="p">);</span>
<span class="p">}</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">model2</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">i</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerScaleFactorRole</span><span class="p">);</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">model2</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">()</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="n">i</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerScaleFactorRole</span><span class="p">);</span>
<span class="p">}</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">model2</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span> <span class="c1">// set a few color-roles</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerBrushColorRole</span><span class="p">);</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">6</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerBrushColorRole</span><span class="p">);</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">7</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">0</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerBrushColorRole</span><span class="p">);</span>
    <span class="n">model2</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">8</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">MarkerBrushColorRole</span><span class="p">);</span>
<span class="p">}</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WEquidistantGridData</span> <span class="o">*</span><span class="n">dataset2</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WEquidistantGridData</span><span class="p">(</span><span class="n">model2</span><span class="p">,</span> <span class="o">-</span><span class="mi">10</span><span class="p">,</span> <span class="mf">0.5f</span><span class="p">,</span> <span class="o">-</span><span class="mi">10</span><span class="p">,</span> <span class="mf">0.5f</span><span class="p">);</span>

<span class="c1">// make third dataset (WScatterData)</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model3</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SpiralData</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WScatterData</span> <span class="o">*</span><span class="n">dataset3</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WScatterData</span><span class="p">(</span><span class="n">model3</span><span class="p">);</span>
<span class="n">dataset3</span><span class="o">-&gt;</span><span class="n">setPointSize</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>

<span class="c1">// make fourth dataset (WEquidistantGridData, intersecting with dataset1)</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model4</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HorizontalPlaneData</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WEquidistantGridData</span> <span class="o">*</span><span class="n">dataset4</span> <span class="o">=</span>
  <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WEquidistantGridData</span><span class="p">(</span><span class="n">model4</span><span class="p">,</span> <span class="o">-</span><span class="mi">10</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">,</span> <span class="o">-</span><span class="mi">10</span><span class="p">,</span> <span class="mf">1.0f</span><span class="p">);</span>
<span class="n">dataset4</span><span class="o">-&gt;</span><span class="n">setType</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">SurfaceSeries3D</span><span class="p">);</span>
<span class="n">dataset4</span><span class="o">-&gt;</span><span class="n">setSurfaceMeshEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="c1">// add the data to the chart</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">addDataSeries</span><span class="p">(</span><span class="n">dataset1</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">addDataSeries</span><span class="p">(</span><span class="n">dataset2</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">addDataSeries</span><span class="p">(</span><span class="n">dataset3</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">addDataSeries</span><span class="p">(</span><span class="n">dataset4</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setAlternativeContent</span>
    <span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;pics/numericalChartScreenshot.png&quot;</span><span class="p">)));</span>
</pre></div>
  </message>
  <message id="src-Paintbrush">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCssDecorationStyle&gt;</span>
<span class="cp">#include &lt;Wt/WColor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WEvent&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainterPath&gt;</span>
<span class="cp">#include &lt;Wt/WPen&gt;</span>
<span class="cp">#include &lt;Wt/WPointF&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WRectF&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WToolBar&gt;</span>

<span class="k">class</span> <span class="nc">PaintBrush</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">PaintBrush</span><span class="p">(</span><span class="kt">int</span> <span class="n">width</span><span class="p">,</span> <span class="kt">int</span> <span class="n">height</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">resize</span><span class="p">(</span><span class="n">width</span><span class="p">,</span> <span class="n">height</span><span class="p">);</span>

	<span class="n">decorationStyle</span><span class="p">().</span><span class="n">setCursor</span><span class="p">(</span><span class="s">&quot;icons/pencil.cur&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">CrossCursor</span><span class="p">);</span>

	<span class="n">mouseDragged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">PaintBrush</span><span class="o">::</span><span class="n">mouseDrag</span><span class="p">);</span>
	<span class="n">mouseWentDown</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">PaintBrush</span><span class="o">::</span><span class="n">mouseDown</span><span class="p">);</span>
	<span class="n">touchStarted</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">PaintBrush</span><span class="o">::</span><span class="n">touchStart</span><span class="p">);</span>
	<span class="n">touchMoved</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">PaintBrush</span><span class="o">::</span><span class="n">touchMove</span><span class="p">);</span>
	<span class="n">touchMoved</span><span class="p">().</span><span class="n">preventDefaultAction</span><span class="p">();</span>
  
	<span class="n">color_</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">black</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">clear</span><span class="p">()</span> <span class="p">{</span>
	<span class="n">update</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">setColor</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="o">&amp;</span> <span class="n">c</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">color_</span> <span class="o">=</span> <span class="n">c</span><span class="p">;</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="k">virtual</span> <span class="kt">void</span> <span class="n">paintEvent</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPaintDevice</span> <span class="o">*</span><span class="n">paintDevice</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="n">paintDevice</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setRenderHint</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span><span class="o">::</span><span class="n">Antialiasing</span><span class="p">);</span>
  
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span> <span class="n">pen</span><span class="p">;</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">3</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setColor</span><span class="p">(</span><span class="n">color_</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setCapStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">FlatCap</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setJoinStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">MiterJoin</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setPen</span><span class="p">(</span><span class="n">pen</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawPath</span><span class="p">(</span><span class="n">path_</span><span class="p">);</span>

	<span class="n">path_</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">(</span><span class="n">path_</span><span class="p">.</span><span class="n">currentPosition</span><span class="p">());</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path_</span><span class="p">;</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span> <span class="n">color_</span><span class="p">;</span>

    <span class="kt">void</span> <span class="nf">mouseDown</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMouseEvent</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">Coordinates</span> <span class="n">c</span> <span class="o">=</span> <span class="n">e</span><span class="p">.</span><span class="n">widget</span><span class="p">();</span>
	<span class="n">path_</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="n">c</span><span class="p">.</span><span class="n">x</span><span class="p">,</span> <span class="n">c</span><span class="p">.</span><span class="n">y</span><span class="p">));</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="nf">mouseDrag</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMouseEvent</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">Coordinates</span> <span class="n">c</span> <span class="o">=</span> <span class="n">e</span><span class="p">.</span><span class="n">widget</span><span class="p">();</span>
	<span class="n">path_</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="n">c</span><span class="p">.</span><span class="n">x</span><span class="p">,</span> <span class="n">c</span><span class="p">.</span><span class="n">y</span><span class="p">);</span>
	<span class="n">update</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">PaintUpdate</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="nf">touchStart</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTouchEvent</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">Coordinates</span> <span class="n">c</span> <span class="o">=</span> <span class="n">e</span><span class="p">.</span><span class="n">touches</span><span class="p">()[</span><span class="mi">0</span><span class="p">].</span><span class="n">widget</span><span class="p">();</span>
	<span class="n">path_</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="n">c</span><span class="p">.</span><span class="n">x</span><span class="p">,</span> <span class="n">c</span><span class="p">.</span><span class="n">y</span><span class="p">));</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="nf">touchMove</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTouchEvent</span><span class="o">&amp;</span> <span class="n">e</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">Coordinates</span> <span class="n">c</span> <span class="o">=</span> <span class="n">e</span><span class="p">.</span><span class="n">touches</span><span class="p">()[</span><span class="mi">0</span><span class="p">].</span><span class="n">widget</span><span class="p">();</span>
	<span class="n">path_</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="n">c</span><span class="p">.</span><span class="n">x</span><span class="p">,</span> <span class="n">c</span><span class="p">.</span><span class="n">y</span><span class="p">);</span>
	<span class="n">update</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">PaintUpdate</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="k">namespace</span> <span class="p">{</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">createColorToggle</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">className</span><span class="p">,</span> <span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="o">&amp;</span> <span class="n">color</span><span class="p">,</span>
				   <span class="n">PaintBrush</span> <span class="o">*</span><span class="n">canvas</span><span class="p">)</span>
<span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">();</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">setTextFormat</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">XHTMLText</span><span class="p">);</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&amp;nbsp;&quot;</span><span class="p">);</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">setCheckable</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="n">className</span><span class="p">);</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">30</span><span class="p">);</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">checked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	<span class="n">canvas</span><span class="o">-&gt;</span><span class="n">setColor</span><span class="p">(</span><span class="n">color</span><span class="p">);</span>
    <span class="p">}));</span>

    <span class="k">return</span> <span class="n">button</span><span class="p">;</span>
<span class="p">}</span>

<span class="p">}</span>


<span class="cm">/* Approximate bootstrap standard colors */</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span> <span class="n">blue</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">110</span><span class="p">,</span> <span class="mi">204</span><span class="p">);</span>    <span class="c1">// btn-primary</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span> <span class="n">red</span><span class="p">(</span><span class="mi">218</span><span class="p">,</span> <span class="mi">81</span><span class="p">,</span> <span class="mi">76</span><span class="p">);</span>     <span class="c1">// btn-danger</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span> <span class="n">green</span><span class="p">(</span><span class="mi">59</span><span class="p">,</span> <span class="mi">195</span><span class="p">,</span> <span class="mi">95</span><span class="p">);</span>   <span class="c1">// btn-success</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span> <span class="n">orange</span><span class="p">(</span><span class="mi">250</span><span class="p">,</span> <span class="mi">168</span><span class="p">,</span> <span class="mi">52</span><span class="p">);</span> <span class="c1">// btn-warning</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span> <span class="n">black</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">black</span><span class="p">;</span>    <span class="c1">// btn-inverse</span>
<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span> <span class="n">gray</span><span class="p">(</span><span class="mi">210</span><span class="p">,</span> <span class="mi">210</span><span class="p">,</span> <span class="mi">210</span><span class="p">);</span>  <span class="c1">// (default)</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="o">*</span> <span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">PaintBrush</span> <span class="o">*</span><span class="n">canvas</span> <span class="o">=</span> <span class="k">new</span> <span class="n">PaintBrush</span><span class="p">(</span><span class="mi">710</span><span class="p">,</span> <span class="mi">400</span><span class="p">);</span>
<span class="n">canvas</span><span class="o">-&gt;</span><span class="n">setColor</span><span class="p">(</span><span class="n">blue</span><span class="p">);</span>
<span class="n">canvas</span><span class="o">-&gt;</span><span class="n">decorationStyle</span><span class="p">().</span><span class="n">setBorder</span>
    <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="o">::</span><span class="n">Solid</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBorder</span><span class="o">::</span><span class="n">Medium</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">black</span><span class="p">));</span>

<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*&gt;</span> <span class="n">colorButtons</span><span class="p">;</span>
<span class="n">colorButtons</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">createColorToggle</span><span class="p">(</span><span class="s">&quot;btn-primary&quot;</span><span class="p">,</span> <span class="n">blue</span><span class="p">,</span> <span class="n">canvas</span><span class="p">));</span>
<span class="n">colorButtons</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">createColorToggle</span><span class="p">(</span><span class="s">&quot;btn-danger&quot;</span><span class="p">,</span> <span class="n">red</span><span class="p">,</span> <span class="n">canvas</span><span class="p">));</span>
<span class="n">colorButtons</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">createColorToggle</span><span class="p">(</span><span class="s">&quot;btn-success&quot;</span><span class="p">,</span> <span class="n">green</span><span class="p">,</span> <span class="n">canvas</span><span class="p">));</span>
<span class="n">colorButtons</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">createColorToggle</span><span class="p">(</span><span class="s">&quot;btn-warning&quot;</span><span class="p">,</span> <span class="n">orange</span><span class="p">,</span> <span class="n">canvas</span><span class="p">));</span>
<span class="n">colorButtons</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">createColorToggle</span><span class="p">(</span><span class="s">&quot;btn-inverse&quot;</span><span class="p">,</span> <span class="n">black</span><span class="p">,</span> <span class="n">canvas</span><span class="p">));</span>
<span class="n">colorButtons</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">createColorToggle</span><span class="p">(</span><span class="s">&quot;&quot;</span> <span class="cm">/* default */</span><span class="p">,</span> <span class="n">gray</span><span class="p">,</span> <span class="n">canvas</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WToolBar</span> <span class="o">*</span><span class="n">toolBar</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WToolBar</span><span class="p">();</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">colorButtons</span><span class="p">.</span><span class="n">size</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="n">colorButtons</span><span class="p">[</span><span class="n">i</span><span class="p">];</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">setChecked</span><span class="p">(</span><span class="n">i</span> <span class="o">==</span> <span class="mi">0</span><span class="p">);</span>
    <span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">button</span><span class="p">);</span>

    <span class="c1">// Implement a radio button group</span>
    <span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="n">colorButtons</span><span class="p">.</span><span class="n">size</span><span class="p">();</span> <span class="o">++</span><span class="n">j</span><span class="p">)</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">i</span> <span class="o">!=</span> <span class="n">j</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span> <span class="k">const</span> <span class="n">other</span> <span class="o">=</span> <span class="n">colorButtons</span><span class="p">[</span><span class="n">j</span><span class="p">];</span>
	    <span class="n">button</span><span class="o">-&gt;</span><span class="n">checked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">other</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="o">::</span><span class="n">setUnChecked</span><span class="p">);</span>
	<span class="p">}</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">clearButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Clear&quot;</span><span class="p">);</span>

<span class="n">clearButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">canvas</span><span class="o">-&gt;</span><span class="n">clear</span><span class="p">();</span>
<span class="p">}));</span>

<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>
<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">clearButton</span><span class="p">);</span>

<span class="n">result</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">toolBar</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">canvas</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Painting3D">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
</pre></div>
  </message>
  <message id="src-PaintingClipping">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBrush&gt;</span>
<span class="cp">#include &lt;Wt/WCalendar&gt;</span>
<span class="cp">#include &lt;Wt/WColor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPaintDevice&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>

<span class="cp">#include &lt;cstdlib&gt;</span>

<span class="k">class</span> <span class="nc">ClippingWidget</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">ClippingWidget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">resize</span><span class="p">(</span><span class="mi">310</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>  <span class="c1">// Provide a default size.</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="kt">void</span> <span class="n">paintEvent</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPaintDevice</span> <span class="o">*</span><span class="n">paintDevice</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="n">paintDevice</span><span class="p">);</span>

	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>   <span class="c1">// Create two separate drawings.</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">160</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
	    <span class="c1">// Draw the background</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">150</span><span class="p">,</span> <span class="mi">150</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">black</span><span class="p">)));</span>

	    <span class="c1">// Create a path and fill it with blue.</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">();</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">addEllipse</span><span class="p">(</span><span class="mi">15</span><span class="p">,</span> <span class="mi">15</span><span class="p">,</span> <span class="mi">120</span><span class="p">,</span> <span class="mi">120</span><span class="p">);</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">fillPath</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">blue</span><span class="p">)));</span>

	    <span class="c1">// Use the previously defined path also for clipping.</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">setClipPath</span><span class="p">(</span><span class="n">path</span><span class="p">);</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">setClipping</span><span class="p">(</span><span class="n">i</span> <span class="o">!=</span> <span class="mi">0</span><span class="p">);</span> <span class="c1">// Clipping is applied from the 2nd drawing.</span>

	    <span class="n">drawStars</span><span class="p">(</span><span class="n">painter</span><span class="p">);</span>
	<span class="p">}</span>
  <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">void</span> <span class="n">drawStar</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span><span class="o">&amp;</span> <span class="n">painter</span><span class="p">,</span> <span class="kt">double</span> <span class="n">radius</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">circlePath</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">();</span>
	<span class="n">circlePath</span><span class="p">.</span><span class="n">addEllipse</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">radius</span><span class="p">,</span> <span class="n">radius</span><span class="p">);</span>
	<span class="n">circlePath</span><span class="p">.</span><span class="n">closeSubPath</span><span class="p">();</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillPath</span><span class="p">(</span><span class="n">circlePath</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">white</span><span class="p">)));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">drawStars</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span><span class="o">&amp;</span> <span class="n">painter</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="n">srand</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDateTime</span><span class="o">::</span><span class="n">currentDateTime</span><span class="p">().</span><span class="n">toTime_t</span><span class="p">());</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span><span class="mi">75</span><span class="p">);</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">star</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">star</span> <span class="o">&lt;</span> <span class="mi">50</span><span class="p">;</span> <span class="n">star</span><span class="o">++</span><span class="p">){</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">75</span> <span class="o">-</span> <span class="n">std</span><span class="o">::</span><span class="n">rand</span><span class="p">()</span> <span class="o">%</span> <span class="mi">150</span> <span class="o">+</span> <span class="mi">1</span><span class="p">,</span>
			      <span class="mi">75</span> <span class="o">-</span> <span class="n">std</span><span class="o">::</span><span class="n">rand</span><span class="p">()</span> <span class="o">%</span> <span class="mi">150</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
	    <span class="n">drawStar</span><span class="p">(</span><span class="n">painter</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">max</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">rand</span><span class="p">()</span> <span class="o">%</span> <span class="mi">4</span><span class="p">)</span> <span class="o">+</span> <span class="mi">2</span><span class="p">);</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>
	<span class="p">}</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="nf">ClippingWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PaintingEvent">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPaintDevice&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>
<span class="cp">#include &lt;Wt/WSpinBox&gt;</span>

<span class="k">class</span> <span class="nc">MyPaintedWidget</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">MyPaintedWidget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">),</span> <span class="n">end_</span><span class="p">(</span><span class="mi">100</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">resize</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">60</span><span class="p">);</span>   <span class="c1">// Provide a default size.</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">setEnd</span><span class="p">(</span><span class="kt">int</span> <span class="n">end</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">end_</span> <span class="o">=</span> <span class="n">end</span><span class="p">;</span>
	<span class="n">update</span><span class="p">();</span>          <span class="c1">// Trigger a repaint.</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="kt">void</span> <span class="n">paintEvent</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPaintDevice</span> <span class="o">*</span><span class="n">paintDevice</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="n">paintDevice</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">blue</span><span class="p">)));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span> <span class="p">,</span><span class="n">end_</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">int</span> <span class="n">end_</span><span class="p">;</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">MyPaintedWidget</span> <span class="o">*</span><span class="n">painting</span> <span class="o">=</span> <span class="k">new</span> <span class="n">MyPaintedWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSpinBox</span> <span class="o">*</span><span class="n">sb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSpinBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">sb</span><span class="o">-&gt;</span><span class="n">setRange</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">200</span><span class="p">);</span>
<span class="n">sb</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="mi">100</span><span class="p">);</span>

<span class="n">sb</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">painting</span><span class="o">-&gt;</span><span class="n">setEnd</span><span class="p">(</span><span class="n">sb</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">());</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-PaintingImages">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBrush&gt;</span>
<span class="cp">#include &lt;Wt/WColor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPaintDevice&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>

<span class="k">class</span> <span class="nc">PaintingImagesWidget</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">PaintingImagesWidget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">resize</span><span class="p">(</span><span class="mi">639</span><span class="p">,</span> <span class="mi">1310</span><span class="p">);</span>  <span class="c1">// Provide a default size.</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="kt">void</span> <span class="n">paintEvent</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPaintDevice</span> <span class="o">*</span><span class="n">paintDevice</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="n">paintDevice</span><span class="p">);</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span><span class="o">::</span><span class="n">Image</span> <span class="n">image</span><span class="p">(</span><span class="s">&quot;pics/sintel_trailer.jpg&quot;</span><span class="p">,</span> <span class="mi">639</span><span class="p">,</span> <span class="mi">354</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawImage</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="n">image</span><span class="p">);</span>
	<span class="c1">// Draw a part of the same image starting at (110, 75) and put it at</span>
	<span class="c1">// (0, 364).</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawImage</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">364.0</span><span class="p">,</span> <span class="n">image</span><span class="p">,</span> <span class="mf">110.0</span><span class="p">,</span> <span class="mf">75.0</span><span class="p">,</span> <span class="mf">130.0</span><span class="p">,</span> <span class="mf">110.0</span><span class="p">);</span>
	<span class="c1">// Draw the same part using WPointF for the starting point and WRectF for</span>
	<span class="c1">// the source rectangle.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span> <span class="n">location</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">484.0</span><span class="p">);</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span> <span class="n">sourceRect</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span><span class="p">(</span><span class="mf">110.0</span><span class="p">,</span> <span class="mf">75.0</span><span class="p">,</span> <span class="mf">130.0</span><span class="p">,</span> <span class="mf">110.0</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawImage</span><span class="p">(</span><span class="n">location</span><span class="p">,</span> <span class="n">image</span><span class="p">,</span> <span class="n">sourceRect</span><span class="p">);</span>
	<span class="c1">// Draw the image in a rectangle.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span> <span class="n">destinationRect</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">604.0</span><span class="p">,</span> <span class="mf">130.0</span><span class="p">,</span> <span class="mf">110.0</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawImage</span><span class="p">(</span><span class="n">destinationRect</span><span class="p">,</span> <span class="n">image</span><span class="p">);</span>
	<span class="c1">// Draw a part of the image in a rectangle - scaling down</span>
	<span class="n">sourceRect</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span><span class="p">(</span><span class="mf">60.0</span><span class="p">,</span> <span class="mf">80.0</span><span class="p">,</span> <span class="mf">220.0</span><span class="p">,</span> <span class="mf">180.0</span><span class="p">);</span>
	<span class="n">destinationRect</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">724.0</span><span class="p">,</span> <span class="mf">130.0</span><span class="p">,</span> <span class="mf">110.0</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawImage</span><span class="p">(</span><span class="n">destinationRect</span><span class="p">,</span> <span class="n">image</span><span class="p">,</span> <span class="n">sourceRect</span><span class="p">);</span>
	<span class="c1">// Draw a part of the image in a rectangle - scaling up</span>
	<span class="n">sourceRect</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span><span class="p">(</span><span class="mf">294.0</span><span class="p">,</span> <span class="mf">226.0</span><span class="p">,</span> <span class="mf">265.0</span><span class="p">,</span> <span class="mf">41.0</span><span class="p">);</span>
	<span class="n">destinationRect</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRectF</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">844.0</span><span class="p">,</span> <span class="mf">639.0</span><span class="p">,</span> <span class="mf">110.0</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawImage</span><span class="p">(</span><span class="n">destinationRect</span><span class="p">,</span> <span class="n">image</span><span class="p">,</span> <span class="n">sourceRect</span><span class="p">);</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">964</span><span class="p">);</span>
	<span class="c1">// Draw the image and add shapes to it.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawImage</span><span class="p">(</span><span class="mf">0.0</span><span class="p">,</span> <span class="mf">0.0</span><span class="p">,</span> <span class="n">image</span><span class="p">);</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
	<span class="n">path</span><span class="p">.</span><span class="n">addEllipse</span><span class="p">(</span><span class="mi">369</span><span class="p">,</span> <span class="mi">91</span><span class="p">,</span> <span class="mi">116</span><span class="p">,</span> <span class="mi">116</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">addRect</span><span class="p">(</span><span class="mi">294</span><span class="p">,</span> <span class="mi">226</span><span class="p">,</span> <span class="mi">265</span><span class="p">,</span> <span class="mi">41</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">92</span><span class="p">,</span><span class="mi">330</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">66</span><span class="p">,</span><span class="mi">261</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">122</span><span class="p">,</span><span class="mi">176</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">143</span><span class="p">,</span><span class="mi">33</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">164</span><span class="p">,</span><span class="mi">33</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">157</span><span class="p">,</span><span class="mi">88</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">210</span><span class="p">,</span><span class="mi">90</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">263</span><span class="p">,</span><span class="mi">264</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">228</span><span class="p">,</span><span class="mi">330</span><span class="p">);</span>
	<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">92</span><span class="p">,</span><span class="mi">330</span><span class="p">);</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span> <span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">red</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">3</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">pen</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="nf">PaintingImagesWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PaintingShapes">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBrush&gt;</span>
<span class="cp">#include &lt;Wt/WColor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPaintDevice&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>
<span class="cp">#include &lt;Wt/WPainterPath&gt;</span>
<span class="cp">#include &lt;Wt/WPen&gt;</span>
<span class="cp">#include &lt;Wt/WPointF&gt;</span>
<span class="cp">#include &lt;Wt/WSpinBox&gt;</span>

<span class="k">class</span> <span class="nc">ShapesWidget</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">ShapesWidget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">resize</span><span class="p">(</span><span class="mi">310</span><span class="p">,</span> <span class="mi">400</span><span class="p">);</span>  <span class="c1">// Provide a default size.</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="kt">void</span> <span class="n">paintEvent</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPaintDevice</span> <span class="o">*</span><span class="n">paintDevice</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="n">paintDevice</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setPen</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">red</span><span class="p">);</span>

	<span class="c1">// DRAWING PRIMITIVE SHAPES</span>
	<span class="c1">// Draw a line from (0, 0) to (200, 0) and then 30 px downwards.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawLine</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">200</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawLine</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">200</span><span class="p">,</span> <span class="mi">30</span><span class="p">);</span>

	<span class="c1">// Draw and fill a rectangle from (0, 25) with width 80 and height 25</span>
	<span class="c1">// using the current pen (red) and brush (default: white).</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
	<span class="c1">// Set the current brush with the global color name &#39;green&#39;.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">green</span><span class="p">));</span>
	<span class="c1">// Draw the same rectangle from (100, 25) using the current pen and brush.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
	<span class="c1">// Fill a rectangle from (100, 25) with width 80 and height 25.</span>
	<span class="c1">// Choose a color with red=0, green=255, blue=0, alpha=64.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">220</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">64</span><span class="p">)));</span>

	<span class="c1">// Draw the outline of an ellipse.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawEllipse</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
	<span class="c1">// Draw the upper segment of the ellipse (angle = 180 x 1/16th of a degree)</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawChord</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">180</span><span class="o">*</span><span class="mi">16</span><span class="p">);</span>

	<span class="c1">// Draw an open arc and a closed arc.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawArc</span><span class="p">(</span><span class="mi">220</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">90</span><span class="o">*</span><span class="mi">16</span><span class="p">,</span> <span class="mi">90</span><span class="o">*</span><span class="mi">16</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawArc</span><span class="p">(</span><span class="mi">240</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">90</span><span class="o">*</span><span class="mi">16</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawLine</span><span class="p">(</span><span class="mi">265</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">265</span><span class="p">,</span> <span class="mi">125</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawLine</span><span class="p">(</span><span class="mi">265</span><span class="p">,</span> <span class="mi">125</span><span class="p">,</span> <span class="mi">290</span><span class="p">,</span> <span class="mi">125</span><span class="p">);</span>

	<span class="c1">// Draw a 6-point polygon and fill it with the current brush.</span>
	<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span> <span class="n">points</span><span class="p">[]</span> 
	    <span class="o">=</span> <span class="p">{</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">120</span><span class="p">,</span> <span class="mi">170</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">160</span><span class="p">,</span> <span class="mi">170</span><span class="p">),</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">180</span><span class="p">,</span> <span class="mf">204.6</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">160</span><span class="p">,</span> <span class="mf">239.2</span><span class="p">),</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">120</span><span class="p">,</span> <span class="mf">239.2</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span> <span class="mf">204.6</span><span class="p">)</span> <span class="p">};</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawPolygon</span><span class="p">(</span><span class="n">points</span><span class="p">,</span> <span class="mi">6</span><span class="p">);</span>
	<span class="c1">// DRAWING SHAPES USING A PATH</span>
	<span class="c1">// Create an ellipse path and fill it.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">filledEllipsePath</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">();</span>
	<span class="n">filledEllipsePath</span><span class="p">.</span><span class="n">addEllipse</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">180</span><span class="p">,</span> <span class="mi">80</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
	<span class="n">filledEllipsePath</span><span class="p">.</span><span class="n">closeSubPath</span><span class="p">();</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawPath</span><span class="p">(</span><span class="n">filledEllipsePath</span><span class="p">);</span>

	<span class="c1">// Create a new path for a triangle.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">filledTrianglePath</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">();</span>
	<span class="n">filledTrianglePath</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">270</span><span class="p">);</span>
	<span class="n">filledTrianglePath</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">80</span><span class="p">,</span><span class="mi">270</span><span class="p">);</span>
	<span class="n">filledTrianglePath</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">350</span><span class="p">);</span>
	<span class="n">filledTrianglePath</span><span class="p">.</span><span class="n">closeSubPath</span><span class="p">();</span>
	<span class="c1">// Draw the path and fill it.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawPath</span><span class="p">(</span><span class="n">filledTrianglePath</span><span class="p">);</span>

	<span class="c1">// strokePath draws a path but doesn&#39;t fill it.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">strokedTrianglePath</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">();</span>
	<span class="n">strokedTrianglePath</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span><span class="mi">270</span><span class="p">);</span>
	<span class="n">strokedTrianglePath</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span><span class="mi">350</span><span class="p">);</span>
	<span class="n">strokedTrianglePath</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">350</span><span class="p">);</span>
	<span class="n">strokedTrianglePath</span><span class="p">.</span><span class="n">closeSubPath</span><span class="p">();</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span> <span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">3</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">strokedTrianglePath</span><span class="p">,</span> <span class="n">pen</span><span class="p">);</span>

	<span class="c1">// Draw a balloon with quadratic bezier curves.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">quadraticCurvePath</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">();</span>
	<span class="n">quadraticCurvePath</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">250</span><span class="p">,</span><span class="mi">150</span><span class="p">);</span>
	<span class="n">quadraticCurvePath</span><span class="p">.</span><span class="n">quadTo</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span><span class="mi">150</span><span class="p">,</span> <span class="mi">200</span><span class="p">,</span><span class="mf">187.5</span><span class="p">);</span>
	<span class="n">quadraticCurvePath</span><span class="p">.</span><span class="n">quadTo</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span><span class="mi">225</span><span class="p">,</span> <span class="mi">225</span><span class="p">,</span><span class="mi">225</span><span class="p">);</span>
	<span class="n">quadraticCurvePath</span><span class="p">.</span><span class="n">quadTo</span><span class="p">(</span><span class="mi">225</span><span class="p">,</span><span class="mi">245</span><span class="p">,</span> <span class="mi">205</span><span class="p">,</span><span class="mi">250</span><span class="p">);</span>
	<span class="n">quadraticCurvePath</span><span class="p">.</span><span class="n">quadTo</span><span class="p">(</span><span class="mi">235</span><span class="p">,</span><span class="mi">245</span><span class="p">,</span> <span class="mi">240</span><span class="p">,</span><span class="mi">225</span><span class="p">);</span>
	<span class="n">quadraticCurvePath</span><span class="p">.</span><span class="n">quadTo</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span><span class="mi">225</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span><span class="mf">187.5</span><span class="p">);</span>
	<span class="n">quadraticCurvePath</span><span class="p">.</span><span class="n">quadTo</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span><span class="mi">150</span><span class="p">,</span> <span class="mi">250</span><span class="p">,</span><span class="mi">150</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">quadraticCurvePath</span><span class="p">,</span> <span class="n">pen</span><span class="p">);</span>

	<span class="c1">// Draw a heart with cubic bezier curves.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">bezierCurvePath</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="p">();</span>
	<span class="n">bezierCurvePath</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span> <span class="mi">255</span><span class="p">,</span><span class="mi">285</span><span class="p">);</span>
	<span class="n">bezierCurvePath</span><span class="p">.</span><span class="n">cubicTo</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span><span class="mi">282</span><span class="p">,</span>  <span class="mi">250</span><span class="p">,</span><span class="mi">270</span><span class="p">,</span>  <span class="mi">230</span><span class="p">,</span><span class="mi">270</span><span class="p">);</span>
	<span class="n">bezierCurvePath</span><span class="p">.</span><span class="n">cubicTo</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span><span class="mi">270</span><span class="p">,</span>  <span class="mi">200</span><span class="p">,</span><span class="mf">307.5</span><span class="p">,</span><span class="mi">200</span><span class="p">,</span><span class="mf">307.5</span><span class="p">);</span>
	<span class="n">bezierCurvePath</span><span class="p">.</span><span class="n">cubicTo</span><span class="p">(</span><span class="mi">200</span><span class="p">,</span><span class="mi">325</span><span class="p">,</span>  <span class="mi">220</span><span class="p">,</span><span class="mi">357</span><span class="p">,</span>  <span class="mi">255</span><span class="p">,</span><span class="mi">365</span><span class="p">);</span>
	<span class="n">bezierCurvePath</span><span class="p">.</span><span class="n">cubicTo</span><span class="p">(</span><span class="mi">290</span><span class="p">,</span><span class="mi">347</span><span class="p">,</span>  <span class="mi">310</span><span class="p">,</span><span class="mi">325</span><span class="p">,</span>  <span class="mi">310</span><span class="p">,</span><span class="mf">307.5</span><span class="p">);</span>
	<span class="n">bezierCurvePath</span><span class="p">.</span><span class="n">cubicTo</span><span class="p">(</span><span class="mi">310</span><span class="p">,</span><span class="mf">307.5</span><span class="p">,</span><span class="mi">310</span><span class="p">,</span><span class="mi">270</span><span class="p">,</span>  <span class="mi">290</span><span class="p">,</span><span class="mi">270</span><span class="p">);</span>
	<span class="n">bezierCurvePath</span><span class="p">.</span><span class="n">cubicTo</span><span class="p">(</span><span class="mi">265</span><span class="p">,</span><span class="mi">270</span><span class="p">,</span>  <span class="mi">255</span><span class="p">,</span><span class="mi">282</span><span class="p">,</span>  <span class="mi">255</span><span class="p">,</span><span class="mi">285</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">red</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawPath</span><span class="p">(</span><span class="n">bezierCurvePath</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="nf">ShapesWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PaintingStyle">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBrush&gt;</span>
<span class="cp">#include &lt;Wt/WColor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPaintDevice&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>

<span class="k">class</span> <span class="nc">StyleWidget</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">StyleWidget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">resize</span><span class="p">(</span><span class="mi">310</span><span class="p">,</span> <span class="mi">1140</span><span class="p">);</span>  <span class="c1">// Provide a default size.</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="kt">void</span> <span class="n">paintEvent</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPaintDevice</span> <span class="o">*</span><span class="n">paintDevice</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="n">paintDevice</span><span class="p">);</span>

	<span class="c1">// Draw a grid of rectangles; each one in a different color.</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">row</span> <span class="o">&lt;</span> <span class="mi">6</span><span class="p">;</span> <span class="n">row</span><span class="o">++</span><span class="p">)</span>
	    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">col</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">col</span> <span class="o">&lt;</span> <span class="mi">6</span><span class="p">;</span> <span class="n">col</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
		<span class="c1">// Generate a unique RGB color for each square. Only the red and</span>
		<span class="c1">// green values are modified; the blue channel has a fixed value.</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span> <span class="n">brush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">255</span> <span class="o">-</span> <span class="mi">42</span><span class="o">*</span><span class="n">row</span><span class="p">,</span> <span class="mi">255</span> <span class="o">-</span> <span class="mi">42</span><span class="o">*</span><span class="n">col</span><span class="p">,</span> <span class="mi">0</span><span class="p">));</span>
		<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="n">row</span><span class="o">*</span><span class="mi">25</span><span class="p">,</span> <span class="n">col</span><span class="o">*</span><span class="mi">25</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="mi">25</span><span class="p">,</span> <span class="n">brush</span><span class="p">);</span>
	    <span class="p">}</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">160</span><span class="p">);</span>
	<span class="c1">// Draw a grid of circles similar to the above example but now using the</span>
	<span class="c1">// strokePath method.</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span> <span class="n">pen</span><span class="p">;</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">3</span><span class="p">);</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">row</span> <span class="o">&lt;</span> <span class="mi">6</span><span class="p">;</span> <span class="n">row</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">col</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">col</span> <span class="o">&lt;</span> <span class="mi">6</span><span class="p">;</span> <span class="n">col</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
		<span class="c1">// Generate a unique RGB color for each circle. Only the green and</span>
		<span class="c1">// blue values are modified; the red channel has a fixed value.</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
		<span class="n">path</span><span class="p">.</span><span class="n">addEllipse</span><span class="p">(</span><span class="mi">3</span> <span class="o">+</span> <span class="n">col</span><span class="o">*</span><span class="mi">25</span><span class="p">,</span> <span class="mi">3</span> <span class="o">+</span> <span class="n">row</span><span class="o">*</span><span class="mi">25</span><span class="p">,</span> <span class="mi">20</span><span class="p">,</span> <span class="mi">20</span><span class="p">);</span>
		<span class="n">pen</span><span class="p">.</span><span class="n">setColor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span> <span class="o">-</span> <span class="mi">42</span><span class="o">*</span><span class="n">row</span><span class="p">,</span> <span class="mi">255</span> <span class="o">-</span> <span class="mi">42</span><span class="o">*</span><span class="n">col</span><span class="p">));</span>
		<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">pen</span><span class="p">);</span>
	    <span class="p">}</span>
	<span class="p">}</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">160</span><span class="p">);</span>
	<span class="c1">// Transparency example with rectangles</span>
	<span class="c1">// Create a background composed of 4 stacked rectangles.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">150</span><span class="p">,</span> <span class="mf">37.5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">yellow</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mf">37.5</span><span class="p">,</span> <span class="mi">150</span><span class="p">,</span> <span class="mf">37.5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">green</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">150</span><span class="p">,</span> <span class="mf">37.5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">blue</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mf">112.5</span><span class="p">,</span> <span class="mi">150</span><span class="p">,</span> <span class="mf">37.5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">red</span><span class="p">));</span>
	<span class="c1">// On top of these draw semi transparent rectangles with increasing opacity</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">10</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span> <span class="n">brush</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="o">/</span><span class="mi">10</span><span class="o">*</span><span class="n">i</span><span class="p">));</span>
	    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="mi">4</span><span class="p">;</span> <span class="n">j</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
		<span class="n">path</span><span class="p">.</span><span class="n">addRect</span><span class="p">(</span><span class="mi">5</span> <span class="o">+</span> <span class="n">i</span><span class="o">*</span><span class="mi">14</span><span class="p">,</span> <span class="mi">5</span> <span class="o">+</span> <span class="n">j</span><span class="o">*</span><span class="mf">37.5</span><span class="p">,</span> <span class="mi">14</span><span class="p">,</span> <span class="mf">27.5</span><span class="p">);</span>
		<span class="n">painter</span><span class="p">.</span><span class="n">fillPath</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">brush</span><span class="p">);</span>
	    <span class="p">}</span>
	<span class="p">}</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">160</span><span class="p">);</span>
	<span class="c1">// Transparency example with circles</span>
	<span class="c1">// Create a square composed of four different colored squares.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">yellow</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">green</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">blue</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">fillRect</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="mi">75</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">red</span><span class="p">));</span>

	<span class="c1">// On top of these draw a set of semi-transparant white circles with</span>
	<span class="c1">// increasing diameter. The final result is a radial gradient.</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">8</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">addEllipse</span><span class="p">(</span><span class="mi">75</span> <span class="o">-</span> <span class="n">i</span><span class="o">*</span><span class="mi">10</span><span class="p">,</span> <span class="mi">75</span> <span class="o">-</span> <span class="n">i</span><span class="o">*</span><span class="mi">10</span><span class="p">,</span> <span class="n">i</span><span class="o">*</span><span class="mi">20</span><span class="p">,</span> <span class="n">i</span><span class="o">*</span><span class="mi">20</span><span class="p">);</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span> <span class="n">brush</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">50</span><span class="p">));</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">fillPath</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">brush</span><span class="p">);</span>
	<span class="p">}</span>
	
	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">170</span><span class="p">);</span>
	<span class="c1">// Gradient Brush example</span>
	<span class="c1">// Rectangle with a linear gradient from left top to right bottom</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setPen</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">NoPen</span><span class="p">));</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WGradient</span> <span class="n">linGrad</span><span class="p">;</span>
	<span class="n">linGrad</span><span class="p">.</span><span class="n">setLinearGradient</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
	<span class="n">linGrad</span><span class="p">.</span><span class="n">addColorStop</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>
	<span class="n">linGrad</span><span class="p">.</span><span class="n">addColorStop</span><span class="p">(</span><span class="mf">0.5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>
	<span class="n">linGrad</span><span class="p">.</span><span class="n">addColorStop</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span> <span class="n">linearGradientBrush</span><span class="p">(</span><span class="n">linGrad</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">linearGradientBrush</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>

	<span class="c1">// Circle with a radial gradient</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WGradient</span> <span class="n">radGrad</span><span class="p">;</span>
	<span class="n">radGrad</span><span class="p">.</span><span class="n">setRadialGradient</span><span class="p">(</span><span class="mi">170</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">130</span><span class="p">,</span> <span class="mi">130</span><span class="p">);</span>
	<span class="n">radGrad</span><span class="p">.</span><span class="n">addColorStop</span><span class="p">(</span><span class="mf">0.2</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>
	<span class="n">radGrad</span><span class="p">.</span><span class="n">addColorStop</span><span class="p">(</span><span class="mf">0.9</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>
	<span class="n">radGrad</span><span class="p">.</span><span class="n">addColorStop</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">));</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span> <span class="n">radialGradientBrush</span><span class="p">(</span><span class="n">radGrad</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">radialGradientBrush</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawEllipse</span><span class="p">(</span><span class="mi">120</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">100</span><span class="p">);</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">170</span><span class="p">);</span>
	<span class="c1">// LineWidth example</span>

	<span class="c1">// You can use WPainter::drawLine() or WPainter::strokePath() to draw a</span>
	<span class="c1">// line. Using strokePath() you can draw thicker lines.</span>

	<span class="c1">// The line is centered on the path. In other words, the area that&#39;s drawn</span>
	<span class="c1">// extends to half the line width on either side of the path. Because</span>
	<span class="c1">// canvas coordinates do not directly reference pixels, you have to take</span>
	<span class="c1">// special care to obtain crisp horizontal and vertical lines.</span>

	<span class="c1">// All lines with an odd integer width thickness in the example below do</span>
	<span class="c1">// not appear crisp, because of the path&#39;s positioning.</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">11</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">14</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">14</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
	    <span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	    <span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">pen</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">160</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>

	<span class="c1">// LineWidth example with crisp lines</span>

	<span class="c1">// To obtain a crisp line for an odd integer width thickness line you have</span>
	<span class="c1">// to be very precise in your path creation, e.g. a 1.0 width line will</span>
	<span class="c1">// extend half a unit to either side of the path.</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">11</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
	    <span class="k">if</span> <span class="p">(</span><span class="n">i</span> <span class="o">%</span> <span class="mi">2</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span> <span class="p">{</span>
		<span class="n">path</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">14</span><span class="o">-</span><span class="mf">0.5</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
		<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">14</span><span class="o">-</span><span class="mf">0.5</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
	    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
		<span class="n">path</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">14</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>
		<span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">14</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
	    <span class="p">}</span>

	    <span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	    <span class="n">pen</span><span class="p">.</span><span class="n">setCapStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">FlatCap</span><span class="p">);</span>   <span class="c1">// Now, all lines will have equal length.</span>
	    <span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="n">i</span><span class="o">+</span><span class="mi">1</span><span class="p">);</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">pen</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="o">-</span><span class="mi">160</span><span class="p">,</span> <span class="mi">170</span><span class="p">);</span>

	<span class="c1">// PenCapStyle example</span>
	<span class="c1">// The PenCapStyle can be FlatCap, SquareCap or RoundCap.</span>
	<span class="c1">// Start with drawing guides:</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">guidePath</span><span class="p">;</span>
	<span class="n">guidePath</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>
	<span class="n">guidePath</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span><span class="mi">10</span><span class="p">);</span>
	<span class="n">guidePath</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">140</span><span class="p">);</span>
	<span class="n">guidePath</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span><span class="mi">140</span><span class="p">);</span>
	<span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">blue</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">guidePath</span><span class="p">,</span> <span class="n">pen</span><span class="p">);</span>

	<span class="c1">// Draw lines with different cap styles</span>
	<span class="c1">// Create three parallel paths:</span>
	<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span><span class="o">&gt;</span> <span class="n">paths</span><span class="p">;</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">25</span><span class="o">+</span><span class="n">i</span><span class="o">*</span><span class="mi">50</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">25</span><span class="o">+</span><span class="n">i</span><span class="o">*</span><span class="mi">50</span><span class="p">,</span> <span class="mi">140</span><span class="p">);</span>
	    <span class="n">paths</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">path</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setCapStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">FlatCap</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">paths</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pen</span><span class="p">);</span>

	<span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setCapStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">SquareCap</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">paths</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">pen</span><span class="p">);</span>

	<span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setCapStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">RoundCap</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">paths</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">pen</span><span class="p">);</span>

	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">170</span><span class="p">);</span>

	<span class="c1">// PenJoinStyle example</span>
	<span class="c1">// The PenJoinStyle can be MiterJoin, BevelJoin or RoundJoin.</span>
	<span class="c1">// Create three parallel paths:</span>

	<span class="n">paths</span><span class="p">.</span><span class="n">clear</span><span class="p">();</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainterPath</span> <span class="n">path</span><span class="p">;</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">moveTo</span><span class="p">(</span><span class="mi">15</span><span class="p">,</span>  <span class="mi">5</span><span class="o">+</span><span class="n">i</span><span class="o">*</span><span class="mi">40</span><span class="p">);</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">45</span><span class="p">,</span> <span class="mi">45</span><span class="o">+</span><span class="n">i</span><span class="o">*</span><span class="mi">40</span><span class="p">);</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">75</span><span class="p">,</span>  <span class="mi">5</span><span class="o">+</span><span class="n">i</span><span class="o">*</span><span class="mi">40</span><span class="p">);</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">105</span><span class="p">,</span><span class="mi">45</span><span class="o">+</span><span class="n">i</span><span class="o">*</span><span class="mi">40</span><span class="p">);</span>
	    <span class="n">path</span><span class="p">.</span><span class="n">lineTo</span><span class="p">(</span><span class="mi">135</span><span class="p">,</span> <span class="mi">5</span><span class="o">+</span><span class="n">i</span><span class="o">*</span><span class="mi">40</span><span class="p">);</span>
	    <span class="n">paths</span><span class="p">.</span><span class="n">push_back</span><span class="p">(</span><span class="n">path</span><span class="p">);</span>
	<span class="p">}</span>

	<span class="c1">// Draw the first path with miter joins.</span>
	<span class="c1">// The connected segments are joined by extending their outside edges to</span>
	<span class="c1">// connect at a single point.</span>
	<span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setJoinStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">MiterJoin</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">paths</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">pen</span><span class="p">);</span>

	<span class="c1">// Draw the second path with bevel joins.</span>
	<span class="c1">// An additional triangular area is filled between the common endpoint of</span>
	<span class="c1">// connected segments and the separate outside rectangular corners of each</span>
	<span class="c1">// segment.</span>
	<span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setJoinStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">BevelJoin</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">paths</span><span class="p">[</span><span class="mi">1</span><span class="p">],</span> <span class="n">pen</span><span class="p">);</span>

	<span class="c1">// Draw the third path with round joins.</span>
	<span class="c1">// The corners of the shape are rounded off by filling an aditonal sector</span>
	<span class="c1">// of disc centered at the common endpoint of connected segments. The</span>
	<span class="c1">// radius of the rounded corners is equal to the line width.</span>
	<span class="n">pen</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span><span class="p">();</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">20</span><span class="p">);</span>
	<span class="n">pen</span><span class="p">.</span><span class="n">setJoinStyle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">RoundJoin</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">strokePath</span><span class="p">(</span><span class="n">paths</span><span class="p">[</span><span class="mi">2</span><span class="p">],</span> <span class="n">pen</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="nf">StyleWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PaintingTransformations">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBrush&gt;</span>
<span class="cp">#include &lt;Wt/WColor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPaintDevice&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>

<span class="k">class</span> <span class="nc">TransformationsWidget</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">TransformationsWidget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPaintedWidget</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">resize</span><span class="p">(</span><span class="mi">300</span><span class="p">,</span> <span class="mi">500</span><span class="p">);</span>  <span class="c1">// Provide a default size.</span>
    <span class="p">}</span>

<span class="nl">protected:</span>
    <span class="kt">void</span> <span class="n">paintEvent</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPaintDevice</span> <span class="o">*</span><span class="n">paintDevice</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="n">paintDevice</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setPen</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">red</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">black</span><span class="p">);</span>

	<span class="c1">// SAVE AND RESTORE CANVAS STATE EXAMPLE</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setPen</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">white</span><span class="p">);</span>
	<span class="c1">// Draw and fill a rectangle with the current brush.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span><span class="mi">100</span><span class="p">,</span><span class="mi">100</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>                 <span class="c1">// Save the canvas state on a stack.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">yellow</span><span class="p">);</span>   <span class="c1">// Change the fill style.</span>
	<span class="c1">// Draw a rectangle with the current settings.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span><span class="mi">10</span><span class="p">,</span><span class="mi">80</span><span class="p">,</span><span class="mi">80</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>                 <span class="c1">// Save the current canvas state.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">red</span><span class="p">);</span>      <span class="c1">// Change the fill style.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span><span class="mi">20</span><span class="p">,</span><span class="mi">60</span><span class="p">,</span><span class="mi">60</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>              <span class="c1">// Restore the previous canvas state.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">30</span><span class="p">,</span><span class="mi">30</span><span class="p">,</span><span class="mi">40</span><span class="p">,</span><span class="mi">40</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>              <span class="c1">// Restore the original canvas state.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawRect</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span><span class="mi">40</span><span class="p">,</span><span class="mi">20</span><span class="p">,</span><span class="mi">20</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>              <span class="c1">// Restore the original pen.</span>

	<span class="c1">// TRANSLATING</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">2</span><span class="p">;</span> <span class="n">i</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="n">i</span><span class="o">*</span><span class="mi">100</span><span class="p">,</span> <span class="mi">130</span><span class="p">);</span>
	    <span class="n">drawFilledPolygon</span><span class="p">(</span><span class="n">painter</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span> <span class="o">-</span> <span class="n">i</span><span class="o">*</span><span class="mi">200</span><span class="p">));</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>
	<span class="p">}</span>

	<span class="c1">// ROTATING</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">300</span><span class="p">);</span>  <span class="c1">// Translate the origin for a Y-offset of rings</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">90</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>   <span class="c1">// Translate the origin for a X-offset of rings</span>
	<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">ring</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">ring</span> <span class="o">&lt;</span> <span class="mi">6</span><span class="p">;</span> <span class="n">ring</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>  <span class="c1">// Loop through rings</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WBrush</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">51</span><span class="o">*</span><span class="n">ring</span><span class="p">,</span> <span class="p">(</span><span class="mi">255</span><span class="o">-</span><span class="mi">51</span><span class="o">*</span><span class="n">ring</span><span class="p">),</span> <span class="mi">255</span><span class="p">)));</span>

	    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">j</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">j</span> <span class="o">&lt;</span> <span class="n">ring</span> <span class="o">*</span> <span class="mi">6</span><span class="p">;</span> <span class="n">j</span><span class="o">++</span><span class="p">)</span> <span class="p">{</span>           <span class="c1">// Draw individual dots:</span>
		<span class="n">painter</span><span class="p">.</span><span class="n">rotate</span><span class="p">(</span><span class="mi">360</span> <span class="o">/</span> <span class="p">(</span><span class="n">ring</span><span class="o">*</span><span class="mi">6</span><span class="p">));</span>            <span class="c1">// 1. Rotate full circle in ring*6 steps</span>
		<span class="n">painter</span><span class="p">.</span><span class="n">drawEllipse</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">ring</span><span class="o">*</span><span class="mf">12.5</span><span class="p">,</span> <span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span> <span class="c1">// 2. Draw a dot.</span>
	    <span class="p">}</span>
	    <span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>
	<span class="p">}</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>          <span class="c1">// Reset the X-offset.</span>

	<span class="c1">// SCALING</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">save</span><span class="p">();</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">100</span><span class="p">);</span>
	<span class="n">drawFilledPolygon</span><span class="p">(</span><span class="n">painter</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">));</span>   <span class="c1">// no scaling.</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">translate</span><span class="p">(</span><span class="mi">100</span><span class="p">,</span><span class="mi">0</span><span class="p">);</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">scale</span><span class="p">(</span><span class="mf">1.2</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>                                  <span class="c1">// with X scaling</span>
	<span class="n">drawFilledPolygon</span><span class="p">(</span><span class="n">painter</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">255</span><span class="p">,</span><span class="mi">0</span><span class="p">,</span> <span class="mi">55</span><span class="p">));</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">restore</span><span class="p">();</span>
  <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">void</span> <span class="n">drawFilledPolygon</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="o">&amp;</span><span class="n">painter</span><span class="p">,</span> <span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="o">&amp;</span> <span class="n">color</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">setBrush</span><span class="p">(</span><span class="n">color</span><span class="p">);</span>
	<span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span> <span class="n">points</span><span class="p">[]</span> 
	    <span class="o">=</span> <span class="p">{</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mi">0</span><span class="p">),</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">80</span><span class="p">,</span> <span class="mf">34.6</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">60</span><span class="p">,</span> <span class="mf">69.2</span><span class="p">),</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mf">69.2</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mf">34.6</span><span class="p">),</span>
		<span class="n">Wt</span><span class="o">::</span><span class="n">WPointF</span><span class="p">(</span><span class="mi">20</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> <span class="p">};</span>
	<span class="n">painter</span><span class="p">.</span><span class="n">drawPolygon</span><span class="p">(</span><span class="n">points</span><span class="p">,</span> <span class="mi">6</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="nf">TransformationsWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Panel">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPanel&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPanel</span> <span class="o">*</span><span class="n">panel</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPanel</span><span class="p">();</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;centered-example&quot;</span><span class="p">);</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;Terrific panel&quot;</span><span class="p">);</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">setCentralWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This is a panel with a title.&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-PanelCollapsible">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WAnimation&gt;</span>
<span class="cp">#include &lt;Wt/WPanel&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPanel</span> <span class="o">*</span><span class="n">panel</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPanel</span><span class="p">();</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">setTitle</span><span class="p">(</span><span class="s">&quot;Collapsible panel&quot;</span><span class="p">);</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;centered-example&quot;</span><span class="p">);</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">setCollapsible</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WAnimation</span> <span class="n">animation</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAnimation</span><span class="o">::</span><span class="n">SlideInFromTop</span><span class="p">,</span>
			 <span class="n">Wt</span><span class="o">::</span><span class="n">WAnimation</span><span class="o">::</span><span class="n">EaseOut</span><span class="p">,</span>
			 <span class="mi">100</span><span class="p">);</span>

<span class="n">panel</span><span class="o">-&gt;</span><span class="n">setAnimation</span><span class="p">(</span><span class="n">animation</span><span class="p">);</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">setCentralWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This panel can be collapsed.&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-PanelNoTitle">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPanel&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPanel</span> <span class="o">*</span><span class="n">panel</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPanel</span><span class="p">();</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;centered-example&quot;</span><span class="p">);</span>
<span class="n">panel</span><span class="o">-&gt;</span><span class="n">setCentralWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This is a default panel.&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-Path">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Next&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="o">::</span><span class="n">InternalPath</span><span class="p">,</span> <span class="s">&quot;/navigation/anchor&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-PathChange">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WAnchor&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>

<span class="kt">void</span> <span class="n">handlePathChange</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span><span class="p">)</span>
<span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span> <span class="o">*</span><span class="n">app</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">instance</span><span class="p">();</span>

    <span class="k">if</span> <span class="p">(</span><span class="n">app</span><span class="o">-&gt;</span><span class="n">internalPath</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;/navigation/shop&quot;</span><span class="p">)</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Currently shopping.&lt;/p&gt;&quot;</span><span class="p">);</span>
    <span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">app</span><span class="o">-&gt;</span><span class="n">internalPath</span><span class="p">()</span> <span class="o">==</span> <span class="s">&quot;/navigation/eat&quot;</span><span class="p">)</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Needed some food, eating now!&lt;/p&gt;&quot;</span><span class="p">);</span>
    <span class="k">else</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;&lt;i&gt;Idle.&lt;/i&gt;&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}</span>

<span class="p">}</span>

<span class="cm">/*</span>
<span class="cm"> * Create two links to internal paths.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="o">::</span><span class="n">InternalPath</span><span class="p">,</span> <span class="s">&quot;/navigation/shop&quot;</span><span class="p">),</span>
		<span class="s">&quot;Shop&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot; &quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="o">::</span><span class="n">InternalPath</span><span class="p">,</span> <span class="s">&quot;/navigation/eat&quot;</span><span class="p">),</span>
		<span class="s">&quot;Eat&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Handle the internal path events.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span> <span class="o">*</span><span class="n">app</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">instance</span><span class="p">();</span>

<span class="n">app</span><span class="o">-&gt;</span><span class="n">internalPathChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
     <span class="n">handlePathChange</span><span class="p">(</span><span class="n">out</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">handlePathChange</span><span class="p">(</span><span class="n">out</span><span class="p">);</span>
        
</pre></div>
  </message>
  <message id="src-PdfImage">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPainter&gt;</span>
<span class="cp">#include &lt;Wt/WPdfImage&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WResource&gt;</span>

<span class="k">class</span> <span class="nc">SamplePdfResource</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPdfImage</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">SamplePdfResource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
        <span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPdfImage</span><span class="p">(</span><span class="mi">400</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="n">suggestFileName</span><span class="p">(</span><span class="s">&quot;line.pdf&quot;</span><span class="p">);</span>
        <span class="n">paint</span><span class="p">();</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">void</span> <span class="n">paint</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">painter</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>

        <span class="n">Wt</span><span class="o">::</span><span class="n">WPen</span> <span class="n">thickPen</span><span class="p">;</span>
        <span class="n">thickPen</span><span class="p">.</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>
        <span class="n">painter</span><span class="p">.</span><span class="n">setPen</span><span class="p">(</span><span class="n">thickPen</span><span class="p">);</span>
        <span class="n">painter</span><span class="p">.</span><span class="n">drawLine</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">250</span><span class="p">,</span> <span class="mi">150</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
        <span class="n">painter</span><span class="p">.</span><span class="n">drawLine</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">250</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>

        <span class="n">painter</span><span class="p">.</span><span class="n">drawText</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">400</span><span class="p">,</span> <span class="mi">300</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignCenter</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignTop</span><span class="p">,</span>
                         <span class="s">&quot;Hello, PDF&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span> <span class="o">*</span><span class="n">pdf</span> <span class="o">=</span> <span class="k">new</span> <span class="n">SamplePdfResource</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Create pdf&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PdfRenderer">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WResource&gt;</span>
<span class="cp">#include &lt;Wt/Http/Request&gt;</span>
<span class="cp">#include &lt;Wt/Http/Response&gt;</span>
<span class="cp">#include &lt;Wt/Render/WPdfRenderer&gt;</span>
<span class="cp">#include &lt;Wt/WApplication&gt;</span>

<span class="cp">#include &lt;hpdf.h&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>
    <span class="kt">void</span> <span class="n">HPDF_STDCALL</span> <span class="n">error_handler</span><span class="p">(</span><span class="n">HPDF_STATUS</span> <span class="n">error_no</span><span class="p">,</span> <span class="n">HPDF_STATUS</span> <span class="n">detail_no</span><span class="p">,</span>
		       <span class="kt">void</span> <span class="o">*</span><span class="n">user_data</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">fprintf</span><span class="p">(</span><span class="n">stderr</span><span class="p">,</span> <span class="s">&quot;libharu error: error_no=%04X, detail_no=%d</span><span class="se">\n</span><span class="s">&quot;</span><span class="p">,</span>
		<span class="p">(</span><span class="kt">unsigned</span> <span class="kt">int</span><span class="p">)</span> <span class="n">error_no</span><span class="p">,</span> <span class="p">(</span><span class="kt">int</span><span class="p">)</span> <span class="n">detail_no</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="k">class</span> <span class="nc">ReportResource</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">ReportResource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">suggestFileName</span><span class="p">(</span><span class="s">&quot;report.pdf&quot;</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="k">virtual</span> <span class="kt">void</span> <span class="n">handleRequest</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Http</span><span class="o">::</span><span class="n">Request</span><span class="o">&amp;</span> <span class="n">request</span><span class="p">,</span>
			       <span class="n">Wt</span><span class="o">::</span><span class="n">Http</span><span class="o">::</span><span class="n">Response</span><span class="o">&amp;</span> <span class="n">response</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">response</span><span class="p">.</span><span class="n">setMimeType</span><span class="p">(</span><span class="s">&quot;application/pdf&quot;</span><span class="p">);</span>

	<span class="n">HPDF_Doc</span> <span class="n">pdf</span> <span class="o">=</span> <span class="n">HPDF_New</span><span class="p">(</span><span class="n">error_handler</span><span class="p">,</span> <span class="mi">0</span><span class="p">);</span>

	<span class="c1">// Note: UTF-8 encoding (for TrueType fonts) is only available since libharu 2.3.0 !</span>
	<span class="n">HPDF_UseUTFEncodings</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>

	<span class="n">renderReport</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>

	<span class="n">HPDF_SaveToStream</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
	<span class="kt">unsigned</span> <span class="kt">int</span> <span class="n">size</span> <span class="o">=</span> <span class="n">HPDF_GetStreamSize</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
	<span class="n">HPDF_BYTE</span> <span class="o">*</span><span class="n">buf</span> <span class="o">=</span> <span class="k">new</span> <span class="n">HPDF_BYTE</span><span class="p">[</span><span class="n">size</span><span class="p">];</span>
	<span class="n">HPDF_ReadFromStream</span> <span class="p">(</span><span class="n">pdf</span><span class="p">,</span> <span class="n">buf</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">size</span><span class="p">);</span>
	<span class="n">HPDF_Free</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
	<span class="n">response</span><span class="p">.</span><span class="n">out</span><span class="p">().</span><span class="n">write</span><span class="p">((</span><span class="kt">char</span><span class="o">*</span><span class="p">)</span><span class="n">buf</span><span class="p">,</span> <span class="n">size</span><span class="p">);</span>
	<span class="k">delete</span><span class="p">[]</span> <span class="n">buf</span><span class="p">;</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">void</span> <span class="n">renderReport</span><span class="p">(</span><span class="n">HPDF_Doc</span> <span class="n">pdf</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">renderPdf</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;report.example&quot;</span><span class="p">),</span> <span class="n">pdf</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">renderPdf</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">&amp;</span> <span class="n">html</span><span class="p">,</span> <span class="n">HPDF_Doc</span> <span class="n">pdf</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">HPDF_Page</span> <span class="n">page</span> <span class="o">=</span> <span class="n">HPDF_AddPage</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
	<span class="n">HPDF_Page_SetSize</span><span class="p">(</span><span class="n">page</span><span class="p">,</span> <span class="n">HPDF_PAGE_SIZE_A4</span><span class="p">,</span> <span class="n">HPDF_PAGE_PORTRAIT</span><span class="p">);</span>

	<span class="n">Wt</span><span class="o">::</span><span class="n">Render</span><span class="o">::</span><span class="n">WPdfRenderer</span> <span class="n">renderer</span><span class="p">(</span><span class="n">pdf</span><span class="p">,</span> <span class="n">page</span><span class="p">);</span>
	<span class="n">renderer</span><span class="p">.</span><span class="n">setMargin</span><span class="p">(</span><span class="mf">2.54</span><span class="p">);</span>
	<span class="n">renderer</span><span class="p">.</span><span class="n">setDpi</span><span class="p">(</span><span class="mi">96</span><span class="p">);</span>
	<span class="n">renderer</span><span class="p">.</span><span class="n">render</span><span class="p">(</span><span class="n">html</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;report.example&quot;</span><span class="p">),</span> <span class="n">container</span><span class="p">);</span>
<span class="n">text</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;reset&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Create pdf&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span> <span class="o">*</span><span class="n">pdf</span> <span class="o">=</span> <span class="k">new</span> <span class="n">ReportResource</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">pdf</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PieChart">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/Chart/WPieChart&gt;</span>
<span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WEnvironment&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItem&gt;</span>
<span class="cp">#include &lt;Wt/WTableView&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>
    <span class="cm">/*</span>
<span class="cm">     * A standard item which converts text edits to numbers</span>
<span class="cm">     */</span>
    <span class="k">class</span> <span class="nc">NumericItem</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItem</span> <span class="p">{</span>
    <span class="nl">public:</span>
	<span class="k">virtual</span> <span class="n">NumericItem</span> <span class="o">*</span><span class="n">clone</span><span class="p">()</span> <span class="k">const</span> <span class="p">{</span>
	    <span class="k">return</span> <span class="k">new</span> <span class="n">NumericItem</span><span class="p">();</span>
	<span class="p">}</span>

	<span class="k">virtual</span> <span class="kt">void</span> <span class="n">setData</span><span class="p">(</span><span class="k">const</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="o">&amp;</span><span class="n">data</span><span class="p">,</span> <span class="kt">int</span> <span class="n">role</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">UserRole</span><span class="p">)</span> <span class="p">{</span>
	    <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">dt</span><span class="p">;</span>

	    <span class="k">if</span> <span class="p">(</span><span class="n">role</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">EditRole</span><span class="p">)</span> <span class="p">{</span>
		<span class="kt">double</span> <span class="n">d</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">asNumber</span><span class="p">(</span><span class="n">data</span><span class="p">);</span>

		<span class="k">if</span> <span class="p">(</span><span class="n">d</span> <span class="o">!=</span> <span class="n">d</span><span class="p">)</span>
		    <span class="n">dt</span> <span class="o">=</span> <span class="n">data</span><span class="p">;</span>
		<span class="k">else</span>
		    <span class="n">dt</span> <span class="o">=</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">(</span><span class="n">d</span><span class="p">);</span>
	    <span class="p">}</span>

	    <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItem</span><span class="o">::</span><span class="n">setData</span><span class="p">(</span><span class="n">dt</span><span class="p">,</span> <span class="n">role</span><span class="p">);</span>
	<span class="p">}</span>
    <span class="p">};</span>
<span class="p">}</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setItemPrototype</span><span class="p">(</span><span class="k">new</span> <span class="n">NumericItem</span><span class="p">());</span>

<span class="c1">// Configure the header.</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">insertColumns</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">(),</span> <span class="mi">2</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setHeaderData</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Item&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setHeaderData</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Sales&quot;</span><span class="p">));</span>

<span class="c1">// Set data in the model.</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">insertRows</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">(),</span> <span class="mi">6</span><span class="p">);</span>
<span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span>

<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Blueberry&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Blueberry&quot;</span><span class="p">),</span> <span class="n">Wt</span><span class="o">::</span><span class="n">ToolTipRole</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">120</span><span class="p">);</span>

<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="o">++</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Cherry&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">30</span><span class="p">);</span>

<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="o">++</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Apple&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">260</span><span class="p">);</span>

<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="o">++</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Boston Cream&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">160</span><span class="p">);</span>

<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="o">++</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Other&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">40</span><span class="p">);</span>

<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="o">++</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Vanilla Cream&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span>  <span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">120</span><span class="p">);</span>

<span class="c1">// Set all items to be editable.</span>
<span class="k">for</span> <span class="p">(</span><span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">row</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="o">++</span><span class="n">row</span><span class="p">)</span>
    <span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">col</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">col</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="o">++</span><span class="n">col</span><span class="p">)</span>
	<span class="n">model</span><span class="o">-&gt;</span><span class="n">item</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="n">col</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setFlags</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ItemIsEditable</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span><span class="o">*</span> <span class="n">table</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">table</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLength</span><span class="o">::</span><span class="n">Auto</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setSortingEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnWidth</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="mi">100</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setRowHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setWidth</span><span class="p">(</span><span class="mi">150</span> <span class="o">+</span> <span class="mi">100</span> <span class="o">+</span> <span class="mi">14</span> <span class="o">+</span> <span class="mi">2</span><span class="p">);</span>

<span class="k">if</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">instance</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">environment</span><span class="p">().</span><span class="n">ajax</span><span class="p">())</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">SingleClicked</span><span class="p">);</span>
<span class="k">else</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">NoEditTrigger</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Create the pie chart.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WPieChart</span> <span class="o">*</span><span class="n">chart</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WPieChart</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>       <span class="c1">// Set the model.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setLabelsColumn</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>    <span class="c1">// Set the column that holds the labels.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setDataColumn</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>      <span class="c1">// Set the column that holds the data.</span>

<span class="c1">// Configure location and type of labels.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setDisplayLabels</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">Outside</span> <span class="o">|</span>
                        <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">TextLabel</span> <span class="o">|</span>
                        <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">TextPercentage</span><span class="p">);</span>

<span class="c1">// Enable a 3D and shadow effect.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setPerspectiveEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">,</span> <span class="mf">0.2</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setShadowEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setExplode</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mf">0.3</span><span class="p">);</span>  <span class="c1">// Explode the first item.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">300</span><span class="p">);</span>    <span class="c1">// WPaintedWidget must be given an explicit size.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span> <span class="c1">// Add margin vertically.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLength</span><span class="o">::</span><span class="n">Auto</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span> <span class="c1">// Center horizontally.</span>
</pre></div>
  </message>
  <message id="src-PlainTable">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WTable&gt;</span>
<span class="cp">#include &lt;Wt/WTableCell&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>
    <span class="k">struct</span> <span class="n">Employee</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">firstName</span><span class="p">;</span>
	<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">lastName</span><span class="p">;</span>
	<span class="kt">double</span> <span class="n">pay</span><span class="p">;</span>

        <span class="n">Employee</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">aFirstName</span><span class="p">,</span> 
		 <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">aLastName</span><span class="p">,</span>
		 <span class="kt">double</span> <span class="n">aPay</span><span class="p">)</span>
	  <span class="o">:</span> <span class="n">firstName</span><span class="p">(</span><span class="n">aFirstName</span><span class="p">),</span>
	    <span class="n">lastName</span><span class="p">(</span><span class="n">aLastName</span><span class="p">),</span>
	    <span class="n">pay</span><span class="p">(</span><span class="n">aPay</span><span class="p">)</span> <span class="p">{</span> <span class="p">}</span>
    <span class="p">};</span>

    <span class="n">Employee</span> <span class="n">employees</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
      <span class="n">Employee</span><span class="p">(</span><span class="s">&quot;Mark&quot;</span><span class="p">,</span> <span class="s">&quot;Otto&quot;</span><span class="p">,</span> <span class="mi">100</span><span class="p">),</span>
      <span class="n">Employee</span><span class="p">(</span><span class="s">&quot;Jacob&quot;</span><span class="p">,</span> <span class="s">&quot;Thornton&quot;</span><span class="p">,</span> <span class="mi">50</span><span class="p">),</span>
      <span class="n">Employee</span><span class="p">(</span><span class="s">&quot;Larry the Bird&quot;</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
    <span class="p">};</span>
<span class="p">}</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTable</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTable</span><span class="p">();</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderCount</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setWidth</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLength</span><span class="p">(</span><span class="s">&quot;100%&quot;</span><span class="p">));</span>

<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;#&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;First Name&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Last Name&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Pay&quot;</span><span class="p">));</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Employee</span><span class="o">&amp;</span> <span class="n">employee</span> <span class="o">=</span> <span class="n">employees</span><span class="p">[</span><span class="n">i</span><span class="p">];</span>
    <span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>

    <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span>
        <span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;{1}&quot;</span><span class="p">)</span>
				  <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">row</span><span class="p">)));</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span>
        <span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">employee</span><span class="p">.</span><span class="n">firstName</span><span class="p">));</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span>
        <span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">employee</span><span class="p">.</span><span class="n">lastName</span><span class="p">));</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span>
        <span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;{1}&quot;</span><span class="p">)</span>
				      <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">employee</span><span class="p">.</span><span class="n">pay</span><span class="p">)));</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-Popup">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WMenuItem&gt;</span>
<span class="cp">#include &lt;Wt/WMessageBox&gt;</span>
<span class="cp">#include &lt;Wt/WPopupMenu&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span> <span class="o">*</span><span class="n">popup</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">status</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">();</span>
<span class="n">status</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">();</span>

<span class="c1">// Create some menu items for the popup menu</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Connect&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">triggered</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Connecting...&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Disconnect&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">triggered</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;You are disconnected now.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>

<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;icons/house.png&quot;</span><span class="p">,</span> <span class="s">&quot;I&#39;m home&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">triggered</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WMenuItem</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Don&#39;t disturb&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setCheckable</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">item</span><span class="o">-&gt;</span><span class="n">triggered</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;{1} item is {2}.&lt;/p&gt;&quot;</span><span class="p">)</span>
		 <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">())</span>
		 <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">isChecked</span><span class="p">()</span> <span class="o">?</span> <span class="s">&quot;checked&quot;</span> <span class="o">:</span> <span class="s">&quot;unchecked&quot;</span><span class="p">));</span>
<span class="p">}));</span>

<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>

<span class="c1">// Create a submenu for the popup menu.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span> <span class="o">*</span><span class="n">subMenu</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span><span class="p">();</span>

<span class="n">subMenu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Contents&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">triggered</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;This could be a link to /contents.html.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">subMenu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Index&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">triggered</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;This could be a link to /index.html.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">subMenu</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>
<span class="n">subMenu</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;About&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">triggered</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WMessageBox</span> <span class="o">*</span><span class="n">messageBox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WMessageBox</span>
        <span class="p">(</span><span class="s">&quot;About&quot;</span><span class="p">,</span> <span class="s">&quot;&lt;p&gt;This is a program to make connections.&lt;/p&gt;&quot;</span><span class="p">,</span>
	 <span class="n">Wt</span><span class="o">::</span><span class="n">Information</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Ok</span><span class="p">);</span>
    <span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">show</span><span class="p">();</span>
    <span class="n">messageBox</span><span class="o">-&gt;</span><span class="n">buttonClicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	<span class="k">delete</span> <span class="n">messageBox</span><span class="p">;</span>
    <span class="p">}));</span>
<span class="p">}));</span>

<span class="c1">// Assign the submenu to the parent popup menu.</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addMenu</span><span class="p">(</span><span class="s">&quot;Help&quot;</span><span class="p">,</span> <span class="n">subMenu</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setMenu</span><span class="p">(</span><span class="n">popup</span><span class="p">);</span>

<span class="c1">// React to an item selection</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">itemSelected</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMenuItem</span> <span class="o">*</span><span class="n">item</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">status</span><span class="o">-&gt;</span><span class="n">setText</span>
        <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;Selected menu item: {1}.&quot;</span><span class="p">)</span>
	 <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">()));</span>
<span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>

<span class="n">container</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">status</span><span class="p">);</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">out</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-ProgressBar">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WProgressBar&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTimer&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;inline-buttons&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WProgressBar</span> <span class="o">*</span><span class="n">bar</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WProgressBar</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">bar</span><span class="o">-&gt;</span><span class="n">setRange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">10</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">startButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Start&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">stopButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Stop&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">resetButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Reset&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="c1">// Initially, only the start button is enabled.</span>
<span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
<span class="n">resetButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>

<span class="c1">// setup an interval timer which generates a timeout() signal every second.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WTimer</span> <span class="o">*</span><span class="n">intervalTimer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTimer</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">intervalTimer</span><span class="o">-&gt;</span><span class="n">setInterval</span><span class="p">(</span><span class="mi">1000</span><span class="p">);</span>

<span class="n">startButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">bar</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">()</span> <span class="o">&lt;</span> <span class="mi">10</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">intervalTimer</span><span class="o">-&gt;</span><span class="n">start</span><span class="p">();</span>
	<span class="n">startButton</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Resume&quot;</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="n">startButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
    <span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">enable</span><span class="p">();</span>
    <span class="n">resetButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
<span class="p">}));</span>

<span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">intervalTimer</span><span class="o">-&gt;</span><span class="n">stop</span><span class="p">();</span>

    <span class="n">startButton</span><span class="o">-&gt;</span><span class="n">enable</span><span class="p">();</span>
    <span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
    <span class="n">resetButton</span><span class="o">-&gt;</span><span class="n">enable</span><span class="p">();</span>
<span class="p">}));</span>

<span class="n">resetButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">bar</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="mf">0.0</span><span class="p">);</span>
    <span class="n">startButton</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Start&quot;</span><span class="p">);</span>

    <span class="n">startButton</span><span class="o">-&gt;</span><span class="n">enable</span><span class="p">();</span>
    <span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
    <span class="n">resetButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
<span class="p">}));</span>

<span class="n">intervalTimer</span><span class="o">-&gt;</span><span class="n">timeout</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">bar</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="n">bar</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">()</span> <span class="o">+</span> <span class="mi">1</span><span class="p">);</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">bar</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">()</span> <span class="o">==</span> <span class="mi">10</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">emit</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMouseEvent</span><span class="p">());</span>
	<span class="n">startButton</span><span class="o">-&gt;</span><span class="n">disable</span><span class="p">();</span>
    <span class="p">}</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-PushButton">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">();</span>

<span class="n">result</span><span class="o">-&gt;</span><span class="n">setTemplateText</span><span class="p">(</span><span class="s">&quot;&lt;div&gt; ${pb1} ${pb2} &lt;/div&gt;&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">pb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Click me!&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;pb1&quot;</span><span class="p">,</span> <span class="n">pb</span><span class="p">);</span>  <span class="c1">// By default the button is enabled.</span>

<span class="n">pb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Try to click me...&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;pb2&quot;</span><span class="p">,</span> <span class="n">pb</span><span class="p">);</span>
<span class="n">pb</span><span class="o">-&gt;</span><span class="n">setEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>          <span class="c1">// The second button is disabled.</span>
</pre></div>
  </message>
  <message id="src-PushButtonAction">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;pushButtonAction-template&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-save&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-primary&quot;</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Cancel&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-cancel&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PushButtonColor">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;pushButtonColor-template&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Default&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-default&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Primary&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-primary&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-primary&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Info&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-info&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-info&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Success&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-success&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-success&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Warning&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-warning&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-warning&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Danger&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-danger&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-danger&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Inverse&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-inverse&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-inverse&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Link&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-link&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-link&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PushButtonDropdownAppended">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WPopupMenu&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;appendedDropdownButton-template&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span> <span class="o">*</span><span class="n">popup</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span><span class="p">();</span>

<span class="c1">// Create some menu items for the popup menu</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Choose a button type&quot;</span><span class="p">);</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;One-time hit button&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;#one-time&quot;</span><span class="p">));</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Navigation button&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;#navigation&quot;</span><span class="p">));</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Button style&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;#style&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">input</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;input&quot;</span><span class="p">,</span> <span class="n">input</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">appendedDropdownButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Action&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;appendedButton&quot;</span><span class="p">,</span> <span class="n">appendedDropdownButton</span><span class="p">);</span>
<span class="n">appendedDropdownButton</span><span class="o">-&gt;</span><span class="n">setMenu</span><span class="p">(</span><span class="n">popup</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PushButtonDropdownPrepended">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WPopupMenu&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;prependedDropdownButton-template&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span> <span class="o">*</span><span class="n">popup</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span><span class="p">();</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Choose a button type&quot;</span><span class="p">);</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;One-time hit button&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;#one-time&quot;</span><span class="p">));</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Navigation button&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;#navigation&quot;</span><span class="p">));</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Button style&quot;</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="s">&quot;#style&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">input</span>  <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;input&quot;</span><span class="p">,</span> <span class="n">input</span><span class="p">);</span>
<span class="n">input</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span2&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">prependedDropdownButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Action&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;prependedButton&quot;</span><span class="p">,</span> <span class="n">prependedDropdownButton</span><span class="p">);</span>
<span class="n">prependedDropdownButton</span><span class="o">-&gt;</span><span class="n">setMenu</span><span class="p">(</span><span class="n">popup</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PushButtonLink">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Navigate&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="o">::</span><span class="n">InternalPath</span><span class="p">,</span> <span class="s">&quot;/navigation/anchor&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-PushButtonOnce">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">ok</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Send&quot;</span><span class="p">);</span>

<span class="n">ok</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">ok</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="o">::</span><span class="n">disable</span><span class="p">);</span>
<span class="n">ok</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]()</span> <span class="p">{</span>
    <span class="n">ok</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Thank you&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-PushButtonPrimary">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-primary&quot;</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Cancel&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-PushButtonSize">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;pushButtonSize-template&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Large&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-lg&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-large&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Default&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-default&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Small&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-sm&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-small&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Mini&quot;</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;btn-xs&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button-mini&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-RadioButtonGroup">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WButtonGroup&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WRadioButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WButtonGroup</span> <span class="o">*</span><span class="n">group</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WButtonGroup</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span> <span class="o">*</span><span class="n">button</span><span class="p">;</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;Radio me!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;No, radio me!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;Nono, radio me!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">button</span><span class="p">);</span>

<span class="n">group</span><span class="o">-&gt;</span><span class="n">setSelectedButtonIndex</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span> <span class="c1">// Select the first button by default.</span>
</pre></div>
  </message>
  <message id="src-RadioButtonStack">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WButtonGroup&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WRadioButton&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WButtonGroup</span> <span class="o">*</span><span class="n">group</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WButtonGroup</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span> <span class="o">*</span><span class="n">button</span><span class="p">;</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;Radio me!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;No, radio me!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">button</span><span class="p">);</span>

<span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;Nono, radio me!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">button</span><span class="p">);</span>

<span class="n">group</span><span class="o">-&gt;</span><span class="n">setSelectedButtonIndex</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span> <span class="c1">// Select the first button by default.</span>
</pre></div>
  </message>
  <message id="src-RadioButtonsActivated">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WButtonGroup&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WRadioButton&gt;</span>
<span class="cp">#include &lt;Wt/WString&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WButtonGroup</span> <span class="o">*</span><span class="n">group</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WButtonGroup</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span> <span class="o">*</span><span class="n">rb</span><span class="p">;</span>

<span class="n">rb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;sleeping&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">rb</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">rb</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>

<span class="n">rb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;eating&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">rb</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">rb</span><span class="p">,</span> <span class="mi">2</span><span class="p">);</span>

<span class="n">rb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;driving&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">rb</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">rb</span><span class="p">,</span> <span class="mi">3</span><span class="p">);</span>

<span class="n">rb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;learning Wt&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">rb</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">group</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">rb</span><span class="p">,</span> <span class="mi">4</span><span class="p">);</span>

<span class="n">group</span><span class="o">-&gt;</span><span class="n">setSelectedButtonIndex</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span> <span class="c1">// Select the first button by default.</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">group</span><span class="o">-&gt;</span><span class="n">checkedChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span> <span class="o">*</span><span class="n">selection</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">text</span><span class="p">;</span>

    <span class="k">switch</span> <span class="p">(</span><span class="n">group</span><span class="o">-&gt;</span><span class="n">id</span><span class="p">(</span><span class="n">selection</span><span class="p">))</span> <span class="p">{</span>
    <span class="k">case</span> <span class="mi">1</span>: <span class="n">text</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;You checked button {1}.&quot;</span><span class="p">)</span>
	    <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">group</span><span class="o">-&gt;</span><span class="n">checkedId</span><span class="p">());</span>
	<span class="k">break</span><span class="p">;</span>

    <span class="k">case</span> <span class="mi">2</span>: <span class="n">text</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;You selected button {1}.&quot;</span><span class="p">)</span>
	    <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">group</span><span class="o">-&gt;</span><span class="n">checkedId</span><span class="p">());</span>
	<span class="k">break</span><span class="p">;</span>

    <span class="k">case</span> <span class="mi">3</span>: <span class="n">text</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;You clicked button {1}.&quot;</span><span class="p">)</span>
	    <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">group</span><span class="o">-&gt;</span><span class="n">checkedId</span><span class="p">());</span>
	<span class="k">break</span><span class="p">;</span>
    <span class="p">}</span>

    <span class="n">text</span> <span class="o">+=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;... Are your really {1} now?&quot;</span><span class="p">)</span>
	<span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">selection</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">());</span>

    <span class="k">if</span> <span class="p">(</span><span class="n">group</span><span class="o">-&gt;</span><span class="n">id</span><span class="p">(</span><span class="n">selection</span><span class="p">)</span> <span class="o">==</span> <span class="mi">4</span><span class="p">)</span>
	<span class="n">text</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;That&#39;s what I expected!&quot;</span><span class="p">);</span>

    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;&quot;</span><span class="p">)</span> <span class="o">+</span> <span class="n">text</span> <span class="o">+</span> <span class="s">&quot;&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-RadioButtonsLoose">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WRadioButton&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;Radio me!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WRadioButton</span><span class="p">(</span><span class="s">&quot;Radio me too!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-ResourceCustom">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WAnchor&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/Http/Request&gt;</span>
<span class="cp">#include &lt;Wt/Http/Response&gt;</span>
<span class="cp">#include &lt;Wt/WObject&gt;</span>
<span class="cp">#include &lt;Wt/WResource&gt;</span>

<span class="k">class</span> <span class="nc">MyResource</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="n">MyResource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">suggestFileName</span><span class="p">(</span><span class="s">&quot;data.txt&quot;</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="o">~</span><span class="n">MyResource</span><span class="p">()</span> <span class="p">{</span>
	<span class="n">beingDeleted</span><span class="p">();</span>
    <span class="p">}</span>

    <span class="kt">void</span> <span class="n">handleRequest</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Http</span><span class="o">::</span><span class="n">Request</span> <span class="o">&amp;</span><span class="n">request</span><span class="p">,</span>
		       <span class="n">Wt</span><span class="o">::</span><span class="n">Http</span><span class="o">::</span><span class="n">Response</span> <span class="o">&amp;</span><span class="n">response</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">response</span><span class="p">.</span><span class="n">setMimeType</span><span class="p">(</span><span class="s">&quot;plain/text&quot;</span><span class="p">);</span>
	<span class="n">response</span><span class="p">.</span><span class="n">out</span><span class="p">()</span> <span class="o">&lt;&lt;</span> <span class="s">&quot;I am a text file.&quot;</span> <span class="o">&lt;&lt;</span> <span class="n">std</span><span class="o">::</span><span class="n">endl</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WResource</span> <span class="o">*</span><span class="n">textResource</span> <span class="o">=</span> <span class="k">new</span> <span class="n">MyResource</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span> <span class="o">*</span><span class="n">anchor</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAnchor</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">textResource</span><span class="p">),</span> <span class="s">&quot;Download file&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">anchor</span><span class="o">-&gt;</span><span class="n">setTarget</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">TargetNewWindow</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-ResourceStatic">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPainter&gt;</span>
<span class="cp">#include &lt;Wt/WResource&gt;</span>
<span class="cp">#include &lt;Wt/WServer&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="c1">//Wt::WResource *resource = new SamplePdfResource(container);</span>

<span class="c1">//Wt::WServer::addResource(resource, &quot;/media/static-resource&quot;);</span>
</pre></div>
  </message>
  <message id="src-Resources">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Resources&lt;/p&gt;&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-ScatterPlotCurve">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/Chart/WCartesianChart&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WTimer&gt;</span>

<span class="cp">#include &lt;cmath&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setHeaderData</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;X&quot;</span><span class="p">));</span>
<span class="n">model</span><span class="o">-&gt;</span><span class="n">setHeaderData</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Y = sin(X)&quot;</span><span class="p">));</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">40</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="kt">double</span> <span class="n">x</span> <span class="o">=</span> <span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="kt">double</span><span class="o">&gt;</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">-</span> <span class="mi">20</span><span class="p">)</span> <span class="o">/</span> <span class="mi">4</span><span class="p">;</span>

    <span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">x</span><span class="p">);</span>
    <span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span><span class="p">));</span>
<span class="p">}</span>

<span class="cm">/*</span>
<span class="cm"> * Create the scatter plot.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span> <span class="o">*</span><span class="n">chart</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>        <span class="c1">// Set the model.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setXSeriesColumn</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>    <span class="c1">// Set the column that holds the X data.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setLegendEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span> <span class="c1">// Enable the legend.</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setType</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ScatterPlot</span><span class="p">);</span>   <span class="c1">// Set type to ScatterPlot.</span>

<span class="c1">// Typically, for mathematical functions, you want the axes to cross</span>
<span class="c1">// at the 0 mark:</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">axis</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XAxis</span><span class="p">).</span><span class="n">setLocation</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZeroValue</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">axis</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">YAxis</span><span class="p">).</span><span class="n">setLocation</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ZeroValue</span><span class="p">);</span>

<span class="c1">// Provide space for the X and Y axis and title.</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setPlotAreaPadding</span><span class="p">(</span><span class="mi">80</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setPlotAreaPadding</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span>

<span class="c1">// Add the curves</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WDataSeries</span> <span class="n">s</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">CurveSeries</span><span class="p">);</span>
<span class="n">s</span><span class="p">.</span><span class="n">setShadow</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WShadow</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">127</span><span class="p">),</span> <span class="mi">3</span><span class="p">));</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">addSeries</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">300</span><span class="p">);</span> <span class="c1">// WPaintedWidget must be given explicit size.</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span>            <span class="c1">// Add margin vertically</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLength</span><span class="o">::</span><span class="n">Auto</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span> <span class="c1">// Center horizontally</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTimer</span> <span class="o">*</span><span class="n">t</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTimer</span><span class="p">(</span><span class="n">chart</span><span class="p">);</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">setInterval</span><span class="p">(</span><span class="mi">25</span><span class="p">);</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">start</span><span class="p">();</span>

<span class="kt">double</span> <span class="o">*</span><span class="n">phi</span> <span class="o">=</span> <span class="k">new</span> <span class="kt">double</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>

<span class="n">t</span><span class="o">-&gt;</span><span class="n">timeout</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
  <span class="o">*</span><span class="n">phi</span> <span class="o">+=</span> <span class="mf">0.1</span><span class="p">;</span>

  <span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">40</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="kt">double</span> <span class="n">x</span> <span class="o">=</span> <span class="p">(</span><span class="k">static_cast</span><span class="o">&lt;</span><span class="kt">double</span><span class="o">&gt;</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">-</span> <span class="mi">20</span><span class="p">)</span> <span class="o">/</span> <span class="mi">4</span><span class="p">;</span>

    <span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">x</span><span class="p">);</span>
    <span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">sin</span><span class="p">(</span><span class="n">x</span> <span class="o">+</span> <span class="o">*</span><span class="n">phi</span><span class="p">));</span>
  <span class="p">}</span>      
    <span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-ScatterPlotData">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/Chart/WCartesianChart&gt;</span>
<span class="cp">#include &lt;Wt/Chart/WDataSeries&gt;</span>
<span class="cp">#include &lt;Wt/WAbstractItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WAbstractItemView&gt;</span>
<span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WDate&gt;</span>
<span class="cp">#include &lt;Wt/WEnvironment&gt;</span>
<span class="cp">#include &lt;Wt/WPaintedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WItemDelegate&gt;</span>
<span class="cp">#include &lt;Wt/WShadow&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WTableView&gt;</span>

<span class="cp">#include &quot;../treeview-dragdrop/CsvUtil.h&quot;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStandardItemModel</span> <span class="o">*</span><span class="n">model</span>
    <span class="o">=</span> <span class="n">csvToModel</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">appRoot</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;timeseries.csv&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">model</span><span class="p">)</span>
    <span class="k">return</span> <span class="n">container</span><span class="p">;</span>

<span class="cm">/*</span>
<span class="cm"> * Parses the first column as dates, to be able to use a date scale</span>
<span class="cm"> */</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">row</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">rowCount</span><span class="p">();</span> <span class="o">++</span><span class="n">row</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">s</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">asString</span><span class="p">(</span><span class="n">model</span><span class="o">-&gt;</span><span class="n">data</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">));</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span> <span class="n">date</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">::</span><span class="n">fromString</span><span class="p">(</span><span class="n">s</span><span class="p">,</span> <span class="s">&quot;dd/MM/yy&quot;</span><span class="p">);</span>
    <span class="n">model</span><span class="o">-&gt;</span><span class="n">setData</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">date</span><span class="p">);</span>
  <span class="p">}</span>

<span class="c1">// Renders the data in a table.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setSortingEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnResizeEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setAlternatingRowColors</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnAlignment</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignCenter</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderAlignment</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignCenter</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setRowHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnWidth</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">80</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">column</span> <span class="o">=</span> <span class="mi">1</span><span class="p">;</span> <span class="n">column</span> <span class="o">&lt;</span> <span class="n">model</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="o">++</span><span class="n">column</span><span class="p">)</span>
    <span class="n">table</span><span class="o">-&gt;</span><span class="n">setColumnWidth</span><span class="p">(</span><span class="n">column</span><span class="p">,</span> <span class="mi">90</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">783</span><span class="p">,</span> <span class="mi">200</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Use a delegate for the numeric data which rounds values sensibly.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WItemDelegate</span> <span class="o">*</span><span class="n">delegate</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WItemDelegate</span><span class="p">(</span><span class="n">table</span><span class="p">);</span>
<span class="n">delegate</span><span class="o">-&gt;</span><span class="n">setTextFormat</span><span class="p">(</span><span class="s">&quot;%.1f&quot;</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setItemDelegate</span><span class="p">(</span><span class="n">delegate</span><span class="p">);</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setItemDelegateForColumn</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WItemDelegate</span><span class="p">(</span><span class="n">table</span><span class="p">));</span>

<span class="cm">/*</span>
<span class="cm"> * Creates the scatter plot.</span>
<span class="cm"> */</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span> <span class="o">*</span><span class="n">chart</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setBackground</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">220</span><span class="p">,</span> <span class="mi">220</span><span class="p">,</span> <span class="mi">220</span><span class="p">));</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setXSeriesColumn</span><span class="p">(</span><span class="mi">0</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setLegendEnabled</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setType</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">ScatterPlot</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">axis</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">XAxis</span><span class="p">).</span><span class="n">setScale</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">DateScale</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Provide ample space for the title, the X and Y axis and the legend.</span>
<span class="cm"> */</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setPlotAreaPadding</span><span class="p">(</span><span class="mi">40</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setPlotAreaPadding</span><span class="p">(</span><span class="mi">120</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Add the second and the third column as line series.</span>
<span class="cm"> */</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">2</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">4</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WDataSeries</span> <span class="n">s</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">LineSeries</span><span class="p">);</span>
    <span class="n">s</span><span class="p">.</span><span class="n">setShadow</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WShadow</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">3</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WColor</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">127</span><span class="p">),</span> <span class="mi">3</span><span class="p">));</span>
    <span class="n">chart</span><span class="o">-&gt;</span><span class="n">addSeries</span><span class="p">(</span><span class="n">s</span><span class="p">);</span>
<span class="p">}</span>

<span class="n">chart</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">800</span><span class="p">,</span> <span class="mi">400</span><span class="p">);</span>
<span class="n">chart</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLength</span><span class="o">::</span><span class="n">Auto</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-SelectionBoxExtended">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WSelectionBox&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSelectionBox</span> <span class="o">*</span><span class="n">sb2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSelectionBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Bacon&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Cheese&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Mushrooms&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Green peppers&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Ham&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Pepperoni&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Red peppers&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Turkey&quot;</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">setSelectionMode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ExtendedSelection</span><span class="p">);</span>
<span class="n">std</span><span class="o">::</span><span class="n">set</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">selection</span><span class="p">;</span>    <span class="c1">// By default select the items with index 1 and 4.</span>
<span class="n">selection</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>        <span class="c1">// Index 1 corresponds to the 2nd item.</span>
<span class="n">selection</span><span class="p">.</span><span class="n">insert</span><span class="p">(</span><span class="mi">4</span><span class="p">);</span>        <span class="c1">// Index 4 corresponds to the 5th item.</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">setSelectedIndexes</span><span class="p">(</span><span class="n">selection</span><span class="p">);</span>
<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">sb2</span><span class="o">-&gt;</span><span class="n">activated</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">selected</span><span class="p">;</span>

    <span class="n">std</span><span class="o">::</span><span class="n">set</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;</span> <span class="n">selection</span> <span class="o">=</span> <span class="n">sb2</span><span class="o">-&gt;</span><span class="n">selectedIndexes</span><span class="p">();</span>
    <span class="k">for</span> <span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">set</span><span class="o">&lt;</span><span class="kt">int</span><span class="o">&gt;::</span><span class="n">iterator</span> <span class="n">it</span> <span class="o">=</span> <span class="n">selection</span><span class="p">.</span><span class="n">begin</span><span class="p">();</span>
	 <span class="n">it</span> <span class="o">!=</span> <span class="n">selection</span><span class="p">.</span><span class="n">end</span><span class="p">();</span> <span class="o">++</span><span class="n">it</span><span class="p">)</span> <span class="p">{</span>
	<span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">selected</span><span class="p">.</span><span class="n">empty</span><span class="p">())</span>
	    <span class="n">selected</span> <span class="o">+=</span> <span class="s">&quot;, &quot;</span><span class="p">;</span>

	<span class="n">selected</span> <span class="o">+=</span> <span class="n">sb2</span><span class="o">-&gt;</span><span class="n">itemText</span><span class="p">(</span><span class="o">*</span><span class="n">it</span><span class="p">);</span>
    <span class="p">}</span>

    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;You choose {1}.&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">selected</span><span class="p">));</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-SelectionBoxSimple">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WSelectionBox&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSelectionBox</span> <span class="o">*</span><span class="n">sb1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSelectionBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">sb1</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Heavy&quot;</span><span class="p">);</span>
<span class="n">sb1</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Medium&quot;</span><span class="p">);</span>
<span class="n">sb1</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Light&quot;</span><span class="p">);</span>
<span class="n">sb1</span><span class="o">-&gt;</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span> <span class="c1">// Select &#39;medium&#39; by default.</span>
<span class="n">sb1</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Right</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">sb1</span><span class="o">-&gt;</span><span class="n">activated</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;You selected {1}.&quot;</span><span class="p">)</span>
		 <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">sb1</span><span class="o">-&gt;</span><span class="n">currentText</span><span class="p">()));</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-SimpleForm">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;simpleForm-template&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">name</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="n">name</span><span class="p">);</span>
<span class="n">name</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;first name&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;OK&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;out&quot;</span><span class="p">,</span> <span class="n">out</span><span class="p">);</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Hello, &quot;</span> <span class="o">+</span> <span class="n">name</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;! I just want to help you... You&quot;</span>
                 <span class="o">+</span> <span class="s">&quot; could complete this simple form by adding validation.&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-SizingBlock">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WComboBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WString&gt;</span>
<span class="cp">#include &lt;Wt/WTextArea&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-block-level&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;This is a line edit with style class&quot;</span>
                   <span class="s">&quot; .input-block-level applied to it.&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span> <span class="o">*</span><span class="n">combo</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WComboBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">combo</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-block-level&quot;</span><span class="p">);</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span><span class="o">=</span><span class="mi">1</span><span class="p">;</span> <span class="n">i</span><span class="o">&lt;</span><span class="mi">5</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
    <span class="n">combo</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Combo box with style class .input-block-level - item&quot;</span>
                   <span class="o">+</span> <span class="n">boost</span><span class="o">::</span><span class="n">lexical_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">i</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span> <span class="o">*</span><span class="n">area</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">area</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-block-level&quot;</span><span class="p">);</span>
<span class="n">area</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;This is a text area with style class&quot;</span>
                   <span class="s">&quot; .input-block-level applied to it.&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-SizingGrid">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WComboBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WTextArea&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parentContainer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">parentContainer</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.span8&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span8&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">childContainer</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">childContainer</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;controls-row&quot;</span><span class="p">);</span>

<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">childContainer</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.span1&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span1&quot;</span><span class="p">);</span>

<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">childContainer</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.span2&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span2&quot;</span><span class="p">);</span>

<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">childContainer</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.span3&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span3&quot;</span><span class="p">);</span>

<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">childContainer</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.span2&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span2&quot;</span><span class="p">);</span>

<span class="n">parentContainer</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">childContainer</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-SizingRelative">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WComboBox&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WTextArea&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.input-mini&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-mini&quot;</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.input-small&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-small&quot;</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.input-medium&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-medium&quot;</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.input-large&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-large&quot;</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.input-xlarge&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-xlarge&quot;</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;.input-xxlarge&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;input-xxlarge&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Slider">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WSlider&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;In which year are you born?&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSlider</span> <span class="o">*</span><span class="n">slider</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSlider</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">slider</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">500</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>
<span class="n">slider</span><span class="o">-&gt;</span><span class="n">setTickPosition</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WSlider</span><span class="o">::</span><span class="n">TicksAbove</span><span class="p">);</span>
<span class="n">slider</span><span class="o">-&gt;</span><span class="n">setTickInterval</span><span class="p">(</span><span class="mi">10</span><span class="p">);</span>
<span class="n">slider</span><span class="o">-&gt;</span><span class="n">setMinimum</span><span class="p">(</span><span class="mi">1910</span><span class="p">);</span>
<span class="n">slider</span><span class="o">-&gt;</span><span class="n">setMaximum</span><span class="p">(</span><span class="mi">2010</span><span class="p">);</span>
<span class="n">slider</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="mi">1960</span><span class="p">);</span>

<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">slider</span><span class="o">-&gt;</span><span class="n">valueChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;I&#39;m born in the year &quot;</span> <span class="o">+</span> <span class="n">slider</span><span class="o">-&gt;</span><span class="n">valueText</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;.&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-SliderVertical">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBreak&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WSlider&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;How much does Wt increase your efficiency?&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSlider</span> <span class="o">*</span><span class="n">verticalSlider</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSlider</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">Vertical</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">verticalSlider</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">50</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
<span class="n">verticalSlider</span><span class="o">-&gt;</span><span class="n">setTickPosition</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WSlider</span><span class="o">::</span><span class="n">TicksBothSides</span><span class="p">);</span>
<span class="n">verticalSlider</span><span class="o">-&gt;</span><span class="n">setRange</span><span class="p">(</span><span class="mi">5</span><span class="p">,</span> <span class="mi">50</span><span class="p">);</span>

<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WBreak</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span><span class="p">);</span>

<span class="n">verticalSlider</span><span class="o">-&gt;</span><span class="n">valueChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Currenly, my efficiency increased &quot;</span> <span class="o">+</span>
		 <span class="n">verticalSlider</span><span class="o">-&gt;</span><span class="n">valueText</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;%!&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-SmallTableView">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WStandardItemModel&gt;</span>
<span class="cp">#include &lt;Wt/WTableView&gt;</span>
<span class="cp">#include &quot;../treeview-dragdrop/CsvUtil.h&quot;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span> <span class="o">*</span><span class="n">tableView</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTableView</span><span class="p">();</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">csvToModel</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="o">::</span><span class="n">appRoot</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;table.csv&quot;</span><span class="p">,</span>
			       <span class="n">tableView</span><span class="p">));</span>

<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setColumnResizeEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setColumnAlignment</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignCenter</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setHeaderAlignment</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">AlignCenter</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setAlternatingRowColors</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setRowHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setHeaderHeight</span><span class="p">(</span><span class="mi">28</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setSelectionMode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">SingleSelection</span><span class="p">);</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">NoEditTrigger</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * Configure column widths and matching table width</span>
<span class="cm"> */</span>
<span class="k">const</span> <span class="kt">int</span> <span class="n">WIDTH</span> <span class="o">=</span> <span class="mi">120</span><span class="p">;</span>
<span class="k">for</span> <span class="p">(</span><span class="kt">int</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="n">tableView</span><span class="o">-&gt;</span><span class="n">model</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">();</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span>
    <span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setColumnWidth</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="mi">120</span><span class="p">);</span>

<span class="cm">/*</span>
<span class="cm"> * 7 pixels are padding/border per column</span>
<span class="cm"> * 2 pixels are border of the entire table</span>
<span class="cm"> */</span>
<span class="n">tableView</span><span class="o">-&gt;</span><span class="n">setWidth</span><span class="p">((</span><span class="n">WIDTH</span> <span class="o">+</span> <span class="mi">7</span><span class="p">)</span> <span class="o">*</span> <span class="n">tableView</span><span class="o">-&gt;</span><span class="n">model</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">columnCount</span><span class="p">()</span> <span class="o">+</span> <span class="mi">2</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Sound">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WSound&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSound</span> <span class="o">*</span><span class="n">sound</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSound</span><span class="p">(</span><span class="s">&quot;sounds/beep.mp3&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">sound</span><span class="o">-&gt;</span><span class="n">setLoops</span><span class="p">(</span><span class="mi">3</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">playButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Beep!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">playButton</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">stopButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Stop it!&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">playButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">sound</span><span class="o">-&gt;</span><span class="n">play</span><span class="p">();</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Beeping started!&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">stopButton</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">sound</span><span class="o">-&gt;</span><span class="n">stop</span><span class="p">();</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Beeping stopped!&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-SpinBox">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WDoubleSpinBox&gt;</span>
<span class="cp">#include &lt;Wt/WLabel&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;form-group&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLabel</span> <span class="o">*</span><span class="n">label</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLabel</span><span class="p">(</span><span class="s">&quot;Enter a number (0 - 100):&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WDoubleSpinBox</span> <span class="o">*</span><span class="n">sb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDoubleSpinBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">sb</span><span class="o">-&gt;</span><span class="n">setRange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">100</span><span class="p">);</span>
<span class="n">sb</span><span class="o">-&gt;</span><span class="n">setValue</span><span class="p">(</span><span class="mi">50</span><span class="p">);</span>
<span class="n">sb</span><span class="o">-&gt;</span><span class="n">setDecimals</span><span class="p">(</span><span class="mi">2</span><span class="p">);</span>
<span class="n">sb</span><span class="o">-&gt;</span><span class="n">setSingleStep</span><span class="p">(</span><span class="mf">0.1</span><span class="p">);</span>

<span class="n">label</span><span class="o">-&gt;</span><span class="n">setBuddy</span><span class="p">(</span><span class="n">sb</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">sb</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">sb</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">)</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;Spin box value changed to {1}&quot;</span><span class="p">)</span>
		     <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">sb</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">()));</span>
    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;Invalid spin box value!&quot;</span><span class="p">));</span>
    <span class="p">}</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-SplitButton">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPopupMenu&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WSplitButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSplitButton</span> <span class="o">*</span><span class="n">sb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSplitButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Left</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span> <span class="o">*</span><span class="n">popup</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPopupMenu</span><span class="p">();</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Save As ...&quot;</span><span class="p">);</span>
<span class="n">popup</span><span class="o">-&gt;</span><span class="n">addItem</span><span class="p">(</span><span class="s">&quot;Save Template&quot;</span><span class="p">);</span>

<span class="n">sb</span><span class="o">-&gt;</span><span class="n">dropDownButton</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">setMenu</span><span class="p">(</span><span class="n">popup</span><span class="p">);</span>

<span class="n">sb</span><span class="o">-&gt;</span><span class="n">actionButton</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Saved!&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">popup</span><span class="o">-&gt;</span><span class="n">itemSelected</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMenuItem</span> <span class="o">*</span><span class="n">item</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">item</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">());</span>
<span class="p">},</span> <span class="n">std</span><span class="o">::</span><span class="n">placeholders</span><span class="o">::</span><span class="n">_1</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-Stack">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WSpinBox&gt;</span>
<span class="cp">#include &lt;Wt/WStackedWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WSpinBox</span> <span class="o">*</span><span class="n">sb</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WSpinBox</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">sb</span><span class="o">-&gt;</span><span class="n">setRange</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span><span class="mi">2</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WStackedWidget</span> <span class="o">*</span><span class="n">stack</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WStackedWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">stack</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;strong&gt;Stacked widget-index 0&lt;/strong&gt;&quot;</span>
                               <span class="s">&quot;&lt;p&gt;Hello&lt;/p&gt;&quot;</span><span class="p">));</span>
<span class="n">stack</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;strong&gt;Stacked widget-index 1&lt;/strong&gt;&quot;</span>
                               <span class="s">&quot;&lt;p&gt;This is Wt&lt;/p&gt;&quot;</span><span class="p">));</span>
<span class="n">stack</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;strong&gt;Stacked widget-index 2&lt;/strong&gt;&quot;</span>
                               <span class="s">&quot;&lt;p&gt;Do you like it?&lt;/p&gt;&quot;</span><span class="p">));</span>

<span class="n">sb</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">sb</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">())</span>
	<span class="n">stack</span><span class="o">-&gt;</span><span class="n">setCurrentIndex</span><span class="p">(</span><span class="n">sb</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">());</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-StyledTable">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WTable&gt;</span>
<span class="cp">#include &lt;Wt/WTableCell&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WCheckBox&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>
    <span class="k">struct</span> <span class="n">Employee</span> <span class="p">{</span>
	<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">firstName</span><span class="p">;</span>
	<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">lastName</span><span class="p">;</span>
	<span class="kt">double</span> <span class="n">pay</span><span class="p">;</span>

        <span class="n">Employee</span><span class="p">(</span><span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">aFirstName</span><span class="p">,</span> 
		 <span class="k">const</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&amp;</span> <span class="n">aLastName</span><span class="p">,</span>
		 <span class="kt">double</span> <span class="n">aPay</span><span class="p">)</span>
	  <span class="o">:</span> <span class="n">firstName</span><span class="p">(</span><span class="n">aFirstName</span><span class="p">),</span>
	    <span class="n">lastName</span><span class="p">(</span><span class="n">aLastName</span><span class="p">),</span>
	    <span class="n">pay</span><span class="p">(</span><span class="n">aPay</span><span class="p">)</span> <span class="p">{</span> <span class="p">}</span>
    <span class="p">};</span>

    <span class="n">Employee</span> <span class="n">employees</span><span class="p">[]</span> <span class="o">=</span> <span class="p">{</span>
      <span class="n">Employee</span><span class="p">(</span><span class="s">&quot;Mark&quot;</span><span class="p">,</span> <span class="s">&quot;Otto&quot;</span><span class="p">,</span> <span class="mi">100</span><span class="p">),</span>
      <span class="n">Employee</span><span class="p">(</span><span class="s">&quot;Jacob&quot;</span><span class="p">,</span> <span class="s">&quot;Thornton&quot;</span><span class="p">,</span> <span class="mi">50</span><span class="p">),</span>
      <span class="n">Employee</span><span class="p">(</span><span class="s">&quot;Larry the Bird&quot;</span><span class="p">,</span> <span class="s">&quot;&quot;</span><span class="p">,</span> <span class="mi">10</span><span class="p">)</span>
    <span class="p">};</span>


    <span class="kt">void</span> <span class="nf">addOptionToggle</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WWidget</span> <span class="o">*</span><span class="n">widget</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">option</span><span class="p">,</span> 
			 <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">styleClass</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">parent</span><span class="p">)</span> <span class="p">{</span>
  	<span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span> <span class="o">*</span><span class="n">checkBox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WCheckBox</span><span class="p">(</span><span class="n">option</span><span class="p">,</span> <span class="n">parent</span><span class="p">);</span>
	<span class="n">checkBox</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
	<span class="n">checkBox</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
	      <span class="n">widget</span><span class="o">-&gt;</span><span class="n">toggleStyleClass</span><span class="p">(</span><span class="n">styleClass</span><span class="p">,</span> <span class="n">checkBox</span><span class="o">-&gt;</span><span class="n">isChecked</span><span class="p">());</span>
	<span class="p">}));</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTable</span> <span class="o">*</span><span class="n">table</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTable</span><span class="p">();</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">setHeaderCount</span><span class="p">(</span><span class="mi">1</span><span class="p">);</span>

<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;#&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;First Name&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Last Name&quot;</span><span class="p">));</span>
<span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">3</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Pay&quot;</span><span class="p">));</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">Employee</span><span class="o">&amp;</span> <span class="n">employee</span> <span class="o">=</span> <span class="n">employees</span><span class="p">[</span><span class="n">i</span><span class="p">];</span>
    <span class="kt">int</span> <span class="n">row</span> <span class="o">=</span> <span class="n">i</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>

    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;{1}&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">row</span><span class="p">),</span>
		  <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">0</span><span class="p">));</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">employee</span><span class="p">.</span><span class="n">firstName</span><span class="p">,</span> <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">1</span><span class="p">));</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">employee</span><span class="p">.</span><span class="n">lastName</span><span class="p">,</span> <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">2</span><span class="p">));</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">fromUTF8</span><span class="p">(</span><span class="s">&quot;{1}&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">employee</span><span class="p">.</span><span class="n">pay</span><span class="p">),</span>
		      <span class="n">table</span><span class="o">-&gt;</span><span class="n">elementAt</span><span class="p">(</span><span class="n">row</span><span class="p">,</span> <span class="mi">3</span><span class="p">));</span>
<span class="p">}</span>

<span class="n">table</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;table form-inline&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">table</span><span class="p">);</span>

<span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Options:&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>

<span class="n">addOptionToggle</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="s">&quot;borders&quot;</span><span class="p">,</span> <span class="s">&quot;table-bordered&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">addOptionToggle</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="s">&quot;hover&quot;</span><span class="p">,</span> <span class="s">&quot;table-hover&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">addOptionToggle</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="s">&quot;condensed&quot;</span><span class="p">,</span> <span class="s">&quot;table-condensed&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
<span class="n">addOptionToggle</span><span class="p">(</span><span class="n">table</span><span class="p">,</span> <span class="s">&quot;stripes&quot;</span><span class="p">,</span> <span class="s">&quot;table-striped&quot;</span><span class="p">,</span> <span class="n">result</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Tab">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WMenuItem&gt;</span>
<span class="cp">#include &lt;Wt/WTabWidget&gt;</span>
<span class="cp">#include &lt;Wt/WTextArea&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTabWidget</span> <span class="o">*</span><span class="n">tabW</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTabWidget</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">tabW</span><span class="o">-&gt;</span><span class="n">addTab</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;This is the contents of the first tab.&quot;</span><span class="p">),</span>
	     <span class="s">&quot;First&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTabWidget</span><span class="o">::</span><span class="n">PreLoading</span><span class="p">);</span>
<span class="n">tabW</span><span class="o">-&gt;</span><span class="n">addTab</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;The contents of the tabs are pre-loaded in&quot;</span>
			       <span class="s">&quot; the browser to ensure swift switching.&quot;</span><span class="p">),</span>
	     <span class="s">&quot;Preload&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTabWidget</span><span class="o">::</span><span class="n">PreLoading</span><span class="p">);</span>
<span class="n">tabW</span><span class="o">-&gt;</span><span class="n">addTab</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;You could change any other style attribute of the&quot;</span>
			       <span class="s">&quot; tab widget by modifying the style class.&quot;</span>
			       <span class="s">&quot; The style class &#39;trhead&#39; is applied to this tab.&quot;</span><span class="p">),</span>
	     <span class="s">&quot;Style&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTabWidget</span><span class="o">::</span><span class="n">PreLoading</span><span class="p">)</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;trhead&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WMenuItem</span> <span class="o">*</span><span class="n">tab</span> 
    <span class="o">=</span> <span class="n">tabW</span><span class="o">-&gt;</span><span class="n">addTab</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="s">&quot;You can close this tab&quot;</span>
				     <span class="s">&quot; by clicking on the close icon.&quot;</span><span class="p">),</span>
		   <span class="s">&quot;Close&quot;</span><span class="p">);</span>
<span class="n">tab</span><span class="o">-&gt;</span><span class="n">setCloseable</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">tabW</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;tabwidget&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Template">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">t</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;WTemplate-example&quot;</span><span class="p">));</span>

<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;name-edit&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">());</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;save-button&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">));</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;cancel-button&quot;</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Cancel&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-TextArea">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTextArea&gt;</span>
<span class="cp">#include &lt;Wt/WDateTime&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span> <span class="o">*</span><span class="n">ta</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextArea</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">ta</span><span class="o">-&gt;</span><span class="n">setColumns</span><span class="p">(</span><span class="mi">80</span><span class="p">);</span>
<span class="n">ta</span><span class="o">-&gt;</span><span class="n">setRows</span><span class="p">(</span><span class="mi">5</span><span class="p">);</span>
<span class="n">ta</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Change this text... </span><span class="se">\n</span><span class="s">&quot;</span>
            <span class="s">&quot;and click outside the text area to get a changed event.&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;&lt;/p&gt;&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="s">&quot;help-block&quot;</span><span class="p">);</span>

<span class="n">ta</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Text area changed at &quot;</span> <span class="o">+</span>
                 <span class="n">Wt</span><span class="o">::</span><span class="n">WDateTime</span><span class="o">::</span><span class="n">currentDateTime</span><span class="p">().</span><span class="n">toString</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot;.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-TextDeferredToolTip">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WString&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>

<span class="k">class</span> <span class="nc">Text</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span>
<span class="p">{</span>
<span class="nl">public:</span>
  <span class="n">Text</span><span class="p">()</span> <span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(){}</span>

  <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">calculateToolTip</span><span class="p">()</span> <span class="k">const</span>
  <span class="p">{</span>
    <span class="k">return</span> <span class="s">&quot;Deferred tooltip&quot;</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="k">virtual</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span> <span class="n">toolTip</span><span class="p">()</span> <span class="k">const</span>
  <span class="p">{</span>
    <span class="k">return</span> <span class="n">calculateToolTip</span><span class="p">();</span>
  <span class="p">}</span>
<span class="p">};</span>


<span class="n">Text</span> <span class="o">*</span><span class="n">text</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Text</span><span class="p">();</span>
<span class="n">text</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Text&quot;</span><span class="p">);</span>
<span class="n">text</span><span class="o">-&gt;</span><span class="n">setDeferredToolTip</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-TextEdit">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/Utils&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTextEdit&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTextEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTextEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setHeight</span><span class="p">(</span><span class="mi">300</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;&quot;</span>
    <span class="s">&quot;&lt;span style=</span><span class="se">\&quot;</span><span class="s">font-family: &#39;courier new&#39;, courier; font-size: medium;</span><span class="se">\&quot;</span><span class="s">&gt;&quot;</span>
    <span class="s">&quot;&lt;strong&gt;WTextEdit&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&quot;</span>
    <span class="s">&quot;&lt;p&gt;Hey, I&#39;m a &lt;strong&gt;WTextEdit&lt;/strong&gt; and you can make me&quot;</span>
        <span class="s">&quot; &lt;span style=</span><span class="se">\&quot;</span><span class="s">text-decoration: underline;</span><span class="se">\&quot;</span><span class="s">&gt;&lt;em&gt;rich&lt;/em&gt;&lt;/span&gt;&quot;</span>
        <span class="s">&quot; by adding your &lt;span style=</span><span class="se">\&quot;</span><span class="s">color: #ff0000;</span><span class="se">\&quot;</span><span class="s">&gt;&lt;em&gt;style&lt;/em&gt;&quot;</span>
	<span class="s">&quot;&lt;/span&gt;!&lt;/p&gt;&quot;</span>
    <span class="s">&quot;&lt;p&gt;Other widgets like...&lt;/p&gt;&quot;</span>
      <span class="s">&quot;&lt;ul style=</span><span class="se">\&quot;</span><span class="s">padding: 0px; margin: 0px 0px 10px 25px;</span><span class="se">\&quot;</span><span class="s">&gt;&quot;</span>
        <span class="s">&quot;&lt;li&gt;WLineEdit&lt;/li&gt;&quot;</span>
        <span class="s">&quot;&lt;li&gt;WTextArea&lt;/li&gt;&quot;</span>
        <span class="s">&quot;&lt;li&gt;WSpinBox&lt;/li&gt;&quot;</span>
      <span class="s">&quot;&lt;/ul&gt;&quot;</span>
    <span class="s">&quot;&lt;p&gt;don&#39;t have style.&lt;/p&gt;&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Get text&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">button</span><span class="o">-&gt;</span><span class="n">setMargin</span><span class="p">(</span><span class="mi">10</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Top</span> <span class="o">|</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Bottom</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;xhtml-output&quot;</span><span class="p">);</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;pre&gt;&quot;</span> <span class="o">+</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Utils</span><span class="o">::</span><span class="n">htmlEncode</span><span class="p">(</span><span class="n">edit</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">())</span> <span class="o">+</span> <span class="s">&quot;&lt;/pre&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-TextEditors">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WTextEdit&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">le</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">le</span><span class="o">-&gt;</span><span class="n">setEmptyText</span><span class="p">(</span><span class="s">&quot;Edit me&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setReadOnly</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>

<span class="n">le</span><span class="o">-&gt;</span><span class="n">keyWentUp</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Line edit: key up event&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">le</span><span class="o">-&gt;</span><span class="n">enterPressed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Line edit: enter pressed event&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-TextEvents">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="c1">// Create four text widgets.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text1</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This text reacts to &lt;tt&gt;clicked()&lt;/tt&gt;&quot;</span><span class="p">,</span> <span class="n">container</span><span class="p">);</span>
<span class="n">text1</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;reactive&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text2</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This text reacts to &lt;tt&gt;doubleClicked()&lt;/tt&gt;&quot;</span><span class="p">,</span>
                  <span class="n">container</span><span class="p">);</span>
<span class="n">text2</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;reactive&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text3</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This text reacts to &lt;tt&gt;mouseWentOver()&lt;/tt&gt;&quot;</span><span class="p">,</span>
                  <span class="n">container</span><span class="p">);</span>
<span class="n">text3</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;reactive&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text4</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This text reacts to &lt;tt&gt;mouseWentOut()&lt;/tt&gt;&quot;</span><span class="p">,</span>
                  <span class="n">container</span><span class="p">);</span>
<span class="n">text4</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;reactive&quot;</span><span class="p">);</span>

<span class="c1">// Create an additional text control to show status messages.</span>
<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="c1">// Assign a signal/slot mechanism to the text controls.</span>
<span class="n">text1</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Text was clicked.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">text2</span><span class="o">-&gt;</span><span class="n">doubleClicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Text was double clicked.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">text3</span><span class="o">-&gt;</span><span class="n">mouseWentOver</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Mouse went over text.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">text4</span><span class="o">-&gt;</span><span class="n">mouseWentOut</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Mouse went out text.&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-TextPlain">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text</span>
  <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This is an example of plain text. &quot;</span>
		  <span class="s">&quot;Any contained special XHTML characters, &quot;</span>
		  <span class="s">&quot;such as </span><span class="se">\&quot;</span><span class="s">&lt;</span><span class="se">\&quot;</span><span class="s"> and </span><span class="se">\&quot;</span><span class="s">&gt;</span><span class="se">\&quot;</span><span class="s">, &quot;</span>
		  <span class="s">&quot;are automatically escaped.&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">PlainText</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-TextSide">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">result</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;editSide-template&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">(</span><span class="s">&quot;Username&quot;</span><span class="p">);</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span2&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;name&quot;</span><span class="p">,</span> <span class="n">edit</span><span class="p">);</span>

<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span2&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;amount1&quot;</span><span class="p">,</span> <span class="n">edit</span><span class="p">);</span>

<span class="n">edit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">edit</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;span2&quot;</span><span class="p">);</span>
<span class="n">result</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;amount2&quot;</span><span class="p">,</span> <span class="n">edit</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-TextToolTip">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text</span>
  <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Some text&quot;</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">PlainText</span><span class="p">);</span>

<span class="n">text</span><span class="o">-&gt;</span><span class="n">setToolTip</span><span class="p">(</span><span class="s">&quot;ToolTip&quot;</span><span class="p">,</span>  <span class="n">Wt</span><span class="o">::</span><span class="n">XHTMLText</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-TextXHTML">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text</span>
    <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;This is &lt;b&gt;XHTML&lt;/b&gt; markup text. &quot;</span>
		    <span class="s">&quot;It supports a safe subset of XHTML tags and &quot;</span>
		    <span class="s">&quot;attributes, which have only decorative &quot;</span>
		    <span class="s">&quot;functions.&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-TextXSS">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WText&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">text</span> 
    <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;This XHTML text contains JavaScript, &quot;</span>
		    <span class="s">&quot;wich is filtered by the XSS filter.&lt;/p&gt;&quot;</span>
		    <span class="s">&quot;&lt;script&gt;alert(</span><span class="se">\&quot;</span><span class="s">XSS Attack!</span><span class="se">\&quot;</span><span class="s">);&lt;/script&gt;&quot;</span>
		    <span class="s">&quot;&lt;p&gt;A warning is printed in the logs.&lt;/p&gt;&quot;</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-TimeEdit">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WCalendar&gt;</span>
<span class="cp">#include &lt;Wt/WDate&gt;</span>
<span class="cp">#include &lt;Wt/WTimeEdit&gt;</span>
<span class="cp">#include &lt;Wt/WLabel&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>
<span class="cp">#include &lt;Wt/WString&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">form</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;timeEdit-template&quot;</span><span class="p">));</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTimeEdit</span> <span class="o">*</span><span class="n">de1</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTimeEdit</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;from&quot;</span><span class="p">,</span> <span class="n">de1</span><span class="p">);</span>
<span class="n">de1</span><span class="o">-&gt;</span><span class="n">setTime</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTime</span><span class="o">::</span><span class="n">currentServerTime</span><span class="p">());</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTimeEdit</span> <span class="o">*</span><span class="n">de2</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTimeEdit</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;to&quot;</span><span class="p">,</span> <span class="n">de2</span><span class="p">);</span>
<span class="n">de2</span><span class="o">-&gt;</span><span class="n">setFormat</span><span class="p">(</span><span class="s">&quot;HH:mm:ss&quot;</span><span class="p">);</span> <span class="c1">// Apply a different date format.</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">);</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;save&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">();</span>
<span class="n">form</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;out&quot;</span><span class="p">,</span> <span class="n">out</span><span class="p">);</span>

<span class="n">de1</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Time picker 1 is changed.&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>

<span class="n">de2</span><span class="o">-&gt;</span><span class="n">changed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">)</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Time picker 2 is changed.&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">().</span><span class="n">empty</span><span class="p">()</span> <span class="o">||</span> <span class="n">de2</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">().</span><span class="n">empty</span><span class="p">())</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;You should enter two time!&quot;</span><span class="p">);</span>
    <span class="k">else</span> <span class="p">{</span>
	<span class="kt">int</span> <span class="n">secs</span> <span class="o">=</span> <span class="n">de1</span><span class="o">-&gt;</span><span class="n">time</span><span class="p">().</span><span class="n">secsTo</span><span class="p">(</span><span class="n">de2</span><span class="o">-&gt;</span><span class="n">time</span><span class="p">())</span> <span class="o">+</span> <span class="mi">1</span><span class="p">;</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">secs</span> <span class="o">&lt;=</span> <span class="mi">3600</span><span class="p">)</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;This is a really small range of time&quot;</span><span class="p">);</span>
	<span class="k">else</span> <span class="nf">if</span> <span class="p">(</span><span class="n">secs</span> <span class="o">&gt;</span> <span class="mi">3600</span><span class="p">)</span> 
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;So, you want to be delivered between &quot;</span>
				     <span class="s">&quot;{1} and {2} ?...&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">de1</span><span class="o">-&gt;</span><span class="n">time</span><span class="p">().</span><span class="n">toString</span><span class="p">()).</span><span class="n">arg</span><span class="p">(</span><span class="n">de2</span><span class="o">-&gt;</span><span class="n">time</span><span class="p">().</span><span class="n">toString</span><span class="p">()));</span>
	<span class="k">else</span>
	    <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Invalid period!&quot;</span><span class="p">);</span>
    <span class="p">}</span>

  
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-ToolBar">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WPopupMenu&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WToolBar&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>
    
    <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">createColorButton</span><span class="p">(</span><span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">className</span><span class="p">,</span>
				       <span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">&amp;</span> <span class="n">text</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">();</span>
	<span class="n">button</span><span class="o">-&gt;</span><span class="n">setTextFormat</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">XHTMLText</span><span class="p">);</span>
	<span class="n">button</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">text</span><span class="p">);</span>
	<span class="n">button</span><span class="o">-&gt;</span><span class="n">addStyleClass</span><span class="p">(</span><span class="n">className</span><span class="p">);</span>
	<span class="k">return</span> <span class="n">button</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">}</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">std</span><span class="o">::</span><span class="n">vector</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*&gt;</span> <span class="n">colorButtons</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WToolBar</span> <span class="o">*</span><span class="n">toolBar</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WToolBar</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">createColorButton</span><span class="p">(</span><span class="s">&quot;btn-primary&quot;</span><span class="p">,</span> <span class="s">&quot;Primary&quot;</span><span class="p">));</span>
<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">createColorButton</span><span class="p">(</span><span class="s">&quot;btn-danger&quot;</span><span class="p">,</span> <span class="s">&quot;Danger&quot;</span><span class="p">));</span>
<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">createColorButton</span><span class="p">(</span><span class="s">&quot;btn-success&quot;</span><span class="p">,</span> <span class="s">&quot;Success&quot;</span><span class="p">));</span>
<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">createColorButton</span><span class="p">(</span><span class="s">&quot;btn-warning&quot;</span><span class="p">,</span> <span class="s">&quot;Warning&quot;</span><span class="p">));</span>
<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">createColorButton</span><span class="p">(</span><span class="s">&quot;btn-inverse&quot;</span><span class="p">,</span> <span class="s">&quot;Inverse&quot;</span><span class="p">));</span>
<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">createColorButton</span><span class="p">(</span><span class="s">&quot;&quot;</span><span class="p">,</span> <span class="s">&quot;Default&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">resetButton</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Reset&quot;</span><span class="p">);</span>

<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addSeparator</span><span class="p">();</span>
<span class="n">toolBar</span><span class="o">-&gt;</span><span class="n">addButton</span><span class="p">(</span><span class="n">resetButton</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Tree">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WIconPair&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTree&gt;</span>
<span class="cp">#include &lt;Wt/WTreeNode&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTree</span> <span class="o">*</span><span class="n">tree</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTree</span><span class="p">();</span>

<span class="n">tree</span><span class="o">-&gt;</span><span class="n">setSelectionMode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ExtendedSelection</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WIconPair</span> <span class="o">*</span><span class="n">folderIcon</span> 
    <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WIconPair</span><span class="p">(</span><span class="s">&quot;icons/yellow-folder-closed.png&quot;</span><span class="p">,</span>
			<span class="s">&quot;icons/yellow-folder-open.png&quot;</span><span class="p">,</span> <span class="nb">false</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span> <span class="o">*</span><span class="n">node</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Furniture&quot;</span><span class="p">,</span> <span class="n">folderIcon</span><span class="p">);</span>

<span class="n">tree</span><span class="o">-&gt;</span><span class="n">setTreeRoot</span><span class="p">(</span><span class="n">node</span><span class="p">);</span>
<span class="n">node</span><span class="o">-&gt;</span><span class="n">label</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">setTextFormat</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">PlainText</span><span class="p">);</span>
<span class="n">node</span><span class="o">-&gt;</span><span class="n">setLoadPolicy</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="o">::</span><span class="n">NextLevelLoading</span><span class="p">);</span>
<span class="n">node</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Table&quot;</span><span class="p">));</span>
<span class="n">node</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Cupboard&quot;</span><span class="p">));</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span> <span class="o">*</span><span class="n">three</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Chair&quot;</span><span class="p">);</span>
<span class="n">node</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="n">three</span><span class="p">);</span>
<span class="n">node</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Coach&quot;</span><span class="p">));</span>
<span class="n">node</span><span class="o">-&gt;</span><span class="n">expand</span><span class="p">();</span>

<span class="n">three</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Doc&quot;</span><span class="p">));</span>
<span class="n">three</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Grumpy&quot;</span><span class="p">));</span>
<span class="n">three</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Happy&quot;</span><span class="p">));</span>
<span class="n">three</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Sneezy&quot;</span><span class="p">));</span>
<span class="n">three</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Dopey&quot;</span><span class="p">));</span>
<span class="n">three</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Bashful&quot;</span><span class="p">));</span>
<span class="n">three</span><span class="o">-&gt;</span><span class="n">addChildNode</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeNode</span><span class="p">(</span><span class="s">&quot;Sleepy&quot;</span><span class="p">));</span>
</pre></div>
  </message>
  <message id="src-TreeTable">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WIconPair&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WTree&gt;</span>
<span class="cp">#include &lt;Wt/WTreeTable&gt;</span>
<span class="cp">#include &lt;Wt/WTreeTableNode&gt;</span>

<span class="k">namespace</span> <span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span> <span class="o">*</span><span class="n">addNode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span> <span class="o">*</span><span class="n">parent</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">name</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">yuppie</span><span class="p">,</span> <span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">holidays</span><span class="p">,</span>
				<span class="k">const</span> <span class="kt">char</span> <span class="o">*</span><span class="n">favorite</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span> <span class="o">*</span><span class="n">node</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span><span class="p">(</span><span class="n">name</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">parent</span><span class="p">);</span>
	<span class="n">node</span><span class="o">-&gt;</span><span class="n">setColumnWidget</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">yuppie</span><span class="p">));</span>
	<span class="n">node</span><span class="o">-&gt;</span><span class="n">setColumnWidget</span><span class="p">(</span><span class="mi">2</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">holidays</span><span class="p">));</span>
	<span class="n">node</span><span class="o">-&gt;</span><span class="n">setColumnWidget</span><span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">favorite</span><span class="p">));</span>
	<span class="k">return</span> <span class="n">node</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">}</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTable</span> <span class="o">*</span><span class="n">treeTable</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTable</span><span class="p">();</span>

<span class="n">treeTable</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">650</span><span class="p">,</span> <span class="mi">200</span><span class="p">);</span>
<span class="n">treeTable</span><span class="o">-&gt;</span><span class="n">tree</span><span class="p">()</span><span class="o">-&gt;</span><span class="n">setSelectionMode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">ExtendedSelection</span><span class="p">);</span>
<span class="n">treeTable</span><span class="o">-&gt;</span><span class="n">addColumn</span><span class="p">(</span><span class="s">&quot;Yuppie Factor&quot;</span><span class="p">,</span> <span class="mi">125</span><span class="p">);</span>
<span class="n">treeTable</span><span class="o">-&gt;</span><span class="n">addColumn</span><span class="p">(</span><span class="s">&quot;# Holidays&quot;</span><span class="p">,</span> <span class="mi">125</span><span class="p">);</span>
<span class="n">treeTable</span><span class="o">-&gt;</span><span class="n">addColumn</span><span class="p">(</span><span class="s">&quot;Favorite Item&quot;</span><span class="p">,</span> <span class="mi">125</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span> <span class="o">*</span><span class="n">root</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span><span class="p">(</span><span class="s">&quot;All Personnel&quot;</span><span class="p">);</span>
<span class="n">treeTable</span><span class="o">-&gt;</span><span class="n">setTreeRoot</span><span class="p">(</span><span class="n">root</span><span class="p">,</span> <span class="s">&quot;Emweb Organigram&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span> <span class="o">*</span><span class="n">group</span><span class="p">;</span>

<span class="n">group</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span><span class="p">(</span><span class="s">&quot;Upper Management&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">root</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;Chief Anything Officer&quot;</span><span class="p">,</span> <span class="s">&quot;-2.8&quot;</span><span class="p">,</span> <span class="s">&quot;20&quot;</span><span class="p">,</span> <span class="s">&quot;Scepter&quot;</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;Vice President of Parties&quot;</span><span class="p">,</span> <span class="s">&quot;13.57&quot;</span><span class="p">,</span> <span class="s">&quot;365&quot;</span><span class="p">,</span> <span class="s">&quot;Flag&quot;</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;Vice President of Staplery&quot;</span><span class="p">,</span> <span class="s">&quot;3.42&quot;</span><span class="p">,</span> <span class="s">&quot;27&quot;</span><span class="p">,</span> <span class="s">&quot;Perforator&quot;</span><span class="p">);</span>

<span class="n">group</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span><span class="p">(</span><span class="s">&quot;Middle management&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">root</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;Boss of the house&quot;</span><span class="p">,</span> <span class="s">&quot;9.78&quot;</span><span class="p">,</span> <span class="s">&quot;35&quot;</span><span class="p">,</span> <span class="s">&quot;Happy Animals&quot;</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;Xena caretaker&quot;</span><span class="p">,</span> <span class="s">&quot;8.66&quot;</span><span class="p">,</span> <span class="s">&quot;10&quot;</span><span class="p">,</span> <span class="s">&quot;Yellow bag&quot;</span><span class="p">);</span>

<span class="n">group</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeTableNode</span><span class="p">(</span><span class="s">&quot;Actual Workforce&quot;</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="n">root</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;The Dork&quot;</span><span class="p">,</span> <span class="s">&quot;9.78&quot;</span><span class="p">,</span> <span class="s">&quot;22&quot;</span><span class="p">,</span> <span class="s">&quot;Mojito&quot;</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;The Stud&quot;</span><span class="p">,</span> <span class="s">&quot;8.66&quot;</span><span class="p">,</span> <span class="s">&quot;46&quot;</span><span class="p">,</span> <span class="s">&quot;Toothbrush&quot;</span><span class="p">);</span>
<span class="n">addNode</span><span class="p">(</span><span class="n">group</span><span class="p">,</span> <span class="s">&quot;The Ugly&quot;</span><span class="p">,</span> <span class="s">&quot;13.0&quot;</span><span class="p">,</span> <span class="s">&quot;25&quot;</span><span class="p">,</span> <span class="s">&quot;Paper bag&quot;</span><span class="p">);</span>

<span class="n">root</span><span class="o">-&gt;</span><span class="n">expand</span><span class="p">();</span>
</pre></div>
  </message>
  <message id="src-TreeView">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WTreeView&gt;</span>

<span class="cp">#include &quot;GitModel.cpp&quot;</span>
<span class="cp">#define GIT_REPOSITORY &quot;/path/to/repository/.git&quot;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WTreeView</span> <span class="o">*</span><span class="n">treeView</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTreeView</span><span class="p">();</span>
<span class="n">treeView</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">600</span><span class="p">,</span> <span class="mi">400</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemModel</span> <span class="o">*</span><span class="n">model</span> <span class="o">=</span> <span class="k">new</span> <span class="n">GitModel</span><span class="p">(</span><span class="n">GIT_REPOSITORY</span><span class="p">,</span> <span class="n">treeView</span><span class="p">);</span>
<span class="n">treeView</span><span class="o">-&gt;</span><span class="n">setModel</span><span class="p">(</span><span class="n">model</span><span class="p">);</span>

<span class="n">treeView</span><span class="o">-&gt;</span><span class="n">setRowHeight</span><span class="p">(</span><span class="mi">24</span><span class="p">);</span>
<span class="n">treeView</span><span class="o">-&gt;</span><span class="n">setHeaderHeight</span><span class="p">(</span><span class="mi">24</span><span class="p">);</span>
<span class="n">treeView</span><span class="o">-&gt;</span><span class="n">setSortingEnabled</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">treeView</span><span class="o">-&gt;</span><span class="n">setSelectionMode</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">SingleSelection</span><span class="p">);</span>
<span class="n">treeView</span><span class="o">-&gt;</span><span class="n">setEditTriggers</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractItemView</span><span class="o">::</span><span class="n">NoEditTrigger</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-VBoxLayout">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WVBoxLayout&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box centered&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span> <span class="o">*</span><span class="n">vbox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">vbox</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 1&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
  
<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 2&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;blue-box&quot;</span><span class="p">);</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-VBoxLayoutStretch">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WVBoxLayout&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box centered&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span> <span class="o">*</span><span class="n">vbox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">vbox</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 1&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
  
<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 2&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;blue-box&quot;</span><span class="p">);</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-VBoxLayoutStretched">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WVBoxLayout&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">150</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;yellow-box centered&quot;</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span> <span class="o">*</span><span class="n">vbox</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WVBoxLayout</span><span class="p">();</span>
<span class="n">container</span><span class="o">-&gt;</span><span class="n">setLayout</span><span class="p">(</span><span class="n">vbox</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 1&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;green-box&quot;</span><span class="p">);</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">,</span> <span class="mi">1</span><span class="p">);</span>
  
<span class="n">item</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;Item 2&quot;</span><span class="p">);</span>
<span class="n">item</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;blue-box&quot;</span><span class="p">);</span>
<span class="n">vbox</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="n">item</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-Validation">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WIntValidator&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WTemplate&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">t</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;validation-template&quot;</span><span class="p">));</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">ageEdit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">();</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;age&quot;</span><span class="p">,</span> <span class="n">ageEdit</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WIntValidator</span> <span class="o">*</span><span class="n">validator</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WIntValidator</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
<span class="n">validator</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">ageEdit</span><span class="o">-&gt;</span><span class="n">setValidator</span><span class="p">(</span><span class="n">validator</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">);</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">();</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">hide</span><span class="p">();</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;age-info&quot;</span><span class="p">,</span> <span class="n">out</span><span class="p">);</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">show</span><span class="p">();</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">ageEdit</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;Age of &quot;</span> <span class="o">+</span> <span class="n">ageEdit</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">()</span> <span class="o">+</span> <span class="s">&quot; is saved!&quot;</span><span class="p">);</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;alert alert-success&quot;</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;The number must be in the range 0 to 150&quot;</span><span class="p">);</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;alert alert-danger&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>

<span class="n">ageEdit</span><span class="o">-&gt;</span><span class="n">enterPressed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">emit</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMouseEvent</span><span class="p">());</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-ValidationDate">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WTemplate&gt;</span>
<span class="cp">#include &lt;Wt/WDate&gt;</span>
<span class="cp">#include &lt;Wt/WDateValidator&gt;</span>
<span class="cp">#include &lt;Wt/WLabel&gt;</span>
<span class="cp">#include &lt;Wt/WDateEdit&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WValidator&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span> <span class="o">*</span><span class="n">t</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="o">::</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;date-template&quot;</span><span class="p">));</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">addFunction</span><span class="p">(</span><span class="s">&quot;id&quot;</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WTemplate</span><span class="o">::</span><span class="n">Functions</span><span class="o">::</span><span class="n">id</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span> <span class="o">*</span><span class="n">dateEdit</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDateEdit</span><span class="p">();</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;birth-date&quot;</span><span class="p">,</span> <span class="n">dateEdit</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WDateValidator</span> <span class="o">*</span><span class="n">dv</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDateValidator</span><span class="p">();</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setBottom</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="p">(</span><span class="mi">1900</span><span class="p">,</span> <span class="mi">1</span><span class="p">,</span> <span class="mi">1</span><span class="p">));</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setTop</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">::</span><span class="n">currentDate</span><span class="p">());</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setFormat</span><span class="p">(</span><span class="s">&quot;dd/MM/yyyy&quot;</span><span class="p">);</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setMandatory</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setInvalidBlankText</span><span class="p">(</span><span class="s">&quot;A birthdate is mandatory!&quot;</span><span class="p">);</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setInvalidNotADateText</span><span class="p">(</span><span class="s">&quot;You should enter a date in the format &quot;</span>
			   <span class="s">&quot;</span><span class="se">\&quot;</span><span class="s">dd/MM/yyyy</span><span class="se">\&quot;</span><span class="s">!&quot;</span><span class="p">);</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setInvalidTooEarlyText</span>
    <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;That&#39;s too early... The date must be {1} or later!&quot;</span>
		 <span class="s">&quot;&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">dv</span><span class="o">-&gt;</span><span class="n">bottom</span><span class="p">().</span><span class="n">toString</span><span class="p">(</span><span class="s">&quot;dd/MM/yyyy&quot;</span><span class="p">)));</span>
<span class="n">dv</span><span class="o">-&gt;</span><span class="n">setInvalidTooLateText</span>
    <span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;That&#39;s too late... The date must be {1} or earlier!&quot;</span>
		 <span class="s">&quot;&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">dv</span><span class="o">-&gt;</span><span class="n">top</span><span class="p">().</span><span class="n">toString</span><span class="p">(</span><span class="s">&quot;dd/MM/yyyy&quot;</span><span class="p">)));</span>

<span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">setValidator</span><span class="p">(</span><span class="n">dv</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Ok&quot;</span><span class="p">);</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">();</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">setInline</span><span class="p">(</span><span class="nb">false</span><span class="p">);</span>
<span class="n">out</span><span class="o">-&gt;</span><span class="n">hide</span><span class="p">();</span>
<span class="n">t</span><span class="o">-&gt;</span><span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;info&quot;</span><span class="p">,</span> <span class="n">out</span><span class="p">);</span>

<span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">out</span><span class="o">-&gt;</span><span class="n">show</span><span class="p">();</span>

    <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Result</span> <span class="n">result</span> <span class="o">=</span> <span class="n">dv</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">(</span><span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">text</span><span class="p">());</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">result</span><span class="p">.</span><span class="n">state</span><span class="p">()</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span><span class="o">::</span><span class="n">Valid</span><span class="p">)</span> <span class="p">{</span>
	<span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span> <span class="n">d</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WDate</span><span class="o">::</span><span class="n">currentServerDate</span><span class="p">();</span>
	<span class="kt">int</span> <span class="n">years</span> <span class="o">=</span> <span class="n">d</span><span class="p">.</span><span class="n">year</span><span class="p">()</span> <span class="o">-</span> <span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">().</span><span class="n">year</span><span class="p">();</span>
	<span class="kt">int</span> <span class="n">days</span> <span class="o">=</span> <span class="n">d</span><span class="p">.</span><span class="n">daysTo</span><span class="p">(</span><span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">().</span><span class="n">addYears</span><span class="p">(</span><span class="n">years</span><span class="p">));</span>
	<span class="k">if</span> <span class="p">(</span><span class="n">days</span> <span class="o">&lt;</span> <span class="mi">0</span><span class="p">)</span>
	    <span class="n">days</span> <span class="o">=</span> <span class="n">d</span><span class="p">.</span><span class="n">daysTo</span><span class="p">(</span> <span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">date</span><span class="p">().</span><span class="n">addYears</span><span class="p">(</span><span class="n">years</span> <span class="o">+</span> <span class="mi">1</span><span class="p">)</span> <span class="p">);</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;In &quot;</span> <span class="o">+</span> <span class="n">boost</span><span class="o">::</span><span class="n">lexical_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">days</span><span class="p">)</span> <span class="o">+</span>
		     <span class="s">&quot; days, we will be celebrating your next anniversary!&lt;/p&gt;&quot;</span><span class="p">);</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;alert alert-success&quot;</span><span class="p">);</span>
    <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
	<span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">setFocus</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="n">result</span><span class="p">.</span><span class="n">message</span><span class="p">());</span>
	<span class="n">out</span><span class="o">-&gt;</span><span class="n">setStyleClass</span><span class="p">(</span><span class="s">&quot;alert alert-danger&quot;</span><span class="p">);</span>
    <span class="p">}</span>
<span class="p">}));</span>

<span class="n">dateEdit</span><span class="o">-&gt;</span><span class="n">enterPressed</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
    <span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">emit</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WMouseEvent</span><span class="p">());</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-ValidationModel">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WBoostAny&gt;</span>
<span class="cp">#include &lt;Wt/WFormModel&gt;</span>
<span class="cp">#include &lt;Wt/WIntValidator&gt;</span>
<span class="cp">#include &lt;Wt/WLineEdit&gt;</span>
<span class="cp">#include &lt;Wt/WPushButton&gt;</span>
<span class="cp">#include &lt;Wt/WValidator&gt;</span>
<span class="cp">#include &lt;Wt/WTemplateFormView&gt;</span>

<span class="k">class</span> <span class="nc">AgeFormModel</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="c1">// in C++11:</span>
    <span class="c1">// static constexpr Field AgeField = &quot;age&quot;;</span>
    <span class="k">static</span> <span class="n">Field</span> <span class="n">AgeField</span><span class="p">;</span>

    <span class="c1">// inline constructor</span>
    <span class="n">AgeFormModel</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span> <span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span>
    <span class="p">{</span>
        <span class="n">addField</span><span class="p">(</span><span class="n">AgeField</span><span class="p">);</span>
        <span class="n">setValidator</span><span class="p">(</span><span class="n">AgeField</span><span class="p">,</span> <span class="n">createAgeValidator</span><span class="p">());</span>
        <span class="n">setValue</span><span class="p">(</span><span class="n">AgeField</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="p">());</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WValidator</span> <span class="o">*</span><span class="n">createAgeValidator</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">Wt</span><span class="o">::</span><span class="n">WIntValidator</span> <span class="o">*</span><span class="n">v</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WIntValidator</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">150</span><span class="p">);</span>
        <span class="k">return</span> <span class="n">v</span><span class="p">;</span>
    <span class="p">}</span>
<span class="p">};</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WFormModel</span><span class="o">::</span><span class="n">Field</span> <span class="n">AgeFormModel</span><span class="o">::</span><span class="n">AgeField</span> <span class="o">=</span> <span class="s">&quot;age&quot;</span><span class="p">;</span>

<span class="k">class</span> <span class="nc">AgeFormView</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WTemplateFormView</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="c1">// inline constructor</span>
    <span class="n">AgeFormView</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">model_</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AgeFormModel</span><span class="p">(</span><span class="k">this</span><span class="p">);</span>

        <span class="n">setTemplateText</span><span class="p">(</span><span class="n">tr</span><span class="p">(</span><span class="s">&quot;validation-template&quot;</span><span class="p">));</span>

	<span class="n">setFormWidget</span><span class="p">(</span><span class="n">AgeFormModel</span><span class="o">::</span><span class="n">AgeField</span><span class="p">,</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="p">());</span>

        <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span> <span class="o">*</span><span class="n">button</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WPushButton</span><span class="p">(</span><span class="s">&quot;Save&quot;</span><span class="p">);</span>
        <span class="n">bindWidget</span><span class="p">(</span><span class="s">&quot;button&quot;</span><span class="p">,</span> <span class="n">button</span><span class="p">);</span>

        <span class="n">button</span><span class="o">-&gt;</span><span class="n">clicked</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="k">this</span><span class="p">,</span> <span class="o">&amp;</span><span class="n">AgeFormView</span><span class="o">::</span><span class="n">process</span><span class="p">);</span>

        <span class="n">updateView</span><span class="p">(</span><span class="n">model_</span><span class="p">);</span>
    <span class="p">}</span>

<span class="nl">private:</span>
    <span class="kt">void</span> <span class="n">process</span><span class="p">()</span> <span class="p">{</span>
        <span class="n">updateModel</span><span class="p">(</span><span class="n">model_</span><span class="p">);</span>
        <span class="k">if</span> <span class="p">(</span><span class="n">model_</span><span class="o">-&gt;</span><span class="n">validate</span><span class="p">())</span> <span class="p">{</span>
            <span class="c1">// Udate the view: Delete any validation message in the view, etc.</span>
            <span class="n">updateView</span><span class="p">(</span><span class="n">model_</span><span class="p">);</span>
            <span class="n">bindString</span><span class="p">(</span><span class="s">&quot;age-info&quot;</span><span class="p">,</span>
                       <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Age of {1} is saved!&quot;</span><span class="p">)</span>
		       <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">asString</span>
			    <span class="p">(</span><span class="n">model_</span><span class="o">-&gt;</span><span class="n">value</span><span class="p">(</span><span class="n">AgeFormModel</span><span class="o">::</span><span class="n">AgeField</span><span class="p">))));</span>
        <span class="p">}</span> <span class="k">else</span> <span class="p">{</span>
            <span class="n">updateView</span><span class="p">(</span><span class="n">model_</span><span class="p">);</span>
            <span class="c1">// Set the focus on the line edit.</span>
            <span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span> <span class="o">*</span><span class="n">viewField</span> <span class="o">=</span>
                       <span class="n">resolve</span><span class="o">&lt;</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLineEdit</span><span class="o">*&gt;</span><span class="p">(</span><span class="n">AgeFormModel</span><span class="o">::</span><span class="n">AgeField</span><span class="p">);</span>
            <span class="n">viewField</span><span class="o">-&gt;</span><span class="n">setFocus</span><span class="p">(</span><span class="nb">true</span><span class="p">);</span>
        <span class="p">}</span>
    <span class="p">}</span>

    <span class="n">AgeFormModel</span> <span class="o">*</span><span class="n">model_</span><span class="p">;</span>
<span class="p">};</span>


<span class="n">AgeFormView</span> <span class="o">*</span><span class="n">view</span> <span class="o">=</span> <span class="k">new</span> <span class="n">AgeFormView</span><span class="p">();</span>
</pre></div>
  </message>
  <message id="src-Video">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WVideo&gt;</span>


<span class="c1">// Define media source locations</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">mp4Video</span> <span class="o">=</span> <span class="s">&quot;http://www.webtoolkit.eu/videos/sintel_trailer.mp4&quot;</span><span class="p">;</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">ogvVideo</span> <span class="o">=</span> <span class="s">&quot;http://www.webtoolkit.eu/videos/sintel_trailer.ogv&quot;</span><span class="p">;</span>

<span class="c1">// Define poster image location</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">poster</span> <span class="o">=</span> <span class="s">&quot;pics/sintel_trailer.jpg&quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WVideo</span> <span class="o">*</span><span class="n">video</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WVideo</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">mp4Video</span><span class="p">));</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">ogvVideo</span><span class="p">));</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">setPoster</span><span class="p">(</span><span class="n">poster</span><span class="p">);</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">setAlternativeContent</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">poster</span><span class="p">));</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">360</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">playbackStarted</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video playing&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">playbackPaused</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video paused&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">ended</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video ended&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">volumeChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Volume changed&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-VideoFallback">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WFlashObject&gt;</span>
<span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WFlashObject&gt;</span>
<span class="cp">#include &lt;Wt/WImage&gt;</span>
<span class="cp">#include &lt;Wt/WLink&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>
<span class="cp">#include &lt;Wt/WVideo&gt;</span>


<span class="c1">// Define media source locations</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">mp4Video</span> <span class="o">=</span> <span class="s">&quot;http://www.webtoolkit.eu/videos/sintel_trailer.mp4&quot;</span><span class="p">;</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">ogvVideo</span> <span class="o">=</span> <span class="s">&quot;http://www.webtoolkit.eu/videos/sintel_trailer.ogv&quot;</span><span class="p">;</span>

<span class="c1">// Define poster image location</span>
<span class="n">std</span><span class="o">::</span><span class="n">string</span> <span class="n">poster</span> <span class="o">=</span> <span class="s">&quot;pics/sintel_trailer.jpg&quot;</span><span class="p">;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WFlashObject</span> <span class="o">*</span><span class="n">flash</span> <span class="o">=</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WFlashObject</span><span class="p">(</span><span class="s">&quot;http://www.webtoolkit.eu/videos/player_flv_maxi.swf&quot;</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setFlashVariable</span><span class="p">(</span><span class="s">&quot;startimage&quot;</span><span class="p">,</span> <span class="s">&quot;pics/sintel_trailer.jpg&quot;</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setFlashParameter</span><span class="p">(</span><span class="s">&quot;allowFullScreen&quot;</span><span class="p">,</span> <span class="s">&quot;true&quot;</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setFlashVariable</span><span class="p">(</span><span class="s">&quot;flv&quot;</span><span class="p">,</span> <span class="n">mp4Video</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setFlashVariable</span><span class="p">(</span><span class="s">&quot;showvolume&quot;</span><span class="p">,</span> <span class="s">&quot;1&quot;</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setFlashVariable</span><span class="p">(</span><span class="s">&quot;showfullscreen&quot;</span><span class="p">,</span> <span class="s">&quot;1&quot;</span><span class="p">);</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">setAlternativeContent</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WImage</span><span class="p">(</span><span class="n">poster</span><span class="p">));</span>
<span class="n">flash</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">360</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WVideo</span> <span class="o">*</span><span class="n">video</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WVideo</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">mp4Video</span><span class="p">));</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">addSource</span><span class="p">(</span><span class="n">Wt</span><span class="o">::</span><span class="n">WLink</span><span class="p">(</span><span class="n">ogvVideo</span><span class="p">));</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">setAlternativeContent</span><span class="p">(</span><span class="n">flash</span><span class="p">);</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">setPoster</span><span class="p">(</span><span class="n">poster</span><span class="p">);</span>
<span class="n">video</span><span class="o">-&gt;</span><span class="n">resize</span><span class="p">(</span><span class="mi">640</span><span class="p">,</span> <span class="mi">360</span><span class="p">);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WText</span> <span class="o">*</span><span class="n">out</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="n">container</span><span class="p">);</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">playbackStarted</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video playing&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">playbackPaused</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video paused&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">ended</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Video ended&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>

<span class="n">video</span><span class="o">-&gt;</span><span class="n">volumeChanged</span><span class="p">().</span><span class="n">connect</span><span class="p">(</span><span class="n">std</span><span class="o">::</span><span class="n">bind</span><span class="p">([</span><span class="o">=</span><span class="p">]</span> <span class="p">()</span> <span class="p">{</span>
        <span class="n">out</span><span class="o">-&gt;</span><span class="n">setText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Volume changed&lt;/p&gt;&quot;</span><span class="p">);</span>
<span class="p">}));</span>
</pre></div>
  </message>
  <message id="src-VirtualModel">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WAbstractTableModel&gt;</span>

<span class="k">class</span> <span class="nc">VirtualModel</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractTableModel</span>
<span class="p">{</span>
<span class="nl">public:</span>
  <span class="n">VirtualModel</span><span class="p">(</span><span class="kt">int</span> <span class="n">rows</span><span class="p">,</span> <span class="kt">int</span> <span class="n">columns</span><span class="p">,</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WObject</span> <span class="o">*</span><span class="n">parent</span> <span class="o">=</span> <span class="mi">0</span><span class="p">)</span>
    <span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WAbstractTableModel</span><span class="p">(</span><span class="n">parent</span><span class="p">),</span>
      <span class="n">rows_</span><span class="p">(</span><span class="n">rows</span><span class="p">),</span>
      <span class="n">columns_</span><span class="p">(</span><span class="n">columns</span><span class="p">)</span>
  <span class="p">{</span> <span class="p">}</span>

  <span class="k">virtual</span> <span class="kt">int</span> <span class="n">rowCount</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">parent</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="p">())</span> <span class="k">const</span>
  <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">parent</span><span class="p">.</span><span class="n">isValid</span><span class="p">())</span>
      <span class="k">return</span> <span class="n">rows_</span><span class="p">;</span>
    <span class="k">else</span>
      <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="k">virtual</span> <span class="kt">int</span> <span class="n">columnCount</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">parent</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="p">())</span> <span class="k">const</span>
  <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">parent</span><span class="p">.</span><span class="n">isValid</span><span class="p">())</span>
      <span class="k">return</span> <span class="n">columns_</span><span class="p">;</span>
    <span class="k">else</span>
      <span class="k">return</span> <span class="mi">0</span><span class="p">;</span>
  <span class="p">}</span>

  <span class="k">virtual</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">data</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WModelIndex</span><span class="o">&amp;</span> <span class="n">index</span><span class="p">,</span> <span class="kt">int</span> <span class="n">role</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">)</span> <span class="k">const</span>
  <span class="p">{</span>
    <span class="k">switch</span> <span class="p">(</span><span class="n">role</span><span class="p">)</span> <span class="p">{</span>
    <span class="k">case</span> <span class="n">Wt</span>:<span class="o">:</span><span class="n">DisplayRole</span><span class="o">:</span>
      <span class="k">if</span> <span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">()</span> <span class="o">==</span> <span class="mi">0</span><span class="p">)</span>
	<span class="k">return</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Row {1}&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">());</span>
      <span class="k">else</span>
	<span class="k">return</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Item row {1}, col {2}&quot;</span><span class="p">)</span>
	  <span class="p">.</span><span class="n">arg</span><span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">row</span><span class="p">()).</span><span class="n">arg</span><span class="p">(</span><span class="n">index</span><span class="p">.</span><span class="n">column</span><span class="p">());</span>
    <span class="nl">default:</span>
      <span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
    <span class="p">}</span>
  <span class="p">}</span>

  <span class="k">virtual</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span> <span class="n">headerData</span><span class="p">(</span><span class="kt">int</span> <span class="n">section</span><span class="p">,</span>
				<span class="n">Wt</span><span class="o">::</span><span class="n">Orientation</span> <span class="n">orientation</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Horizontal</span><span class="p">,</span>
				<span class="kt">int</span> <span class="n">role</span> <span class="o">=</span> <span class="n">Wt</span><span class="o">::</span><span class="n">DisplayRole</span><span class="p">)</span> <span class="k">const</span>
  <span class="p">{</span>
    <span class="k">if</span> <span class="p">(</span><span class="n">orientation</span> <span class="o">==</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Horizontal</span><span class="p">)</span> <span class="p">{</span>
      <span class="k">switch</span> <span class="p">(</span><span class="n">role</span><span class="p">)</span> <span class="p">{</span>
      <span class="k">case</span> <span class="n">Wt</span>:<span class="o">:</span><span class="n">DisplayRole</span><span class="o">:</span>
	<span class="k">return</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WString</span><span class="p">(</span><span class="s">&quot;Column {1}&quot;</span><span class="p">).</span><span class="n">arg</span><span class="p">(</span><span class="n">section</span><span class="p">);</span>
      <span class="nl">default:</span>
	<span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
      <span class="p">}</span>
    <span class="p">}</span> <span class="k">else</span>
      <span class="k">return</span> <span class="n">boost</span><span class="o">::</span><span class="n">any</span><span class="p">();</span>
  <span class="p">}</span>

<span class="nl">private:</span>
  <span class="kt">int</span> <span class="n">rows_</span><span class="p">,</span> <span class="n">columns_</span><span class="p">;</span>
<span class="p">};</span>
</pre></div>
  </message>
  <message id="src-WHboxLayout">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WContainerWidget&gt;</span>
<span class="cp">#include &lt;Wt/WHBoxLayout&gt;</span>
<span class="cp">#include &lt;Wt/WText&gt;</span>


<span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span> <span class="o">*</span><span class="n">container</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WContainerWidget</span><span class="p">();</span>

<span class="n">container</span><span class="o">-&gt;</span><span class="n">addWidget</span><span class="p">(</span><span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;A first widget&lt;/p&gt;&quot;</span><span class="p">));</span>

<span class="k">for</span> <span class="p">(</span><span class="kt">unsigned</span> <span class="n">i</span> <span class="o">=</span> <span class="mi">0</span><span class="p">;</span> <span class="n">i</span> <span class="o">&lt;</span> <span class="mi">3</span><span class="p">;</span> <span class="o">++</span><span class="n">i</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// a widget can be added to a container by passing the container as</span>
    <span class="c1">// the last constructor argument</span>
    <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WText</span><span class="p">(</span><span class="s">&quot;&lt;p&gt;Text &quot;</span> <span class="o">+</span> <span class="n">boost</span><span class="o">::</span><span class="n">lexical_cast</span><span class="o">&lt;</span><span class="n">std</span><span class="o">::</span><span class="n">string</span><span class="o">&gt;</span><span class="p">(</span><span class="n">i</span><span class="p">)</span> <span class="o">+</span> <span class="s">&quot;&lt;/p&gt;&quot;</span><span class="p">,</span>
		  <span class="n">container</span><span class="p">);</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-pdfImageWrite">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/Chart/WCartesianChart&gt;</span>
<span class="cp">#include &lt;Wt/WPdfImage&gt;</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span> <span class="o">*</span><span class="n">chart</span> <span class="o">=</span> <span class="k">new</span> <span class="n">Wt</span><span class="o">::</span><span class="n">Chart</span><span class="o">::</span><span class="n">WCartesianChart</span><span class="p">(...);</span>

<span class="n">Wt</span><span class="o">::</span><span class="n">WPdfImage</span> <span class="n">pdfImage</span><span class="p">(</span><span class="s">&quot;4cm&quot;</span><span class="p">,</span> <span class="s">&quot;3cm&quot;</span><span class="p">);</span>
<span class="p">{</span>
    <span class="n">Wt</span><span class="o">::</span><span class="n">WPainter</span> <span class="n">p</span><span class="p">(</span><span class="o">&amp;</span><span class="n">pdfImage</span><span class="p">);</span>
    <span class="n">chart</span><span class="o">-&gt;</span><span class="n">paint</span><span class="p">(</span><span class="n">p</span><span class="p">);</span>
<span class="p">}</span>
<span class="n">std</span><span class="o">::</span><span class="n">ofstream</span> <span class="n">f</span><span class="p">(</span><span class="s">&quot;chart.pdf&quot;</span><span class="p">,</span> <span class="n">std</span><span class="o">::</span><span class="n">ios</span><span class="o">::</span><span class="n">out</span> <span class="o">|</span> <span class="n">std</span><span class="o">::</span><span class="n">ios</span><span class="o">::</span><span class="n">binary</span><span class="p">);</span>
<span class="n">pdfImage</span><span class="p">.</span><span class="n">write</span><span class="p">(</span><span class="n">f</span><span class="p">);</span>
</pre></div>
  </message>
  <message id="src-theme">
<div class="highlight"><pre><span class="cp">#include &lt;Wt/WApplication&gt;</span>
<span class="cp">#include &lt;Wt/WEnvironment&gt;</span>

<span class="c1">// Main application class</span>
<span class="k">class</span> <span class="nc">ThemeExample</span> <span class="o">:</span> <span class="k">public</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span>
<span class="p">{</span>
<span class="nl">public:</span>
    <span class="c1">// Constructor</span>
    <span class="n">ThemeExample</span><span class="p">(</span><span class="k">const</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WEnvironment</span> <span class="o">&amp;</span><span class="n">env</span><span class="p">)</span>
	<span class="o">:</span> <span class="n">Wt</span><span class="o">::</span><span class="n">WApplication</span><span class="p">(</span><span class="n">env</span><span class="p">)</span>
    <span class="p">{</span>
	<span class="n">setCssTheme</span><span class="p">(</span><span class="s">&quot;polished&quot;</span><span class="p">);</span>

	<span class="cm">/*</span>
<span class="cm">	 *  Create UI, Set initial values, ...</span>
<span class="cm">	 */</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-matcher">
<div class="highlight"><pre><span class="kd">function</span> <span class="p">(</span><span class="nx">editElement</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// fetch the location of cursor and current text in the editElement.</span>

    <span class="c1">// return a function that matches a given suggestion with the current</span>
    <span class="c1">// value of the editElement.</span>
    <span class="k">return</span> <span class="kd">function</span><span class="p">(</span><span class="nx">suggestion</span><span class="p">)</span> <span class="p">{</span>

	<span class="c1">// 1) if suggestion is null, simply return the current text &#39;value&#39;</span>
	<span class="c1">// 2) check suggestion if it matches</span>
	<span class="c1">// 3) add highlighting markup to suggestion if necessary</span>

	<span class="k">return</span> <span class="p">{</span> <span class="nx">match</span> <span class="o">:</span> <span class="p">...,</span>      <span class="c1">// does the suggestion match ? (boolean)</span>
		 <span class="nx">suggestion</span> <span class="o">:</span> <span class="p">...</span>  <span class="c1">// modified suggestion with highlighting</span>
	       <span class="p">};</span>
    <span class="p">}</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-replacer">
<div class="highlight"><pre><span class="kd">function</span> <span class="p">(</span><span class="nx">editElement</span><span class="p">,</span> <span class="nx">suggestionText</span><span class="p">,</span> <span class="nx">suggestionValue</span><span class="p">)</span> <span class="p">{</span>
    <span class="c1">// editElement is the form element which must be edited.</span>
    <span class="c1">// suggestionText is the displayed text for the matched suggestion.</span>
    <span class="c1">// suggestionValue is the stored value for the matched suggestion.</span>

    <span class="c1">// computed modifiedEditValue and modifiedPos ...</span>

    <span class="nx">editElement</span><span class="p">.</span><span class="nx">value</span> <span class="o">=</span> <span class="nx">modifiedEditValue</span><span class="p">;</span>
    <span class="nx">editElement</span><span class="p">.</span><span class="nx">selectionStart</span> <span class="o">=</span> <span class="nx">edit</span><span class="p">.</span><span class="nx">selectionEnd</span> <span class="o">=</span> <span class="nx">modifiedPos</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-CSSexample">
<div class="highlight"><pre><span class="nc">.CSS-example</span> <span class="nt">table</span> <span class="p">{</span>
  <span class="k">width</span><span class="o">:</span> <span class="m">0</span><span class="o">%</span><span class="p">;</span>
  <span class="k">margin-top</span><span class="o">:</span> <span class="m">20px</span><span class="p">;</span>
  <span class="k">margin-bottom</span><span class="o">:</span> <span class="m">20px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.CSS-example</span> <span class="nc">.table-bordered</span> <span class="p">{</span>
  <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#DDD</span><span class="p">;</span>
  <span class="k">border-left</span><span class="o">:</span> <span class="m">0</span><span class="p">;</span>
  <span class="k">border</span><span class="o">-</span><span class="n">radius</span><span class="o">:</span> <span class="m">4px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.CSS-example</span> <span class="nc">.table-condensed</span> <span class="nt">th</span><span class="o">,</span>
<span class="nc">.CSS-example</span> <span class="nc">.table-condensed</span> <span class="nt">td</span> <span class="p">{</span>
  <span class="k">padding</span><span class="o">:</span> <span class="m">4px</span> <span class="m">5px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.CSS-example</span> <span class="nc">.code</span> <span class="p">{</span>
  <span class="k">font-family</span><span class="o">:</span> <span class="n">andale</span> <span class="n">mono</span><span class="p">;</span>
  <span class="k">color</span><span class="o">:</span> <span class="m">#570</span><span class="p">;</span>
  <span class="k">font-size</span><span class="o">:</span> <span class="m">97</span><span class="o">%</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.CSS-example</span> <span class="nc">.info</span> <span class="p">{</span>
  <span class="k">background-color</span><span class="o">:</span> <span class="m">#D9EDF7</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-combostyle">
<div class="highlight"><pre><span class="nc">.combo-red</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span><span class="nb">red</span>
<span class="p">}</span>

<span class="nc">.combo-green</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span><span class="nb">green</span>
<span class="p">}</span>

<span class="nc">.combo-blue</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span><span class="nb">blue</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-dragdrop">
<div class="highlight"><pre><span class="nc">.character</span> <span class="p">{</span>
  <span class="k">padding</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
  <span class="k">margin</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
  <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#000</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.blue-drop-site</span> <span class="p">{</span>
  <span class="k">padding</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
  <span class="k">margin</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
  <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#000</span><span class="p">;</span>

  <span class="k">background-color</span><span class="o">:</span> <span class="m">#e0ecff</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.red-drop-site</span> <span class="p">{</span>
  <span class="k">padding</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
  <span class="k">margin</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
  <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#000</span><span class="p">;</span>

  <span class="k">background-color</span><span class="o">:</span> <span class="m">#ffece0</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-everywidget">
<div class="highlight"><pre><span class="nc">.main-nav</span> <span class="p">{</span>
    <span class="k">margin-bottom</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">tt</span> <span class="p">{</span>
    <span class="k">font-family</span><span class="o">:</span> <span class="n">andale</span> <span class="n">mono</span><span class="p">;</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#570</span><span class="p">;</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="m">97</span><span class="o">%</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.wmediaplayer</span> <span class="nt">li</span> <span class="p">{</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
    <span class="k">line-height</span><span class="o">:</span> <span class="m">100</span><span class="o">%</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.contents</span> <span class="nt">h1</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#528B12</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.contents</span> <span class="nt">h2</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#528B12</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.contents</span> <span class="nt">h3</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#528B12</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.submenu</span> <span class="p">{</span>
    <span class="k">overflow</span><span class="o">:</span> <span class="k">auto</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.trhead</span> <span class="p">{</span>
    <span class="k">font-family</span><span class="o">:</span> <span class="k">sans-serif</span><span class="p">;</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="m">10pt</span><span class="p">;</span>
    <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span><span class="p">;</span>
    <span class="k">border-bottom</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="nb">black</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.trhead</span> <span class="nt">td</span> <span class="p">{</span>
    <span class="k">padding-left</span><span class="o">:</span> <span class="m">4px</span><span class="p">;</span>
    <span class="k">padding-right</span><span class="o">:</span> <span class="m">4px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.trdata</span> <span class="p">{</span>
    <span class="k">font-family</span><span class="o">:</span> <span class="k">sans-serif</span><span class="p">;</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="m">10pt</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.trdata</span> <span class="nt">td</span> <span class="p">{</span>
    <span class="k">vertical-align</span><span class="o">:</span> <span class="k">middle</span><span class="p">;</span>
    <span class="k">padding-left</span><span class="o">:</span> <span class="m">4px</span><span class="p">;</span>
    <span class="k">padding-right</span><span class="o">:</span> <span class="m">4px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.trdata</span> <span class="nt">td</span> <span class="nt">input</span><span class="o">[</span><span class="nt">type</span><span class="o">=</span><span class="s2">&quot;checkbox&quot;</span><span class="o">]</span> <span class="p">{</span>
    <span class="k">text-align</span><span class="o">:</span> <span class="k">center</span><span class="p">;</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">0px</span> <span class="k">auto</span><span class="p">;</span>
    <span class="k">display</span><span class="o">:</span> <span class="k">block</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.tdhead</span> <span class="p">{</span>
    <span class="k">font-family</span><span class="o">:</span> <span class="k">sans-serif</span><span class="p">;</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="m">10pt</span><span class="p">;</span>
    <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span><span class="p">;</span>
    <span class="k">padding-right</span><span class="o">:</span> <span class="m">8px</span><span class="p">;</span>
    <span class="k">text-align</span><span class="o">:</span> <span class="k">right</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.tddata</span> <span class="p">{</span>
    <span class="k">font-family</span><span class="o">:</span> <span class="k">sans-serif</span><span class="p">;</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="m">10pt</span><span class="p">;</span>
    <span class="k">padding-left</span><span class="o">:</span> <span class="m">4px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.Wt-suggest</span> <span class="nc">.highlight</span><span class="o">,</span> <span class="nc">.typeahead</span> <span class="nc">.highlight</span> <span class="p">{</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
    <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span><span class="p">;</span>
    <span class="k">text-decoration</span><span class="o">:</span> <span class="k">underline</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.menu</span> <span class="p">{</span>
    <span class="k">overflow</span><span class="o">:</span> <span class="k">auto</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.menu</span> <span class="o">&gt;</span> <span class="nt">li</span> <span class="o">&gt;</span> <span class="nc">.nav-pills</span> <span class="o">&gt;</span> <span class="nc">.active</span> <span class="o">&gt;</span> <span class="nt">a</span><span class="o">,</span>
<span class="nc">.menu</span> <span class="o">&gt;</span> <span class="nt">li</span> <span class="o">&gt;</span> <span class="nc">.nav-pills</span> <span class="o">&gt;</span> <span class="nc">.active</span> <span class="o">&gt;</span> <span class="nt">a</span><span class="nd">:hover</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span> <span class="nb">black</span><span class="p">;</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="m">#9CF</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.menu</span> <span class="o">&gt;</span> <span class="nt">li</span> <span class="o">&gt;</span> <span class="nc">.nav-pills</span> <span class="nt">a</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#333</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">span</span><span class="nc">.title</span> <span class="p">{</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="m">150</span><span class="o">%</span><span class="p">;</span>
    <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span><span class="p">;</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#528B12</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">span</span><span class="nc">.doc</span> <span class="p">{</span>
    <span class="k">vertical-align</span><span class="o">:</span> <span class="k">top</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">span</span><span class="nc">.doc</span> <span class="nt">a</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#7E7E7E</span><span class="p">;</span>
    <span class="k">text-decoration</span><span class="o">:</span> <span class="k">none</span><span class="p">;</span>
    <span class="k">vertical-align</span><span class="o">:</span> <span class="k">top</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">span</span><span class="nc">.doc</span> <span class="nt">a</span><span class="nd">:hover</span> <span class="p">{</span>
    <span class="k">color</span><span class="o">:</span> <span class="m">#70BD1A</span><span class="p">;</span>
    <span class="k">text-decoration</span><span class="o">:</span> <span class="k">none</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">span</span><span class="nc">.reactive</span> <span class="p">{</span>
    <span class="k">display</span><span class="o">:</span> <span class="k">block</span><span class="p">;</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="m">#CCCCCC</span><span class="p">;</span>
    <span class="k">cursor</span><span class="o">:</span> <span class="k">pointer</span><span class="p">;</span><span class="k">cursor</span><span class="o">:</span><span class="n">hand</span><span class="p">;</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">3px</span> <span class="m">0px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nt">div</span><span class="nc">.contents</span> <span class="p">{</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">0px</span> <span class="m">12px</span> <span class="m">6px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example-table</span> <span class="p">{</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">5px</span> <span class="k">auto</span><span class="p">;</span>
    <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="nb">gray</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example-table</span> <span class="nt">td</span> <span class="p">{</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">3px</span> <span class="m">5px</span><span class="p">;</span>
    <span class="k">border-right</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="nb">gray</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example-tree</span> <span class="nc">.selected</span> <span class="p">{</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="nb">yellow</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.centered</span> <span class="p">{</span>
    <span class="k">margin-left</span><span class="o">:</span> <span class="k">auto</span><span class="p">;</span>
    <span class="k">margin-right</span><span class="o">:</span> <span class="k">auto</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.events</span> <span class="p">{</span>
    <span class="k">border</span><span class="o">:</span> <span class="m">4px</span> <span class="k">solid</span> <span class="m">#528B12</span><span class="p">;</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">5px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.popupmenuLabel</span> <span class="p">{</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">5px</span><span class="p">;</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="m">#E7E5E0</span><span class="p">;</span>
    <span class="k">cursor</span><span class="o">:</span> <span class="k">default</span><span class="p">;</span>   
<span class="p">}</span>

<span class="nc">.example</span> <span class="nc">.form</span> <span class="p">{</span>
    <span class="k">background</span><span class="o">:</span> <span class="m">#DDD</span><span class="p">;</span>
    <span class="k">text-align</span><span class="o">:</span> <span class="k">center</span><span class="p">;</span>
    <span class="k">width</span><span class="o">:</span> <span class="m">40ex</span><span class="p">;</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">3px</span><span class="p">;</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">0px</span> <span class="k">auto</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.form</span> <span class="nt">p</span> <span class="p">{</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">5px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.googlemaps-controls</span> <span class="nc">.zoom</span> <span class="p">{</span>
    <span class="k">width</span><span class="o">:</span> <span class="m">2em</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.googlemaps-controls</span> <span class="nt">td</span> <span class="p">{</span>
    <span class="k">white-space</span><span class="o">:</span> <span class="k">nowrap</span><span class="p">;</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">2px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example</span> <span class="p">{</span>
    <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#A9D2F5</span><span class="p">;</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">14px</span> <span class="m">14px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example</span> <span class="o">&gt;</span> <span class="nt">legend</span> <span class="p">{</span>
    <span class="k">width</span><span class="o">:</span> <span class="k">auto</span><span class="p">;</span>
    <span class="k">border-bottom</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">0px</span> <span class="m">5px</span><span class="p">;</span>
    <span class="k">margin-bottom</span><span class="o">:</span> <span class="m">-5px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example</span> <span class="o">&gt;</span> <span class="nt">p</span> <span class="p">{</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">10px</span> <span class="m">0px</span><span class="p">;</span>
    <span class="k">padding-top</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.src</span> <span class="p">{</span>
    <span class="k">margin-top</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.src</span> <span class="o">&gt;</span> <span class="nt">legend</span> <span class="p">{</span>
    <span class="k">text-align</span><span class="o">:</span> <span class="k">left</span><span class="p">;</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="m">85</span><span class="o">%</span><span class="p">;</span>
    <span class="k">line-height</span><span class="o">:</span> <span class="m">24px</span><span class="p">;</span>
    <span class="k">border-bottom</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
    <span class="k">border-top</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#A9D2F5</span><span class="p">;</span>
    <span class="k">margin-bottom</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.src</span> <span class="nt">pre</span> <span class="p">{</span>
    <span class="k">border</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="m">#fcfcfc</span><span class="p">;</span>
    <span class="k">margin-bottom</span><span class="o">:</span> <span class="m">0px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.centered-example</span> <span class="p">{</span>
    <span class="k">width</span><span class="o">:</span> <span class="m">400px</span><span class="p">;</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">0px</span> <span class="k">auto</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example</span> <span class="nc">.Wt-tableview</span><span class="o">,</span> <span class="nc">.example</span> <span class="nc">.Wt-treeview</span> <span class="p">{</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">0px</span> <span class="k">auto</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.example</span> <span class="nc">.text-edit-example</span> <span class="nc">.out</span> <span class="p">{</span>
    <span class="k">margin-top</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span>
    <span class="k">margin-left</span><span class="o">:</span> <span class="m">100px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.centered</span> <span class="p">{</span>
    <span class="k">text-align</span><span class="o">:</span> <span class="k">center</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.lead</span> <span class="p">{</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">0.1em</span> <span class="m">1em</span><span class="p">;</span>
    <span class="k">margin</span><span class="o">:</span> <span class="m">0</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.inline-buttons</span> <span class="nt">button</span> <span class="p">{</span>
    <span class="k">margin-left</span><span class="o">:</span> <span class="m">7px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.reset</span> <span class="nt">h1</span> <span class="p">{</span>
    <span class="k">font-size</span><span class="o">:</span> <span class="k">auto</span><span class="p">;</span>
    <span class="k">font-weight</span><span class="o">:</span> <span class="k">auto</span><span class="p">;</span>
    <span class="k">color</span><span class="o">:</span> <span class="k">inherit</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.dl-horizontal.no-clear</span><span class="nd">:after</span> <span class="p">{</span>
  <span class="k">clear</span><span class="o">:</span> <span class="k">none</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-layout">
<div class="highlight"><pre><span class="nc">.yellow-box</span> <span class="p">{</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="m">#ffffb4</span><span class="p">;</span>
    <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="nb">black</span><span class="p">;</span>
    <span class="k">margin-top</span><span class="o">:</span> <span class="m">1ex</span><span class="p">;</span>
    <span class="k">margin-bottom</span><span class="o">:</span> <span class="m">1ex</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.green-box</span> <span class="p">{</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="m">#c4ffb4</span><span class="p">;</span>
    <span class="k">min-height</span><span class="o">:</span> <span class="m">30px</span><span class="p">;</span>
    <span class="k">text-align</span><span class="o">:</span> <span class="k">center</span><span class="p">;</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">3px</span><span class="p">;</span>
<span class="p">}</span>

<span class="nc">.blue-box</span> <span class="p">{</span>
    <span class="k">background-color</span><span class="o">:</span> <span class="m">#65dae8</span><span class="p">;</span>
    <span class="k">min-height</span><span class="o">:</span> <span class="m">30px</span><span class="p">;</span>
    <span class="k">text-align</span><span class="o">:</span> <span class="k">center</span><span class="p">;</span>
    <span class="k">padding</span><span class="o">:</span> <span class="m">3px</span><span class="p">;</span>
<span class="p">}</span>
</pre></div>
  </message>
  <message id="src-pygments">
<div class="highlight"><pre><span class="nt">td</span><span class="nc">.linenos</span> <span class="p">{</span> <span class="k">background-color</span><span class="o">:</span> <span class="m">#f0f0f0</span><span class="p">;</span> <span class="k">padding-right</span><span class="o">:</span> <span class="m">10px</span><span class="p">;</span> <span class="p">}</span>
<span class="nt">span</span><span class="nc">.lineno</span> <span class="p">{</span> <span class="k">background-color</span><span class="o">:</span> <span class="m">#f0f0f0</span><span class="p">;</span> <span class="k">padding</span><span class="o">:</span> <span class="m">0</span> <span class="m">5px</span> <span class="m">0</span> <span class="m">5px</span><span class="p">;</span> <span class="p">}</span>
<span class="nt">pre</span> <span class="p">{</span> <span class="k">line-height</span><span class="o">:</span> <span class="m">125</span><span class="o">%</span><span class="p">;</span> <span class="p">}</span>
<span class="nc">.highlight</span> <span class="nc">.hll</span> <span class="p">{</span> <span class="k">background-color</span><span class="o">:</span> <span class="m">#ffffcc</span> <span class="p">}</span>
<span class="nc">.highlight</span> <span class="nc">.c</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#408080</span><span class="p">;</span> <span class="k">font-style</span><span class="o">:</span> <span class="k">italic</span> <span class="p">}</span> <span class="c">/* Comment */</span>
<span class="nc">.highlight</span> <span class="nc">.err</span> <span class="p">{</span> <span class="k">border</span><span class="o">:</span> <span class="m">1px</span> <span class="k">solid</span> <span class="m">#FF0000</span> <span class="p">}</span> <span class="c">/* Error */</span>
<span class="nc">.highlight</span> <span class="nc">.k</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Keyword */</span>
<span class="nc">.highlight</span> <span class="nc">.o</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#666666</span> <span class="p">}</span> <span class="c">/* Operator */</span>
<span class="nc">.highlight</span> <span class="nc">.cm</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#408080</span><span class="p">;</span> <span class="k">font-style</span><span class="o">:</span> <span class="k">italic</span> <span class="p">}</span> <span class="c">/* Comment.Multiline */</span>
<span class="nc">.highlight</span> <span class="nc">.cp</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BC7A00</span> <span class="p">}</span> <span class="c">/* Comment.Preproc */</span>
<span class="nc">.highlight</span> <span class="nc">.c1</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#408080</span><span class="p">;</span> <span class="k">font-style</span><span class="o">:</span> <span class="k">italic</span> <span class="p">}</span> <span class="c">/* Comment.Single */</span>
<span class="nc">.highlight</span> <span class="nc">.cs</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#408080</span><span class="p">;</span> <span class="k">font-style</span><span class="o">:</span> <span class="k">italic</span> <span class="p">}</span> <span class="c">/* Comment.Special */</span>
<span class="nc">.highlight</span> <span class="nc">.gd</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#A00000</span> <span class="p">}</span> <span class="c">/* Generic.Deleted */</span>
<span class="nc">.highlight</span> <span class="nc">.ge</span> <span class="p">{</span> <span class="k">font-style</span><span class="o">:</span> <span class="k">italic</span> <span class="p">}</span> <span class="c">/* Generic.Emph */</span>
<span class="nc">.highlight</span> <span class="nc">.gr</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#FF0000</span> <span class="p">}</span> <span class="c">/* Generic.Error */</span>
<span class="nc">.highlight</span> <span class="nc">.gh</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#000080</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Generic.Heading */</span>
<span class="nc">.highlight</span> <span class="nc">.gi</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#00A000</span> <span class="p">}</span> <span class="c">/* Generic.Inserted */</span>
<span class="nc">.highlight</span> <span class="nc">.go</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#808080</span> <span class="p">}</span> <span class="c">/* Generic.Output */</span>
<span class="nc">.highlight</span> <span class="nc">.gp</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#000080</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Generic.Prompt */</span>
<span class="nc">.highlight</span> <span class="nc">.gs</span> <span class="p">{</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Generic.Strong */</span>
<span class="nc">.highlight</span> <span class="nc">.gu</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#800080</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Generic.Subheading */</span>
<span class="nc">.highlight</span> <span class="nc">.gt</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#0040D0</span> <span class="p">}</span> <span class="c">/* Generic.Traceback */</span>
<span class="nc">.highlight</span> <span class="nc">.kc</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Keyword.Constant */</span>
<span class="nc">.highlight</span> <span class="nc">.kd</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Keyword.Declaration */</span>
<span class="nc">.highlight</span> <span class="nc">.kn</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Keyword.Namespace */</span>
<span class="nc">.highlight</span> <span class="nc">.kp</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span> <span class="p">}</span> <span class="c">/* Keyword.Pseudo */</span>
<span class="nc">.highlight</span> <span class="nc">.kr</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Keyword.Reserved */</span>
<span class="nc">.highlight</span> <span class="nc">.kt</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#B00040</span> <span class="p">}</span> <span class="c">/* Keyword.Type */</span>
<span class="nc">.highlight</span> <span class="nc">.m</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#666666</span> <span class="p">}</span> <span class="c">/* Literal.Number */</span>
<span class="nc">.highlight</span> <span class="nc">.s</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BA2121</span> <span class="p">}</span> <span class="c">/* Literal.String */</span>
<span class="nc">.highlight</span> <span class="nc">.na</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#7D9029</span> <span class="p">}</span> <span class="c">/* Name.Attribute */</span>
<span class="nc">.highlight</span> <span class="nc">.nb</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span> <span class="p">}</span> <span class="c">/* Name.Builtin */</span>
<span class="nc">.highlight</span> <span class="nc">.nc</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#0000FF</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Name.Class */</span>
<span class="nc">.highlight</span> <span class="nc">.no</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#880000</span> <span class="p">}</span> <span class="c">/* Name.Constant */</span>
<span class="nc">.highlight</span> <span class="nc">.nd</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#AA22FF</span> <span class="p">}</span> <span class="c">/* Name.Decorator */</span>
<span class="nc">.highlight</span> <span class="nc">.ni</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#999999</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Name.Entity */</span>
<span class="nc">.highlight</span> <span class="nc">.ne</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#D2413A</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Name.Exception */</span>
<span class="nc">.highlight</span> <span class="nc">.nf</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#0000FF</span> <span class="p">}</span> <span class="c">/* Name.Function */</span>
<span class="nc">.highlight</span> <span class="nc">.nl</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#A0A000</span> <span class="p">}</span> <span class="c">/* Name.Label */</span>
<span class="nc">.highlight</span> <span class="nc">.nn</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#0000FF</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Name.Namespace */</span>
<span class="nc">.highlight</span> <span class="nc">.nt</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Name.Tag */</span>
<span class="nc">.highlight</span> <span class="nc">.nv</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#19177C</span> <span class="p">}</span> <span class="c">/* Name.Variable */</span>
<span class="nc">.highlight</span> <span class="nc">.ow</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#AA22FF</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Operator.Word */</span>
<span class="nc">.highlight</span> <span class="nc">.w</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#bbbbbb</span> <span class="p">}</span> <span class="c">/* Text.Whitespace */</span>
<span class="nc">.highlight</span> <span class="nc">.mf</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#666666</span> <span class="p">}</span> <span class="c">/* Literal.Number.Float */</span>
<span class="nc">.highlight</span> <span class="nc">.mh</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#666666</span> <span class="p">}</span> <span class="c">/* Literal.Number.Hex */</span>
<span class="nc">.highlight</span> <span class="nc">.mi</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#666666</span> <span class="p">}</span> <span class="c">/* Literal.Number.Integer */</span>
<span class="nc">.highlight</span> <span class="nc">.mo</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#666666</span> <span class="p">}</span> <span class="c">/* Literal.Number.Oct */</span>
<span class="nc">.highlight</span> <span class="nc">.sb</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BA2121</span> <span class="p">}</span> <span class="c">/* Literal.String.Backtick */</span>
<span class="nc">.highlight</span> <span class="nc">.sc</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BA2121</span> <span class="p">}</span> <span class="c">/* Literal.String.Char */</span>
<span class="nc">.highlight</span> <span class="nc">.sd</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BA2121</span><span class="p">;</span> <span class="k">font-style</span><span class="o">:</span> <span class="k">italic</span> <span class="p">}</span> <span class="c">/* Literal.String.Doc */</span>
<span class="nc">.highlight</span> <span class="nc">.s2</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BA2121</span> <span class="p">}</span> <span class="c">/* Literal.String.Double */</span>
<span class="nc">.highlight</span> <span class="nc">.se</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BB6622</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Literal.String.Escape */</span>
<span class="nc">.highlight</span> <span class="nc">.sh</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BA2121</span> <span class="p">}</span> <span class="c">/* Literal.String.Heredoc */</span>
<span class="nc">.highlight</span> <span class="nc">.si</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BB6688</span><span class="p">;</span> <span class="k">font-weight</span><span class="o">:</span> <span class="k">bold</span> <span class="p">}</span> <span class="c">/* Literal.String.Interpol */</span>
<span class="nc">.highlight</span> <span class="nc">.sx</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span> <span class="p">}</span> <span class="c">/* Literal.String.Other */</span>
<span class="nc">.highlight</span> <span class="nc">.sr</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BB6688</span> <span class="p">}</span> <span class="c">/* Literal.String.Regex */</span>
<span class="nc">.highlight</span> <span class="nc">.s1</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#BA2121</span> <span class="p">}</span> <span class="c">/* Literal.String.Single */</span>
<span class="nc">.highlight</span> <span class="nc">.ss</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#19177C</span> <span class="p">}</span> <span class="c">/* Literal.String.Symbol */</span>
<span class="nc">.highlight</span> <span class="nc">.bp</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#008000</span> <span class="p">}</span> <span class="c">/* Name.Builtin.Pseudo */</span>
<span class="nc">.highlight</span> <span class="nc">.vc</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#19177C</span> <span class="p">}</span> <span class="c">/* Name.Variable.Class */</span>
<span class="nc">.highlight</span> <span class="nc">.vg</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#19177C</span> <span class="p">}</span> <span class="c">/* Name.Variable.Global */</span>
<span class="nc">.highlight</span> <span class="nc">.vi</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#19177C</span> <span class="p">}</span> <span class="c">/* Name.Variable.Instance */</span>
<span class="nc">.highlight</span> <span class="nc">.il</span> <span class="p">{</span> <span class="k">color</span><span class="o">:</span> <span class="m">#666666</span> <span class="p">}</span> <span class="c">/* Literal.Number.Integer.Long */</span>
</pre></div>
  </message>
</messages>
