Bug #1310 ยป bug1310.diff
| examples/treeview-dragdrop/FolderView.C | ||
|---|---|---|
|
= "application/x-computers-selection";
|
||
|
FolderView::FolderView(Wt::WContainerWidget *parent)
|
||
|
: WTreeView(parent)
|
||
|
: WTableView(parent)
|
||
|
{
|
||
|
/*
|
||
|
* Accept drops for the custom mime type.
|
||
| examples/treeview-dragdrop/FolderView.h | ||
|---|---|---|
|
#ifndef FOLDER_VIEW_H_
|
||
|
#define FOLDER_VIEW_H_
|
||
|
#include <Wt/WTreeView>
|
||
|
#include <Wt/WTableView>
|
||
|
/**
|
||
|
* \addtogroup treeviewdragdrop
|
||
| ... | ... | |
|
/*! \brief A specialized treeview that supports a custom drop event.
|
||
|
*/
|
||
|
class FolderView : public Wt::WTreeView
|
||
|
class FolderView : public Wt::WTableView
|
||
|
{
|
||
|
public:
|
||
|
/*! \brief Constant that indicates the mime type for a selection of files.
|
||
| examples/treeview-dragdrop/TreeViewDragDrop.C | ||
|---|---|---|
|
std::map<std::string, WString> folderNameMap_;
|
||
|
/// The folder view.
|
||
|
WTreeView *folderView_;
|
||
|
WTableView *folderView_;
|
||
|
/// The file view.
|
||
|
WTableView *fileView_;
|
||
| ... | ... | |
|
/*! \brief Creates the folder WTreeView
|
||
|
*/
|
||
|
WTreeView *folderView() {
|
||
|
WTreeView *treeView = new FolderView();
|
||
|
WTableView *folderView() {
|
||
|
WTableView *treeView = new FolderView();
|
||
|
/*
|
||
|
* To support right-click, we need to disable the built-in browser
|
||
| ... | ... | |
|
treeView->setModel(folderModel_);
|
||
|
treeView->resize(200, WLength::Auto);
|
||
|
treeView->setSelectionMode(SingleSelection);
|
||
|
treeView->expandToDepth(1);
|
||
|
//treeView->expandToDepth(1);
|
||
|
treeView->selectionChanged()
|
||
|
.connect(this, &TreeViewDragDrop::folderChanged);
|
||
| ... | ... | |
|
result->setIcon("icons/folder.gif");
|
||
|
result->setFlags(result->flags() | ItemIsDropEnabled);
|
||
|
return result;
|
||
|
}
|
||