mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
.reference
git-svn-id: svn://ultimatepp.org/upp/trunk@8041 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
6ed13c0d14
commit
18ed4bf5a5
3 changed files with 61 additions and 0 deletions
11
reference/DragAndDropImg/DragAndDropImg.upp
Normal file
11
reference/DragAndDropImg/DragAndDropImg.upp
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
description "Example of basic DnD API\377";
|
||||
|
||||
uses
|
||||
CtrlLib;
|
||||
|
||||
file
|
||||
main.cpp;
|
||||
|
||||
mainconfig
|
||||
"" = "GUI SSE2";
|
||||
|
||||
4
reference/DragAndDropImg/init
Normal file
4
reference/DragAndDropImg/init
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#ifndef _DragAndDropImg_icpp_init_stub
|
||||
#define _DragAndDropImg_icpp_init_stub
|
||||
#include "CtrlLib/init"
|
||||
#endif
|
||||
46
reference/DragAndDropImg/main.cpp
Normal file
46
reference/DragAndDropImg/main.cpp
Normal 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();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue