reference: DropFiles

git-svn-id: svn://ultimatepp.org/upp/trunk@7428 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2014-06-08 18:06:58 +00:00
parent 7d67270fb0
commit d5ed2ccd73
4 changed files with 16 additions and 30 deletions

View file

@ -6,6 +6,8 @@ struct DndTest : public TopWindow {
virtual void Paint(Draw &w);
virtual void DragAndDrop(Point p, PasteClip& d);
virtual bool Key(dword key, int count);
virtual void LeftDrag(Point p, dword keyflags);
Vector<String> files;
DndTest();
@ -23,7 +25,9 @@ void DndTest::Paint(Draw &w)
void DndTest::DragAndDrop(Point p, PasteClip& d)
{
if (AcceptFiles(d)) {
if(IsDragAndDropSource())
return;
if(AcceptFiles(d)) {
files = GetFiles(d);
Refresh();
}
@ -39,6 +43,15 @@ bool DndTest::Key(dword key, int count)
return false;
}
void DndTest::LeftDrag(Point p, dword keyflags)
{
if(files.GetCount()) {
VectorMap<String, ClipData> data;
AppendFiles(data, files);
DoDragAndDrop(data, Null, DND_COPY);
}
}
DndTest::DndTest()
{
Title("I need files!");