/usr/lib/Wt/examples/dragdrop/DragExample.C is in witty-examples 3.3.0-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 | #include "DragExample.h"
#include "Character.h"
#include <Wt/WEnvironment>
#include <Wt/WImage>
#include <Wt/WApplication>
using namespace Wt;
/**
* \defgroup dragexample Drag and Drop example
*/
/*@{*/
/*! \brief 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
*/
WImage *createDragImage(const char *url, const char *smallurl,
const char *mimeType,
WContainerWidget *p)
{
WImage *result = new WImage(url, p);
WImage *dragImage = new WImage(smallurl, p);
/*
* Set the image to be draggable, showing the other image (dragImage)
* to be used as the widget that is visually dragged.
*/
result->setDraggable(mimeType, dragImage, true);
return result;
}
DragExample::DragExample(WContainerWidget *parent):
WContainerWidget(parent)
{
new WText("<p>Help these people with their decision by dragging one of "
"the pills.</p>", this);
if (!wApp->environment().javaScript()) {
new WText("<i>This examples requires that javascript support is "
"enabled.</i>", this);
}
WContainerWidget *pills = new WContainerWidget(this);
pills->setContentAlignment(AlignCenter);
createDragImage("icons/blue-pill.jpg",
"icons/blue-pill-small.png",
"blue-pill", pills);
createDragImage("icons/red-pill.jpg",
"icons/red-pill-small.png",
"red-pill", pills);
WContainerWidget *dropSites = new WContainerWidget(this);
new Character("Neo", dropSites);
new Character("Morpheus", dropSites);
new Character("Trinity", dropSites);
}
/*@}*/
|