File: DragExample_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 (75 lines) | stat: -rw-r--r-- 8,995 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
<!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/dragdrop/DragExample.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/dragdrop/DragExample.C</h1><a href="DragExample_8C.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#include "<a class="code" href="DragExample_8h.html">DragExample.h</a>"</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include "<a class="code" href="Character_8h.html">Character.h</a>"</span>
<a name="l00003"></a>00003 <span class="preprocessor">#include &lt;Wt/WEnvironment&gt;</span>
<a name="l00004"></a>00004 <span class="preprocessor">#include &lt;Wt/WImage&gt;</span>
<a name="l00005"></a>00005 <span class="preprocessor">#include &lt;Wt/WApplication&gt;</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="keyword">using namespace </span>Wt;
<a name="l00008"></a>00008 
<a name="l00013"></a>00013 
<a name="l00019"></a><a class="code" href="group__dragexample.html#g2dce13ff08ea69ed783345ee01669a68">00019</a> <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WImage.html">WImage</a> *<a class="code" href="group__dragexample.html#g2dce13ff08ea69ed783345ee01669a68" title="Create an image which can be dragged.">createDragImage</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *url, <span class="keyword">const</span> <span class="keywordtype">char</span> *smallurl,
<a name="l00020"></a>00020                         <span class="keyword">const</span> <span class="keywordtype">char</span> *mimeType,
<a name="l00021"></a>00021                         <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *p)
<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 }
<a name="l00034"></a>00034 
<a name="l00035"></a><a class="code" href="group__dragexample.html#g14e2e7211ec4b667b4ba39d7cfe89dc1">00035</a> <a class="code" href="group__dragexample.html#g14e2e7211ec4b667b4ba39d7cfe89dc1">DragExample::DragExample</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">WContainerWidget</a> *parent):
<a name="l00036"></a>00036   <a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/classWt_1_1WContainerWidget.html">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>(<a class="codeRef" doxygen="wt.tags:../../reference/html/" href="../../reference/html/namespaceWt.html#b8f772c69bc8180c31f9e4f4593b143f121104cdbb5db77c7d038813a93998e5">AlignCenter</a>);
<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 }
<a name="l00063"></a>00063 
</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>