Drag and Drop example

Classes

class  Character
 A Matrix character that takes red and/or blue pills. More...

Functions

WImagecreateDragImage (const char *url, const char *smallurl, const char *mimeType, WContainerWidget *p)
 Create an image which can be dragged.
 DragExample::DragExample (Wt::WContainerWidget *parent)

Function Documentation

WImage* createDragImage ( const char *  url,
const char *  smallurl,
const char *  mimeType,
WContainerWidget p 
)

Create an image which can be dragged.

The image to be displayed when dragging is given by smallurl, and configured with the given mime type

Definition at line 19 of file DragExample.C.

00022 {
00023   WImage *result = new WImage(url, p);
00024   WImage *dragImage = new WImage(smallurl, p);
00025 
00026   /*
00027    * Set the image to be draggable, showing the other image (dragImage)
00028    * to be used as the widget that is visually dragged.
00029    */
00030   result->setDraggable(mimeType, dragImage, true);
00031 
00032   return result;
00033 }

DragExample::DragExample ( Wt::WContainerWidget parent  )  [inherited]

Definition at line 35 of file DragExample.C.

00036                                                 :
00037   WContainerWidget(parent)
00038 {
00039   new WText("<p>Help these people with their decision by dragging one of "
00040             "the pills.</p>", this);
00041 
00042   if (!wApp->environment().javaScript()) {
00043     new WText("<i>This examples requires that javascript support is "
00044               "enabled.</i>", this);
00045   }
00046 
00047   WContainerWidget *pills = new WContainerWidget(this);
00048   pills->setContentAlignment(AlignCenter);
00049 
00050   createDragImage("icons/blue-pill.jpg",
00051                   "icons/blue-pill-small.png",
00052                   "blue-pill", pills);
00053   createDragImage("icons/red-pill.jpg",
00054                   "icons/red-pill-small.png",
00055                   "red-pill", pills);
00056 
00057   WContainerWidget *dropSites = new WContainerWidget(this);
00058 
00059   new Character("Neo", dropSites);
00060   new Character("Morpheus", dropSites);
00061   new Character("Trinity", dropSites);
00062 
}


Generated on Thu May 13 05:16:00 2010 for Wt by doxygen 1.6.3