<!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: Drag and Drop example</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  <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 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="header"> <div class="summary"> <a href="#nested-classes">Classes</a> | <a href="#func-members">Functions</a> </div> <div class="headertitle"> <div class="title">Drag and Drop example</div> </div> </div> <div class="contents"> <table class="memberdecls"> <tr><td colspan="2"><h2><a name="nested-classes"></a> Classes</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top">class  </td><td class="memItemRight" valign="bottom"><a class="el" href="classCharacter.html">Character</a></td></tr> <tr><td class="mdescLeft"> </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"><h2><a name="func-members"></a> Functions</h2></td></tr> <tr><td class="memItemLeft" align="right" valign="top"><a class="elRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WImage.html">WImage</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="group__dragexample.html#ga2dce13ff08ea69ed783345ee01669a68">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"> </td><td class="mdescRight">Create an image which can be dragged. <a href="#ga2dce13ff08ea69ed783345ee01669a68"></a><br/></td></tr> <tr><td class="memItemLeft" align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="group__dragexample.html#ga14e2e7211ec4b667b4ba39d7cfe89dc1">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" id="ga2dce13ff08ea69ed783345ee01669a68"></a><!-- doxytag: member="DragExample.C::createDragImage" ref="ga2dce13ff08ea69ed783345ee01669a68" 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 * </td> <td class="paramname"><em>url</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </td> <td class="paramname"><em>smallurl</em>, </td> </tr> <tr> <td class="paramkey"></td> <td></td> <td class="paramtype">const char * </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> * </td> <td class="paramname"><em>p</em> </td> </tr> <tr> <td></td> <td>)</td> <td></td><td></td> </tr> </table> </div> <div class="memdoc"> <p>Create an image which can be dragged. </p> <p>The image to be displayed when dragging is given by smallurl, and configured with the given mime type </p> <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 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 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); <span class="comment">/*</span> <span class="comment"> * Set the image to be draggable, showing the other image (dragImage)</span> <span class="comment"> * to be used as the widget that is visually dragged.</span> <span class="comment"> */</span> result-><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>); <span class="keywordflow">return</span> result; } </pre></div> </div> </div> <a class="anchor" id="ga14e2e7211ec4b667b4ba39d7cfe89dc1"></a><!-- doxytag: member="DragExample::DragExample" ref="ga14e2e7211ec4b667b4ba39d7cfe89dc1" 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> * </td> <td class="paramname"><em>parent</em></td><td>)</td> <td></td> </tr> </table> </div> <div class="memdoc"> <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 class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#a520ba6e52a36a7f2efbef1a31a69e898">WContainerWidget</a>(parent) { <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">"<p>Help these people with their decision by dragging one of "</span> <span class="stringliteral">"the pills.</p>"</span>, <span class="keyword">this</span>); <span class="keywordflow">if</span> (!wApp->environment().javaScript()) { <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">"<i>This examples requires that javascript support is "</span> <span class="stringliteral">"enabled.</i>"</span>, <span class="keyword">this</span>); } <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>); pills-><a class="codeRef" doxygen="wt.tags:../../reference/html" href="../../reference/html/classWt_1_1WContainerWidget.html#aba13c9e62c74bcba53519ee9cf41f40a">setContentAlignment</a>(AlignCenter); <a class="code" href="group__dragexample.html#ga2dce13ff08ea69ed783345ee01669a68" title="Create an image which can be dragged.">createDragImage</a>(<span class="stringliteral">"icons/blue-pill.jpg"</span>, <span class="stringliteral">"icons/blue-pill-small.png"</span>, <span class="stringliteral">"blue-pill"</span>, pills); <a class="code" href="group__dragexample.html#ga2dce13ff08ea69ed783345ee01669a68" title="Create an image which can be dragged.">createDragImage</a>(<span class="stringliteral">"icons/red-pill.jpg"</span>, <span class="stringliteral">"icons/red-pill-small.png"</span>, <span class="stringliteral">"red-pill"</span>, pills); <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>); <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); <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); <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); } </pre></div> </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 <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>