Wt examples 4.5.0
Public Member Functions | List of all members
DragExample Class Reference

Class demonstrating drag and drop in Wt. More...

#include <DragExample.h>

Inheritance diagram for DragExample:
Inheritance graph
[legend]

Public Member Functions

 DragExample ()
 

Detailed Description

Class demonstrating drag and drop in Wt.

Definition at line 15 of file DragExample.h.

Constructor & Destructor Documentation

◆ DragExample()

DragExample::DragExample ( )

Definition at line 34 of file DragExample.C.

34 :
35 WContainerWidget()
36{
37 this->addWidget(std::make_unique<WText>("<p>Help these people with their decision by dragging one of "
38 "the pills.</p>"));
39
40 if (!wApp->environment().javaScript()) {
41 this->addWidget(std::make_unique<WText>("<i>This examples requires that javascript support is "
42 "enabled.</i>"));
43 }
44
45 WContainerWidget *pills = this->addWidget(std::make_unique<WContainerWidget>());
46 pills->setContentAlignment(AlignmentFlag::Center);
47
48 createDragImage("icons/blue-pill.jpg",
49 "icons/blue-pill-small.png",
50 "blue-pill", pills);
51 createDragImage("icons/red-pill.jpg",
52 "icons/red-pill-small.png",
53 "red-pill", pills);
54
55 WContainerWidget *dropSites = this->addWidget(std::make_unique<WContainerWidget>());
56
57 dropSites->addWidget(std::make_unique<Character>("Neo"));
58 dropSites->addWidget(std::make_unique<Character>("Morpheus"));
59 dropSites->addWidget(std::make_unique<Character>("Trinity"));
60
61}
WImage * createDragImage(const char *url, const char *smallurl, const char *mimeType, WContainerWidget *p)
Create an image which can be dragged.
Definition: DragExample.C:17

The documentation for this class was generated from the following files:

Generated on Fri Aug 27 2021 for the C++ Web Toolkit (Wt) by doxygen 1.9.2