File: IconPair_8C-source.html

package info (click to toggle)
witty 3.1.2-3
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 45,512 kB
  • ctags: 35,832
  • sloc: cpp: 69,469; ansic: 66,945; xml: 4,383; sh: 594; perl: 108; makefile: 106
file content (98 lines) | stat: -rw-r--r-- 14,253 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
<title>Wt examples: /home/koen/project/wt/public-git/wt/examples/treelist/IconPair.C Source File</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="modules.html"><span>Modules</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
<h1>/home/koen/project/wt/public-git/wt/examples/treelist/IconPair.C</h1><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 "<a class="code" href="IconPair_8h.html">IconPair.h</a>"</span>
<a name="l00011"></a>00011 
<a name="l00012"></a><a class="code" href="classIconPair.html#e046514e1811766cbb4568ff5067de57">00012</a> <a class="code" href="classIconPair.html#e046514e1811766cbb4568ff5067de57" 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#a5a3e93a551fd41b180c6b28fa169946">setImplementation</a>(<a class="code" href="classIconPair.html#c05f98096ddc1f784692a45714380dc7">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#c00d775170f47e715894b24de6b869da">implementStateless</a>(&amp;<a class="code" href="classIconPair.html#c4fc5158f2431ff46f81943db2c6edca" title="Set state to 0 (show icon 1).">IconPair::showIcon1</a>, &amp;<a class="code" href="classIconPair.html#6f89d1e7951bcc1e060b9bc73bc97a7e" 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#c00d775170f47e715894b24de6b869da">implementStateless</a>(&amp;<a class="code" href="classIconPair.html#4a06f61619db889f4f11adac37e45b42" title="Set state to 1 (show icon 2).">IconPair::showIcon2</a>, &amp;<a class="code" href="classIconPair.html#28fe301bcdd61cb0f022cb3aac17de6d" 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#ed7eec7b9a562b84fdb97f68f37ce694">setInline</a>(<span class="keyword">true</span>);
<a name="l00027"></a>00027 
<a name="l00028"></a>00028   <a class="code" href="classIconPair.html#38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#0825c3ccbd4999afc1a88fafa6aa6fc7">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#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(SLOT(<a class="code" href="classIconPair.html#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#0825c3ccbd4999afc1a88fafa6aa6fc7">Wt::WImage::hide</a>));
<a name="l00032"></a>00032     <a class="code" href="classIconPair.html#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(SLOT(<a class="code" href="classIconPair.html#38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#52dcef5a385ddfa0a8c3e6c20000f181">Wt::WImage::show</a>));
<a name="l00033"></a>00033 
<a name="l00034"></a>00034     <a class="code" href="classIconPair.html#38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(SLOT(<a class="code" href="classIconPair.html#38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#0825c3ccbd4999afc1a88fafa6aa6fc7">Wt::WImage::hide</a>));
<a name="l00035"></a>00035     <a class="code" href="classIconPair.html#38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#e11e050cce0d4a8f742afa3ef92bfe8c">clicked</a>().connect(SLOT(<a class="code" href="classIconPair.html#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>, <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#52dcef5a385ddfa0a8c3e6c20000f181">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#d1eb3d24f374cb311ef88e43b3036503">decorationStyle</a>().setCursor(<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/namespaceWt.html#6dc0346a6ae888d6d4ab44f022e61eb6f860d39b9a2ba8f7d7359453bf15a37c">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#349d74977ef2174b64bab37e2b9a27ea">00041</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#349d74977ef2174b64bab37e2b9a27ea" 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#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#52dcef5a385ddfa0a8c3e6c20000f181">show</a>();
<a name="l00045"></a>00045     <a class="code" href="classIconPair.html#38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#0825c3ccbd4999afc1a88fafa6aa6fc7">hide</a>();
<a name="l00046"></a>00046   } <span class="keywordflow">else</span> {
<a name="l00047"></a>00047     <a class="code" href="classIconPair.html#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#0825c3ccbd4999afc1a88fafa6aa6fc7">hide</a>();
<a name="l00048"></a>00048     <a class="code" href="classIconPair.html#38a46596764e5dc56fec4d3e0c0479e9" title="Second icon.">icon2_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#52dcef5a385ddfa0a8c3e6c20000f181">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#8ad646ae8a69c65428c6244bb3af24e6">00052</a> <span class="keywordtype">int</span> <a class="code" href="classIconPair.html#8ad646ae8a69c65428c6244bb3af24e6" 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#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#594cbc1789cb8e2123bc5d968aa320ea">isHidden</a>() ? 1 : 0);
<a name="l00055"></a>00055 }
<a name="l00056"></a>00056 
<a name="l00057"></a><a class="code" href="classIconPair.html#c4fc5158f2431ff46f81943db2c6edca">00057</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#c4fc5158f2431ff46f81943db2c6edca" 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#ae00701197f8c04483503c8f11be2fe9" title="Undo state for prelearning stateless showIcon1() and showIcon2() slots.">previousState_</a> = (<a class="code" href="classIconPair.html#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#594cbc1789cb8e2123bc5d968aa320ea">isHidden</a>() ? 1 : 0);
<a name="l00060"></a>00060   <a class="code" href="classIconPair.html#349d74977ef2174b64bab37e2b9a27ea" 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#4a06f61619db889f4f11adac37e45b42">00063</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#4a06f61619db889f4f11adac37e45b42" 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#ae00701197f8c04483503c8f11be2fe9" title="Undo state for prelearning stateless showIcon1() and showIcon2() slots.">previousState_</a> = (<a class="code" href="classIconPair.html#faea8a9d7016035313d7ff57386ecd0a" title="First icon.">icon1_</a>-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#594cbc1789cb8e2123bc5d968aa320ea">isHidden</a>() ? 1 : 0);
<a name="l00066"></a>00066   <a class="code" href="classIconPair.html#349d74977ef2174b64bab37e2b9a27ea" 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#6f89d1e7951bcc1e060b9bc73bc97a7e">00069</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#6f89d1e7951bcc1e060b9bc73bc97a7e" 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#349d74977ef2174b64bab37e2b9a27ea" title="Set which icon should be visible.">setState</a>(<a class="code" href="classIconPair.html#ae00701197f8c04483503c8f11be2fe9" 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#28fe301bcdd61cb0f022cb3aac17de6d">00074</a> <span class="keywordtype">void</span> <a class="code" href="classIconPair.html#28fe301bcdd61cb0f022cb3aac17de6d" 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#349d74977ef2174b64bab37e2b9a27ea" title="Set which icon should be visible.">setState</a>(<a class="code" href="classIconPair.html#ae00701197f8c04483503c8f11be2fe9" title="Undo state for prelearning stateless showIcon1() and showIcon2() slots.">previousState_</a>);
<a name="l00077"></a>00077 } <span class="comment">//</span>
</pre></div></div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:12 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by&nbsp;<a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.6</small></address>
</body>
</html>