File: classCharacter.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 (237 lines) | stat: -rw-r--r-- 16,984 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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
<!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: Character Class Reference</title>
<link href="doxygen.css" rel="stylesheet" type="text/css">
</head><body>
<!-- Generated by Doxygen 1.5.6 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&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 class="current"><a href="annotated.html"><span>Classes</span></a></li>
      <li><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="annotated.html"><span>Class&nbsp;List</span></a></li>
      <li><a href="hierarchy.html"><span>Class&nbsp;Hierarchy</span></a></li>
      <li><a href="functions.html"><span>Class&nbsp;Members</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Character Class Reference<br>
<small>
[<a class="el" href="group__dragexample.html">Drag and Drop example</a>]</small>
</h1><!-- doxytag: class="Character" --><!-- doxytag: inherits="Wt::WText" -->A Matrix character that takes red and/or blue pills.  
<a href="#_details">More...</a>
<p>
<code>#include &lt;<a class="el" href="Character_8h-source.html">Character.h</a>&gt;</code>
<p>
<div class="dynheader">
Inheritance diagram for Character:</div>
<div class="dynsection">
<p><center><img src="classCharacter__inherit__graph.png" border="0" usemap="#Character__inherit__map" alt="Inheritance graph"></center>
<map name="Character__inherit__map">
<area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html" title="Wt::WText" alt="" coords="35,304,117,331"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html" title="Wt::WInteractWidget" alt="" coords="5,229,147,256"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html" title="Wt::WWebWidget" alt="" coords="15,155,137,181"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html" title="Wt::WWidget" alt="" coords="28,80,124,107"><area shape="rect" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WObject.html" title="Wt::WObject" alt="" coords="28,5,124,32"></map>
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center></div>

