Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > b3a1f4d91c26f535919e39e25606614a > files > 423

wt-doc-3.2.3-1.fc18.noarch.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Wt examples: OptionList Class Reference</title>

<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css" />



</head>
<body>
<div id="top"><!-- do not remove this div! -->


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wt examples
   &#160;<span id="projectnumber">3.2.3</span>
   </div>
   
  </td>
  
  
  
 </tr>
 </tbody>
</table>
</div>

<!-- Generated by Doxygen 1.7.5.1 -->
  <div id="navrow1" class="tabs">
    <ul class="tablist">
      <li><a href="index.html"><span>Main&#160;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="annotated.html"><span>Class&#160;List</span></a></li>
      <li><a href="inherits.html"><span>Class&#160;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&#160;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="header">
  <div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="#pri-methods">Private Member Functions</a> &#124;
<a href="#pri-attribs">Private Attributes</a> &#124;
<a href="#friends">Friends</a>  </div>
  <div class="headertitle">
<div class="title">OptionList Class Reference<div class="ingroups"><a class="el" href="group__composerexample.html">Composer example</a></div></div>  </div>
</div>
<div class="contents">
<!-- doxytag: class="OptionList" --><!-- doxytag: inherits="Wt::WContainerWidget" -->
<p>A list of options, separated by '|'.  
 <a href="classOptionList.html#details">More...</a></p>

<p><code>#include &lt;<a class="el" href="OptionList_8h_source.html">OptionList.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for OptionList:</div>
<div class="dyncontent">
<div class="center"><img src="classOptionList__inherit__graph.png" border="0" usemap="#OptionList_inherit__map" alt="Inheritance graph"/></div>
<map name="OptionList_inherit__map" id="OptionList_inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html" title="Wt::WContainerWidget" alt="" coords="5,304,160,331"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html" title="Wt::WInteractWidget" alt="" coords="11,229,155,256"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html" title="Wt::WWebWidget" alt="" coords="19,155,147,181"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html" title="Wt::WWidget" alt="" coords="33,80,132,107"/><area shape="rect" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="35,5,131,32"/></map>
<center><span class="legend">[<a href="graph_legend.html">legend</a>]</span></center></div>

<p><a href="classOptionList-members.html">List of all members.</a></p>
<table class="memberdecls">
<tr><td colspan="2"><h2><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOptionList.html#a36f29d1c413236e28880b0307d438070">OptionList</a> (<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *<a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a3461e31818c4d2f516641bdaf508312a">parent</a>=0)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Create an <a class="el" href="classOptionList.html" title="A list of options, separated by &#39;|&#39;.">OptionList</a>.  <a href="#a36f29d1c413236e28880b0307d438070"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOptionList.html#a358bf988ce23142cabf3e19dcbc2a158">add</a> (<a class="el" href="classOption.html">Option</a> *option)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Add an <a class="el" href="classOption.html" title="A clickable option.">Option</a> to the list.  <a href="#a358bf988ce23142cabf3e19dcbc2a158"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOptionList.html#a5b0013e09c5f269f33aa5c9bfb17e32b">update</a> ()</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">Updates the stateless implementations after an <a class="el" href="classOption.html" title="A clickable option.">Option</a> has been hidden or shown.  <a href="#a5b0013e09c5f269f33aa5c9bfb17e32b"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-methods"></a>
Private Member Functions</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOptionList.html#a3d7599510d4a5a1da8a197990d50e597">optionVisibilityChanged</a> (<a class="el" href="classOption.html">Option</a> *opt, bool hidden)</td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">An option changed visibility: possibly update the separators inbetween.  <a href="#a3d7599510d4a5a1da8a197990d50e597"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="pri-attribs"></a>
Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">std::vector&lt; <a class="el" href="classOption.html">Option</a> * &gt;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f">options_</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The list of options.  <a href="#a8c4df58ec022c0c79fb897448efa8a1f"></a><br/></td></tr>
<tr><td class="memItemLeft" align="right" valign="top"><a class="el" href="classOption.html">Option</a> *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOptionList.html#a51f0ec3f162144435b233c25a689b8f7">optionNeedReset_</a></td></tr>
<tr><td class="mdescLeft">&#160;</td><td class="mdescRight">The option that needs its stateless code updated.  <a href="#a51f0ec3f162144435b233c25a689b8f7"></a><br/></td></tr>
<tr><td colspan="2"><h2><a name="friends"></a>
Friends</h2></td></tr>
<tr><td class="memItemLeft" align="right" valign="top">class&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="classOptionList.html#abd6e6c0003d4ecf9ff0385ab131dcc0e">Option</a></td></tr>
</table>
<hr/><a name="details" id="details"></a><h2>Detailed Description</h2>
<div class="textblock"><p>A list of options, separated by '|'. </p>
<p>This widget is part of the Wt composer example.</p>
<p>An <a class="el" href="classOptionList.html" title="A list of options, separated by &#39;|&#39;.">OptionList</a> displays a list of <a class="el" href="classOption.html" title="A clickable option.">Option</a> widgets, which are separated by a '|' separator.</p>
<p>For example, Foo | Bar | Huu</p>
<p>When Options are hidden, the separators are adjusted so that there is no separator after the last visible option. However, this requires a call of <a class="el" href="classOptionList.html#a5b0013e09c5f269f33aa5c9bfb17e32b" title="Updates the stateless implementations after an Option has been hidden or shown.">update()</a> each time an option is hidden or shown. This is because the removing of separators is optimized in stateless implementations, and thus in client-side JavaScript code. Since the behaviour is not entirely stateless, the <a class="el" href="classOptionList.html#a5b0013e09c5f269f33aa5c9bfb17e32b" title="Updates the stateless implementations after an Option has been hidden or shown.">update()</a> method resets stateless implementations if necessary.</p>
<dl class="see"><dt><b>See also:</b></dt><dd><a class="el" href="classOptionList.html" title="A list of options, separated by &#39;|&#39;.">OptionList</a> </dd></dl>

