Sophie

Sophie

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

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: /home/koen/project/wt/public-git/wt/examples/treelist/IconPair.C Source File</title>

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



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


<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  
  
  <td style="padding-left: 0.5em;">
   <div id="projectname">Wt examples
   &#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><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div id="navrow2" class="tabs2">
    <ul class="tablist">
      <li><a href="files.html"><span>File&#160;List</span></a></li>
      <li><a href="globals.html"><span>File&#160;Members</span></a></li>
    </ul>
  </div>
<div class="header">
  <div class="headertitle">
<div class="title">/home/koen/project/wt/public-git/wt/examples/treelist/IconPair.C</div>  </div>
</div>
<div class="contents">
<a href="IconPair_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/*</span>
<a name="l00002"></a>00002 <span class="comment"> * Copyright (C) 2008 Emweb bvba, Kessel-Lo, Belgium.</span>
<a name="l00003"></a>00003 <span class="comment"> *</span>
<a name="l00004"></a>00004 <span class="comment"> * See the LICENSE file for terms of use.</span>
<a name="l00005"></a>00005 <span class="comment"> */</span>
<a name="l00006"></a>00006 <span class="preprocessor">#include &lt;Wt/WCssDecorationStyle&gt;</span>
<a name="l00007"></a>00007 <span class="preprocessor">#include &lt;Wt/WContainerWidget&gt;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &lt;Wt/WImage&gt;</span>
<a name="l00009"></a>00009 
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;<a class="code" href="IconPair_8h.html">IconPair.h</a>&quot;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="classIconPair.html#ae046514e1811766cbb4568ff5067de57">00012</a> <a class="code" href="classIconPair.html#ae046514e1811766cbb4568ff5067de57" title="Construct a two-state icon widget.">IconPair::IconPair</a>(<span class="keyword">const</span> std::string icon1URI, <span class="keyword">const</span> std::string icon2URI,
<a name="l00013"></a>00013                    <span class="keywordtype">bool</span> clickIsSwitch, <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html">Wt::WContainerWidget</a> *parent)
<a name="l00014"></a>00014   : Wt::WCompositeWidget(parent),
<a name="l00015"></a>00015     impl_(new Wt::WContainerWidget()),
<a name="l00016"></a>00016     icon1_(new Wt::WImage(icon1URI, impl_)),
<a name="l00017"></a>00017     icon2_(new Wt::WImage(icon2URI, impl_)),
<a name="l00018"></a>00018     icon1Clicked(icon1_-&gt;clicked()),
<a name="l00019"></a>00019     icon2Clicked(icon2_-&gt;clicked())
<a name="l00020"></a>00020 {
<a name="l00021"></a>00021   <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCompositeWidget.html#aa5a3e93a551fd41b180c6b28fa169946">setImplementation</a>(<a class="code" href="classIconPair.html#ac05f98096ddc1f784692a45714380dc7">impl_</a>);
<a name="l00022"></a>00022 
<a name="l00023"></a>00023   <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html#adaa163b9e92933f3b2ff4ec58e2734c6">implementStateless</a>(&amp;<a class="code" href="classIconPair.html#ac4fc5158f2431ff46f81943db2c6edca" title="Set state to 0 (show icon 1).">IconPair::showIcon1</a>, &amp;<a class="code" href="classIconPair.html#a6f89d1e7951bcc1e060b9bc73bc97a7e" title="Undo function for prelearning showIcon1()">IconPair::undoShowIcon1</a>);
<a name="l00024"></a>00024   <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WObject.html#adaa163b9e92933f3b2ff4ec58e2734c6">implementStateless</a>(&amp;<a class="code" href="classIconPair.html#a4a06f61619db889f4f11adac37e45b42" title="Set state to 1 (show icon 2).">IconPair::showIcon2</a>, &amp;<a class="code" href="classIconPair.html#a28fe301bcdd61cb0f022cb3aac17de6d" title="Undo function for prelearning showIcon2()">IconPair::undoShowIcon2</a>);
<a name="l00025"></a>00025 
<a name="l00026"></a>00026   <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCompositeWidget.html#a96100109e775da87bfb3c5848c3c6a82">setInline</a>(<span class="keyword">true</span>);
<a name="l00027"></a>00027 
<a name="l00028"></a>00028   <a class="code" href="classIconPair.html#a38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a0825c3ccbd4999afc1a88fafa6aa6fc7">hide</a>();
<a name="l00029"></a>00029 
<a name="l00030"></a>00030   <span class="keywordflow">if</span> (clickIsSwitch) {
<a name="l00031"></a>00031     <a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>, &amp;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a0825c3ccbd4999afc1a88fafa6aa6fc7">Wt::WImage::hide</a>);
<a name="l00032"></a>00032     <a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<a class="code" href="classIconPair.html#a38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>, &amp;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a52dcef5a385ddfa0a8c3e6c20000f181">Wt::WImage::show</a>);
<a name="l00033"></a>00033 
<a name="l00034"></a>00034     <a class="code" href="classIconPair.html#a38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<a class="code" href="classIconPair.html#a38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>, &amp;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a0825c3ccbd4999afc1a88fafa6aa6fc7">Wt::WImage::hide</a>);
<a name="l00035"></a>00035     <a class="code" href="classIconPair.html#a38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WInteractWidget.html#ae11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(<a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>, &amp;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a52dcef5a385ddfa0a8c3e6c20000f181">Wt::WImage::show</a>); <span class="comment">//</span>
<a name="l00036"></a>00036 
<a name="l00037"></a>00037     <a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WCompositeWidget.html#ad1eb3d24f374cb311ef88e43b3036503">decorationStyle</a>().setCursor(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#a6dc0346a6ae888d6d4ab44f022e61eb6af860d39b9a2ba8f7d7359453bf15a37c">Wt::PointingHandCursor</a>);
<a name="l00038"></a>00038   }
<a name="l00039"></a>00039 } <span class="comment">//</span>
<a name="l00040"></a>00040 
<a name="l00041"></a><a class="code" href="classIconPair.html#a349d74977ef2174b64bab37e2b9a27ea">00041</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#a349d74977ef2174b64bab37e2b9a27ea" title="Set which icon should be visible.">IconPair::setState</a>(<span class="keywordtype">int</span> num)
<a name="l00042"></a>00042 {
<a name="l00043"></a>00043   <span class="keywordflow">if</span> (num == 0) {
<a name="l00044"></a>00044     <a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a52dcef5a385ddfa0a8c3e6c20000f181">show</a>();
<a name="l00045"></a>00045     <a class="code" href="classIconPair.html#a38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a0825c3ccbd4999afc1a88fafa6aa6fc7">hide</a>();
<a name="l00046"></a>00046   } <span class="keywordflow">else</span> {
<a name="l00047"></a>00047     <a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a0825c3ccbd4999afc1a88fafa6aa6fc7">hide</a>();
<a name="l00048"></a>00048     <a class="code" href="classIconPair.html#a38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWidget.html#a52dcef5a385ddfa0a8c3e6c20000f181">show</a>();
<a name="l00049"></a>00049   }
<a name="l00050"></a>00050 }
<a name="l00051"></a>00051 
<a name="l00052"></a><a class="code" href="classIconPair.html#a8ad646ae8a69c65428c6244bb3af24e6">00052</a> <span class="keywordtype">int</span> <a class="code" href="classIconPair.html#a8ad646ae8a69c65428c6244bb3af24e6" title="Get the current state.">IconPair::state</a>()<span class="keyword"> const</span>
<a name="l00053"></a>00053 <span class="keyword"></span>{
<a name="l00054"></a>00054   <span class="keywordflow">return</span> (<a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ad565084bebed7abe45a659f6ba7101cf">isHidden</a>() ? 1 : 0);
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a><a class="code" href="classIconPair.html#ac4fc5158f2431ff46f81943db2c6edca">00057</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#ac4fc5158f2431ff46f81943db2c6edca" title="Set state to 0 (show icon 1).">IconPair::showIcon1</a>()
<a name="l00058"></a>00058 {
<a name="l00059"></a>00059   <a class="code" href="classIconPair.html#aae00701197f8c04483503c8f11be2fe9" title="Undo state for prelearning stateless showIcon1() and showIcon2() slots.">previousState_</a> = (<a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ad565084bebed7abe45a659f6ba7101cf">isHidden</a>() ? 1 : 0);
<a name="l00060"></a>00060   <a class="code" href="classIconPair.html#a349d74977ef2174b64bab37e2b9a27ea" title="Set which icon should be visible.">setState</a>(0);
<a name="l00061"></a>00061 }
<a name="l00062"></a>00062 
<a name="l00063"></a><a class="code" href="classIconPair.html#a4a06f61619db889f4f11adac37e45b42">00063</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#a4a06f61619db889f4f11adac37e45b42" title="Set state to 1 (show icon 2).">IconPair::showIcon2</a>()
<a name="l00064"></a>00064 {
<a name="l00065"></a>00065   <a class="code" href="classIconPair.html#aae00701197f8c04483503c8f11be2fe9" title="Undo state for prelearning stateless showIcon1() and showIcon2() slots.">previousState_</a> = (<a class="code" href="classIconPair.html#afaea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WWebWidget.html#ad565084bebed7abe45a659f6ba7101cf">isHidden</a>() ? 1 : 0);
<a name="l00066"></a>00066   <a class="code" href="classIconPair.html#a349d74977ef2174b64bab37e2b9a27ea" title="Set which icon should be visible.">setState</a>(1);
<a name="l00067"></a>00067 }
<a name="l00068"></a>00068 
<a name="l00069"></a><a class="code" href="classIconPair.html#a6f89d1e7951bcc1e060b9bc73bc97a7e">00069</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#a6f89d1e7951bcc1e060b9bc73bc97a7e" title="Undo function for prelearning showIcon1()">IconPair::undoShowIcon1</a>()
<a name="l00070"></a>00070 {
<a name="l00071"></a>00071   <a class="code" href="classIconPair.html#a349d74977ef2174b64bab37e2b9a27ea" title="Set which icon should be visible.">setState</a>(<a class="code" href="classIconPair.html#aae00701197f8c04483503c8f11be2fe9" title="Undo state for prelearning stateless showIcon1() and showIcon2() slots.">previousState_</a>);
<a name="l00072"></a>00072 }
<a name="l00073"></a>00073 
<a name="l00074"></a><a class="code" href="classIconPair.html#a28fe301bcdd61cb0f022cb3aac17de6d">00074</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#a28fe301bcdd61cb0f022cb3aac17de6d" title="Undo function for prelearning showIcon2()">IconPair::undoShowIcon2</a>()
<a name="l00075"></a>00075 {
<a name="l00076"></a>00076   <a class="code" href="classIconPair.html#a349d74977ef2174b64bab37e2b9a27ea" title="Set which icon should be visible.">setState</a>(<a class="code" href="classIconPair.html#aae00701197f8c04483503c8f11be2fe9" title="Undo state for prelearning stateless showIcon1() and showIcon2() slots.">previousState_</a>);
<a name="l00077"></a>00077 } <span class="comment">//</span>
</pre></div></div>
</div>
<hr size="1"><address style="text-align: right; margin: 3px"><small>
Generated on Thu Nov 1 2012 for <a href="http://www.webtoolkit.eu/wt">the
C++ Web Toolkit (Wt)</a> by&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>