File: group__dragexample.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 (149 lines) | stat: -rw-r--r-- 11,339 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
<!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: Drag and Drop example</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><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
</div>
<div class="contents">
<h1>Drag and Drop example</h1><table border="0" cellpadding="0" cellspacing="0">
<tr><td></td></tr>
<tr><td colspan="2"><br><h2>Classes</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">class &nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="classCharacter.html">Character</a></td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">A Matrix character that takes red and/or blue pills.  <a href="classCharacter.html#_details">More...</a><br></td></tr>
<tr><td colspan="2"><br><h2>Functions</h2></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WImage.html">WImage</a> *&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__dragexample.html#g2dce13ff08ea69ed783345ee01669a68">createDragImage</a> (const char *url, const char *smallurl, const char *mimeType, <a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *p)</td></tr>

<tr><td class="mdescLeft">&nbsp;</td><td class="mdescRight">Create an image which can be dragged.  <a href="#g2dce13ff08ea69ed783345ee01669a68"></a><br></td></tr>
<tr><td class="memItemLeft" nowrap align="right" valign="top">&nbsp;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__dragexample.html#g14e2e7211ec4b667b4ba39d7cfe89dc1">DragExample::DragExample</a> (<a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">Wt::WContainerWidget</a> *parent)</td></tr>

</table>
<hr><h2>Function Documentation</h2>
<a class="anchor" name="g2dce13ff08ea69ed783345ee01669a68"></a><!-- doxytag: member="DragExample.C::createDragImage" ref="g2dce13ff08ea69ed783345ee01669a68" args="(const char *url, const char *smallurl, const char *mimeType, WContainerWidget *p)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WImage.html">WImage</a>* createDragImage           </td>
          <td>(</td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>url</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>smallurl</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">const char *&nbsp;</td>
          <td class="paramname"> <em>mimeType</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>p</em></td><td>&nbsp;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td><td></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>
Create an image which can be dragged. 
<p>
The image to be displayed when dragging is given by smallurl, and configured with the given mime type 
<p>Definition at line <a class="el" href="DragExample_8C-source.html#l00019">19</a> of file <a class="el" href="DragExample_8C-source.html">DragExample.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00022"></a>00022 {
<a name="l00023"></a>00023   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WImage.html">WImage</a> *result = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WImage.html">WImage</a>(url, p);
<a name="l00024"></a>00024   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WImage.html">WImage</a> *dragImage = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WImage.html">WImage</a>(smallurl, p);
<a name="l00025"></a>00025 
<a name="l00026"></a>00026   <span class="comment">/*</span>
<a name="l00027"></a>00027 <span class="comment">   * Set the image to be draggable, showing the other image (dragImage)</span>
<a name="l00028"></a>00028 <span class="comment">   * to be used as the widget that is visually dragged.</span>
<a name="l00029"></a>00029 <span class="comment">   */</span>
<a name="l00030"></a>00030   result-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WInteractWidget.html#556c14d02388720b1d95b2149be2e867">setDraggable</a>(mimeType, dragImage, <span class="keyword">true</span>);
<a name="l00031"></a>00031 
<a name="l00032"></a>00032   <span class="keywordflow">return</span> result;
<a name="l00033"></a>00033 }
</pre></div>
<p>

</div>
</div><p>
<a class="anchor" name="g14e2e7211ec4b667b4ba39d7cfe89dc1"></a><!-- doxytag: member="DragExample::DragExample" ref="g14e2e7211ec4b667b4ba39d7cfe89dc1" args="(Wt::WContainerWidget *parent)" -->
<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">DragExample::DragExample           </td>
          <td>(</td>
          <td class="paramtype"><a class="elRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">Wt::WContainerWidget</a> *&nbsp;</td>
          <td class="paramname"> <em>parent</em>          </td>
          <td>&nbsp;)&nbsp;</td>
          <td><code> [inherited]</code></td>
        </tr>
      </table>
</div>
<div class="memdoc">

<p>

<p>Definition at line <a class="el" href="DragExample_8C-source.html#l00035">35</a> of file <a class="el" href="DragExample_8C-source.html">DragExample.C</a>.</p>
<div class="fragment"><pre class="fragment"><a name="l00035"></a>00035                                                 :
<a name="l00036"></a>00036   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(parent)
<a name="l00037"></a>00037 {
<a name="l00038"></a>00038   <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a>(<span class="stringliteral">"&lt;p&gt;Help these people with their decision by dragging one of "</span>
<a name="l00039"></a>00039             <span class="stringliteral">"the pills.&lt;/p&gt;"</span>, <span class="keyword">this</span>);
<a name="l00040"></a>00040 
<a name="l00041"></a>00041   <span class="keywordflow">if</span> (!wApp-&gt;environment().javaScript()) {
<a name="l00042"></a>00042     <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WText.html">WText</a>(<span class="stringliteral">"&lt;i&gt;This examples requires that javascript support is "</span>
<a name="l00043"></a>00043               <span class="stringliteral">"enabled.&lt;/i&gt;"</span>, <span class="keyword">this</span>);
<a name="l00044"></a>00044   }
<a name="l00045"></a>00045 
<a name="l00046"></a>00046   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *pills = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(<span class="keyword">this</span>);
<a name="l00047"></a>00047   pills-&gt;<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#ba13c9e62c74bcba53519ee9cf41f40a">setContentAlignment</a>(AlignCenter);
<a name="l00048"></a>00048 
<a name="l00049"></a>00049   <a class="code" href="group__dragexample.html#g2dce13ff08ea69ed783345ee01669a68" title="Create an image which can be dragged.">createDragImage</a>(<span class="stringliteral">"icons/blue-pill.jpg"</span>,
<a name="l00050"></a>00050                   <span class="stringliteral">"icons/blue-pill-small.png"</span>,
<a name="l00051"></a>00051                   <span class="stringliteral">"blue-pill"</span>, pills);
<a name="l00052"></a>00052   <a class="code" href="group__dragexample.html#g2dce13ff08ea69ed783345ee01669a68" title="Create an image which can be dragged.">createDragImage</a>(<span class="stringliteral">"icons/red-pill.jpg"</span>,
<a name="l00053"></a>00053                   <span class="stringliteral">"icons/red-pill-small.png"</span>,
<a name="l00054"></a>00054                   <span class="stringliteral">"red-pill"</span>, pills);
<a name="l00055"></a>00055 
<a name="l00056"></a>00056   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *dropSites = <span class="keyword">new</span> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html#520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(<span class="keyword">this</span>);
<a name="l00057"></a>00057 
<a name="l00058"></a>00058   <span class="keyword">new</span> <a class="code" href="classCharacter.html" title="A Matrix character that takes red and/or blue pills.">Character</a>(<span class="stringliteral">"Neo"</span>, dropSites);
<a name="l00059"></a>00059   <span class="keyword">new</span> <a class="code" href="classCharacter.html" title="A Matrix character that takes red and/or blue pills.">Character</a>(<span class="stringliteral">"Morpheus"</span>, dropSites);
<a name="l00060"></a>00060   <span class="keyword">new</span> <a class="code" href="classCharacter.html" title="A Matrix character that takes red and/or blue pills.">Character</a>(<span class="stringliteral">"Trinity"</span>, dropSites);
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 }

</pre></div>
<p>

</div>
</div><p>
</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>