<p>Definition at line <a class="el" href="OptionList_8h_source.html#l00040">40</a> of file <a class="el" href="OptionList_8h_source.html">OptionList.h</a>.</p>
</div><hr/><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" id="a36f29d1c413236e28880b0307d438070"></a><!-- doxytag: member="OptionList::OptionList" ref="a36f29d1c413236e28880b0307d438070" args="(WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">OptionList::OptionList </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *&#160;</td>
          <td class="paramname"><em>parent</em> = <code>0</code></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Create an <a class="el" href="classOptionList.html" title="A list of options, separated by &#39;|&#39;.">OptionList</a>. </p>

<p>Definition at line <a class="el" href="OptionList_8C_source.html#l00011">11</a> of file <a class="el" href="OptionList_8C_source.html">OptionList.C</a>.</p>
<div class="fragment"><pre class="fragment">  : <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(parent),
    <a class="code" href="classOptionList.html#a51f0ec3f162144435b233c25a689b8f7" title="The option that needs its stateless code updated.">optionNeedReset_</a>(0)
{
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#a4762c1aa0b5788e54a52270674f21e23">resize</a>(WLength::Auto, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WLength.html">WLength</a>(2.5, WLength::FontEx));
}
</pre></div>
</div>
</div>
<hr/><h2>Member Function Documentation</h2>
<a class="anchor" id="a358bf988ce23142cabf3e19dcbc2a158"></a><!-- doxytag: member="OptionList::add" ref="a358bf988ce23142cabf3e19dcbc2a158" args="(Option *option)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OptionList::add </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classOption.html">Option</a> *&#160;</td>
          <td class="paramname"><em>option</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Add an <a class="el" href="classOption.html" title="A clickable option.">Option</a> to the list. </p>

<p>Definition at line <a class="el" href="OptionList_8C_source.html#l00018">18</a> of file <a class="el" href="OptionList_8C_source.html">OptionList.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a2cfe66d9b62940f889e99538a9f478d2">addWidget</a>(option);
  option-&gt;<a class="code" href="classOption.html#a2bdf69d2dbaddda6c91cf4b1e720b77c">setOptionList</a>(<span class="keyword">this</span>);

  <span class="keywordflow">if</span> (!<a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>.empty()) {
    <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>.back()-&gt;addSeparator();
  }

  <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>.push_back(option);
}
</pre></div>
</div>
</div>
<a class="anchor" id="a3d7599510d4a5a1da8a197990d50e597"></a><!-- doxytag: member="OptionList::optionVisibilityChanged" ref="a3d7599510d4a5a1da8a197990d50e597" args="(Option *opt, bool hidden)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OptionList::optionVisibilityChanged </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="classOption.html">Option</a> *&#160;</td>
          <td class="paramname"><em>opt</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">bool&#160;</td>
          <td class="paramname"><em>hidden</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>An option changed visibility: possibly update the separators inbetween. </p>