<p>
<a href="classCharacter-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCharacter.html#7d57fd6f088ac348976cd2c503e01b93">Character</a> (const std::string &amp;name, <a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *<a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#3461e31818c4d2f516641bdaf508312a">parent</a>=0)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create a new character with the given name.  <a href="#7d57fd6f088ac348976cd2c503e01b93"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">void&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCharacter.html#bceca830291f8e59e658f182c5ada505">dropEvent</a> (<a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WDropEvent.html">WDropEvent</a> event)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">React to a drop event.  <a href="#bceca830291f8e59e658f182c5ada505"></a><br></td></tr>
<tr><td colspan="2"><br><h2>Private Attributes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">std::string&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCharacter.html#ca012a249f706cd301674fff9497b5de">name_</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The name.  <a href="#ca012a249f706cd301674fff9497b5de"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f">redDrops_</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The current number of red pills.  <a href="#fc151db0d1cdf304d3ac38d7d222f68f"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">int&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4">blueDrops_</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">The current number of blue pills.  <a href="#edb689bf579518ced1a0f93af0fbfcb4"></a><br></td></tr>
</table>
<hr><a name="_details"></a><h2>Detailed Description</h2>
A Matrix character that takes red and/or blue pills. 
<p>
The <a class="el" href="classCharacter.html" title="A Matrix character that takes red and/or blue pills.">Character</a> class demonstrates how to accept and react to drop events. 
<p>Definition at line <a class="el" href="Character_8h-source.html#l00024">24</a> of file <a class="el" href="Character_8h-source.html">Character.h</a>.</p>
<hr><h2>Constructor &amp; Destructor Documentation</h2>
<a class="anchor" name="7d57fd6f088ac348976cd2c503e01b93"></a><!-- doxytag: member="Character::Character" ref="7d57fd6f088ac348976cd2c503e01b93" args="(const std::string &amp;name, WContainerWidget *parent=0)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">Character::Character           </td>
          <td>(</td>
          <td class="paramtype">const std::string &amp;&nbsp;</td>
          <td class="paramname"> <em>name</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *&nbsp;</td>
          <td class="paramname"> <em>parent</em> = <code>0</code></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create a new character with the given name. 
<p>

<p>Definition at line <a class="el" href="Character_8C-source.html#l00006">6</a> of file <a class="el" href="Character_8C-source.html">Character.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00007"></a>00007   : <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html#49bf5785263785717834a9d1a7a52399">WText</a>(parent),
<a name="l00008"></a>00008     <a class="code" href="classCharacter.html#ca012a249f706cd301674fff9497b5de" title="The name.">name_</a>(name),
<a name="l00009"></a>00009     <a class="code" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f" title="The current number of red pills.">redDrops_</a>(0),
<a name="l00010"></a>00010     <a class="code" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4" title="The current number of blue pills.">blueDrops_</a>(0)
<a name="l00011"></a>00011 {
<a name="l00012"></a>00012   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html#2f788aa524d51b3962642c9f565e66e6">setText</a>(<a class="code" href="classCharacter.html#ca012a249f706cd301674fff9497b5de" title="The name.">name_</a> + <span class="stringliteral">" got no pills"</span>);
<a name="l00013"></a>00013 
<a name="l00014"></a>00014   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#6fd43dced1a62f7e79bc3522eeb16216">setStyleClass</a>(<span class="stringliteral">"character"</span>);
<a name="l00015"></a>00015 
<a name="l00016"></a>00016   <span class="comment">/*</span>
<a name="l00017"></a>00017 <span class="comment">   * Accept drops, and indicate this with a change in CSS style class.</span>
<a name="l00018"></a>00018 <span class="comment">   */</span>
<a name="l00019"></a>00019   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#ebee4b24e8128c08ae4aa3682adf6d8f">acceptDrops</a>(<span class="stringliteral">"red-pill"</span>, <span class="stringliteral">"red-drop-site"</span>);
<a name="l00020"></a>00020   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#ebee4b24e8128c08ae4aa3682adf6d8f">acceptDrops</a>(<span class="stringliteral">"blue-pill"</span>, <span class="stringliteral">"blue-drop-site"</span>);
<a name="l00021"></a>00021 
<a name="l00022"></a>00022   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWebWidget.html#73c0244d363cd2f8bd4814fe1ebee2b1">setInline</a>(<span class="keyword">false</span>);
<a name="l00023"></a>00023 }
</pre></div>
<p>

</div>
</div><p>
<hr><h2>Member Function Documentation</h2>
<a class="anchor" name="bceca830291f8e59e658f182c5ada505"></a><!-- doxytag: member="Character::dropEvent" ref="bceca830291f8e59e658f182c5ada505" args="(WDropEvent event)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Character::dropEvent           </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WDropEvent.html">WDropEvent</a>&nbsp;</td>
          <td class="paramname"> <em>event</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [virtual]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
React to a drop event. 
<p>

<p>Reimplemented from <a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WWidget.html#c436c4b99710b9199a9df3a8b4151a69">Wt::WWidget</a>.</p>

<p>Definition at line <a class="el" href="Character_8C-source.html#l00025">25</a> of file <a class="el" href="Character_8C-source.html">Character.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00026"></a>00026 {
<a name="l00027"></a>00027   <span class="keywordflow">if</span> (event.<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WDropEvent.html#14e3c3a1cb956319cefe63bddc29a0de">mimeType</a>() == <span class="stringliteral">"red-pill"</span>)
<a name="l00028"></a>00028     ++<a class="code" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f" title="The current number of red pills.">redDrops_</a>;
<a name="l00029"></a>00029   <span class="keywordflow">if</span> (event.<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WDropEvent.html#14e3c3a1cb956319cefe63bddc29a0de">mimeType</a>() == <span class="stringliteral">"blue-pill"</span>)
<a name="l00030"></a>00030     ++<a class="code" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4" title="The current number of blue pills.">blueDrops_</a>;
<a name="l00031"></a>00031 
<a name="l00032"></a>00032   std::string <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html#1081f42ae498fa8d23656cec207a4a76">text</a> = <a class="code" href="classCharacter.html#ca012a249f706cd301674fff9497b5de" title="The name.">name_</a> + <span class="stringliteral">" got "</span>;
<a name="l00033"></a>00033 
<a name="l00034"></a>00034   <span class="keywordflow">if</span> (<a class="code" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f" title="The current number of red pills.">redDrops_</a> != 0)
<a name="l00035"></a>00035     text += boost::lexical_cast&lt;std::string&gt;(<a class="code" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f" title="The current number of red pills.">redDrops_</a>) + <span class="stringliteral">" red pill"</span>;
<a name="l00036"></a>00036   <span class="keywordflow">if</span> (<a class="code" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f" title="The current number of red pills.">redDrops_</a> &gt; 1)
<a name="l00037"></a>00037     text += <span class="stringliteral">"s"</span>;
<a name="l00038"></a>00038 
<a name="l00039"></a>00039   <span class="keywordflow">if</span> (<a class="code" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f" title="The current number of red pills.">redDrops_</a> != 0 &amp;&amp; <a class="code" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4" title="The current number of blue pills.">blueDrops_</a> != 0)
<a name="l00040"></a>00040     text += <span class="stringliteral">" and "</span>;
<a name="l00041"></a>00041 
<a name="l00042"></a>00042   <span class="keywordflow">if</span> (<a class="code" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4" title="The current number of blue pills.">blueDrops_</a> != 0)
<a name="l00043"></a>00043     text += boost::lexical_cast&lt;std::string&gt;(<a class="code" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4" title="The current number of blue pills.">blueDrops_</a>) + <span class="stringliteral">" blue pill"</span>;
<a name="l00044"></a>00044   <span class="keywordflow">if</span> (<a class="code" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4" title="The current number of blue pills.">blueDrops_</a> &gt; 1)
<a name="l00045"></a>00045     text += <span class="stringliteral">"s"</span>;
<a name="l00046"></a>00046 
<a name="l00047"></a>00047   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html#2f788aa524d51b3962642c9f565e66e6">setText</a>(text);
<a name="l00048"></a>00048 }
</pre></div>
<p>

</div>
</div><p>
<hr><h2>Member Data Documentation</h2>
<a class="anchor" name="ca012a249f706cd301674fff9497b5de"></a><!-- doxytag: member="Character::name_" ref="ca012a249f706cd301674fff9497b5de" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">std::string <a class="el" href="classCharacter.html#ca012a249f706cd301674fff9497b5de">Character::name_</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
The name. 
<p>

<p>Definition at line <a class="el" href="Character_8h-source.html#l00037">37</a> of file <a class="el" href="Character_8h-source.html">Character.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="fc151db0d1cdf304d3ac38d7d222f68f"></a><!-- doxytag: member="Character::redDrops_" ref="fc151db0d1cdf304d3ac38d7d222f68f" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classCharacter.html#fc151db0d1cdf304d3ac38d7d222f68f">Character::redDrops_</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
The current number of red pills. 
<p>

<p>Definition at line <a class="el" href="Character_8h-source.html#l00040">40</a> of file <a class="el" href="Character_8h-source.html">Character.h</a>.</p>

</div>
</div><p>
<a class="anchor" name="edb689bf579518ced1a0f93af0fbfcb4"></a><!-- doxytag: member="Character::blueDrops_" ref="edb689bf579518ced1a0f93af0fbfcb4" args="" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">int <a class="el" href="classCharacter.html#edb689bf579518ced1a0f93af0fbfcb4">Character::blueDrops_</a><code> [private]</code>          </td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
The current number of blue pills. 
<p>

<p>Definition at line <a class="el" href="Character_8h-source.html#l00043">43</a> of file <a class="el" href="Character_8h-source.html">Character.h</a>.</p>

</div>
</div><p>
<hr>The documentation for this class was generated from the following files:<ul>
<li>/home/koen/project/wt/public-git/wt/examples/dragdrop/<a class="el" href="Character_8h-source.html">Character.h</a><li>/home/koen/project/wt/public-git/wt/examples/dragdrop/<a class="el" href="Character_8C-source.html">Character.C</a></ul>
</div>
<hr size="1"><address style="align: right;"><small>
Generated on Fri Mar 26 17:12:12 2010 for <a href="http://www.webtoolkit.eu/wt/">Wt</a> by&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>