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.

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


Generated on Tue Sep 1 17:51:23 2009 for Wt by doxygen 1.5.6