<p>Definition at line <a class="el" href="OptionList_8C_source.html#l00038">38</a> of file <a class="el" href="OptionList_8C_source.html">OptionList.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="comment">/*</span>
<span class="comment">   * Check if it was the last visible option, in that case the second last</span>
<span class="comment">   * visible option loses its separator.</span>
<span class="comment">   */</span>
  <span class="keywordflow">for</span> (std::size_t i = <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>.size() - 1; i &gt; 0; --i) {
    <span class="keywordflow">if</span> (<a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[i] == opt) {
      <span class="keywordflow">for</span> (<span class="keywordtype">int</span> j = i - 1; j &gt;= 0; --j) {
        <span class="keywordflow">if</span> (!<a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[j]-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ad565084bebed7abe45a659f6ba7101cf">isHidden</a>()) {
          <span class="keywordflow">if</span> (hidden)
            <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[j]-&gt;hideSeparator();
          <span class="keywordflow">else</span>
            <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[j]-&gt;showSeparator();
          <span class="keywordflow">break</span>;
        }
      }
      <span class="keywordflow">break</span>;
    } <span class="keywordflow">else</span>
      <span class="keywordflow">if</span> (!<a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[i]-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ad565084bebed7abe45a659f6ba7101cf">isHidden</a>())
        <span class="keywordflow">break</span>;
  }

  <span class="comment">/*</span>
<span class="comment">   * The Option to the right needs to relearn its stateless</span>
<span class="comment">   * slot code for hide() and show().</span>
<span class="comment">   */</span>
  <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> i = 0; i &lt; <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>.size(); ++i) {
    <span class="keywordflow">if</span> (<a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[i] == opt) {
      <span class="keywordflow">for</span> (<span class="keywordtype">unsigned</span> j = i + 1; j &lt; <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>.size(); ++j) {
        <span class="keywordflow">if</span> (!<a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[j]-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ad565084bebed7abe45a659f6ba7101cf">isHidden</a>()) {
          <a class="code" href="classOptionList.html#a51f0ec3f162144435b233c25a689b8f7" title="The option that needs its stateless code updated.">optionNeedReset_</a> = <a class="code" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f" title="The list of options.">options_</a>[j];
          <span class="keywordflow">break</span>;
        }
      }

      <span class="keywordflow">break</span>;
    }
  }
}
</pre></div>
</div>
</div>
<a class="anchor" id="a5b0013e09c5f269f33aa5c9bfb17e32b"></a><!-- doxytag: member="OptionList::update" ref="a5b0013e09c5f269f33aa5c9bfb17e32b" args="()" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void OptionList::update </td>
          <td>(</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Updates the stateless implementations after an <a class="el" href="classOption.html" title="A clickable option.">Option</a> has been hidden or shown. </p>

<p>Definition at line <a class="el" href="OptionList_8C_source.html#l00030">30</a> of file <a class="el" href="OptionList_8C_source.html">OptionList.C</a>.</p>
<div class="fragment"><pre class="fragment">{
  <span class="keywordflow">if</span> (<a class="code" href="classOptionList.html#a51f0ec3f162144435b233c25a689b8f7" title="The option that needs its stateless code updated.">optionNeedReset_</a> != 0)
    <a class="code" href="classOptionList.html#a51f0ec3f162144435b233c25a689b8f7" title="The option that needs its stateless code updated.">optionNeedReset_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html#a92d8b00edc79b7a60d41d7c088f50436">resetLearnedSlots</a>();

  <a class="code" href="classOptionList.html#a51f0ec3f162144435b233c25a689b8f7" title="The option that needs its stateless code updated.">optionNeedReset_</a> = 0;
}
</pre></div>
</div>
</div>
<hr/><h2>Friends And Related Function Documentation</h2>
<a class="anchor" id="abd6e6c0003d4ecf9ff0385ab131dcc0e"></a><!-- doxytag: member="OptionList::Option" ref="abd6e6c0003d4ecf9ff0385ab131dcc0e" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">friend class <a class="el" href="classOption.html">Option</a><code> [friend]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>Definition at line <a class="el" href="OptionList_8h_source.html#l00066">66</a> of file <a class="el" href="OptionList_8h_source.html">OptionList.h</a>.</p>

</div>
</div>
<hr/><h2>Member Data Documentation</h2>
<a class="anchor" id="a51f0ec3f162144435b233c25a689b8f7"></a><!-- doxytag: member="OptionList::optionNeedReset_" ref="a51f0ec3f162144435b233c25a689b8f7" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="classOption.html">Option</a>* <a class="el" href="classOptionList.html#a51f0ec3f162144435b233c25a689b8f7">OptionList::optionNeedReset_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The option that needs its stateless code updated. </p>

<p>Definition at line <a class="el" href="OptionList_8h_source.html#l00061">61</a> of file <a class="el" href="OptionList_8h_source.html">OptionList.h</a>.</p>

</div>
</div>
<a class="anchor" id="a8c4df58ec022c0c79fb897448efa8a1f"></a><!-- doxytag: member="OptionList::options_" ref="a8c4df58ec022c0c79fb897448efa8a1f" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::vector&lt;<a class="el" href="classOption.html">Option</a> *&gt; <a class="el" href="classOptionList.html#a8c4df58ec022c0c79fb897448efa8a1f">OptionList::options_</a><code> [private]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>The list of options. </p>

<p>Definition at line <a class="el" href="OptionList_8h_source.html#l00058">58</a> of file <a class="el" href="OptionList_8h_source.html">OptionList.h</a>.</p>

</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>/home/koen/project/wt/public-git/wt/examples/composer/<a class="el" href="OptionList_8h_source.html">OptionList.h</a></li>
<li>/home/koen/project/wt/public-git/wt/examples/composer/<a class="el" href="OptionList_8C_source.html">OptionList.C</a></li>
</ul>
</div>
<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&nbsp;<a
href="http://www.doxygen.org/index.html"><img src="doxygen.png"
alt="doxygen" border="0" style="vertical-align: middle; display:
inline-block; height: 2em"></a> 1.7.5.1</small></address>
</body>
</html>