.reference

git-svn-id: svn://ultimatepp.org/upp/trunk@8041 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2015-01-14 18:21:19 +00:00
parent 6ed13c0d14
commit 18ed4bf5a5
3 changed files with 61 additions and 0 deletions

View file

@ -0,0 +1,11 @@
description "Example of basic DnD API\377";
uses
CtrlLib;
file
main.cpp;
mainconfig
"" = "GUI SSE2";

View file

@ -0,0 +1,4 @@
#ifndef _DragAndDropImg_icpp_init_stub
#define _DragAndDropImg_icpp_init_stub
#include "CtrlLib/init"
#endif

View file

@ -0,0 +1,46 @@
#include <CtrlLib/CtrlLib.h>
using namespace Upp;
struct MyApp : TopWindow {
virtual void CancelMode();
virtual void Paint(Draw& w);
virtual void DragAndDrop(Point p, PasteClip& d);
virtual void DragLeave();
Image img;
bool dnd;
MyApp() { dnd = false; }
};
void MyApp::Paint(Draw& w)
{
Size sz = GetSize();
w.DrawRect(sz, dnd ? SColorInfo() : SColorFace());
w.DrawImage(0, 0, img);
}
void MyApp::DragAndDrop(Point p, PasteClip& d)
{
if(AcceptImage(d))
img = GetImage(d);
dnd = d.IsAccepted();
Refresh();
}
void MyApp::DragLeave()
{
CancelMode();
}
void MyApp::CancelMode()
{
dnd = false;
Refresh();
}
GUI_APP_MAIN
{
MyApp().Run();
}