Sophie

Sophie

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

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/dragdrop/DragExample.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/dragdrop/DragExample.C</div>  </div>
</div>
<div class="contents">
<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 &quot;<a class="code" href="DragExample_8h.html">DragExample.h</a>&quot;</span>
<a name="l00002"></a>00002 <span class="preprocessor">#include &quot;<a class="code" href="Character_8h.html">Character.h</a>&quot;</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#ga2dce13ff08ea69ed783345ee01669a68">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#ga2dce13ff08ea69ed783345ee01669a68" 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#a556c14d02388720b1d95b2149be2e867">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#ga14e2e7211ec4b667b4ba39d7cfe89dc1">00035</a> <a class="code" href="group__dragexample.html#ga14e2e7211ec4b667b4ba39d7cfe89dc1">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">&quot;&lt;p&gt;Help these people with their decision by dragging one of &quot;</span>
<a name="l00039"></a>00039             <span class="stringliteral">&quot;the pills.&lt;/p&gt;&quot;</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">&quot;&lt;i&gt;This examples requires that javascript support is &quot;</span>
<a name="l00043"></a>00043               <span class="stringliteral">&quot;enabled.&lt;/i&gt;&quot;</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#a520ba6e52a36a7f2efbef1a31a69e898">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#aba13c9e62c74bcba53519ee9cf41f40a">setContentAlignment</a>(<a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/namespaceWt.html#ab8f772c69bc8180c31f9e4f4593b143fa121104cdbb5db77c7d038813a93998e5">AlignCenter</a>);
<a name="l00048"></a>00048 
<a name="l00049"></a>00049   <a class="code" href="group__dragexample.html#ga2dce13ff08ea69ed783345ee01669a68" title="Create an image which can be dragged.">createDragImage</a>(<span class="stringliteral">&quot;icons/blue-pill.jpg&quot;</span>,
<a name="l00050"></a>00050                   <span class="stringliteral">&quot;icons/blue-pill-small.png&quot;</span>,
<a name="l00051"></a>00051                   <span class="stringliteral">&quot;blue-pill&quot;</span>, pills);
<a name="l00052"></a>00052   <a class="code" href="group__dragexample.html#ga2dce13ff08ea69ed783345ee01669a68" title="Create an image which can be dragged.">createDragImage</a>(<span class="stringliteral">&quot;icons/red-pill.jpg&quot;</span>,
<a name="l00053"></a>00053                   <span class="stringliteral">&quot;icons/red-pill-small.png&quot;</span>,
<a name="l00054"></a>00054                   <span class="stringliteral">&quot;red-pill&quot;</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#a520ba6e52a36a7f2efbef1a31a69e898">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">&quot;Neo&quot;</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">&quot;Morpheus&quot;</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">&quot;Trinity&quot;</span>, dropSites);
<a name="l00061"></a>00061 
<a name="l00062"></a>00062 }
<a name="l00063"></a>00063 
</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>