Commit ae1e73ec authored by Martin Schreiber's avatar Martin Schreiber

+ dragobjectstatety dos_dropped.

+ Drag end events.
parent 74971ae8
......@@ -27,6 +27,9 @@ type
dragovereventty = procedure(const asender: tobject; const apos: pointty;
var adragobject: tdragobject; var accept: boolean;
var processed: boolean) of object;
dragendeventty = procedure(const asender: tobject; const apos: pointty;
var adragobject: tdragobject; const accepted: boolean;
var processed: boolean) of object;
ttagdragobject = class(tdragobject)
private
......@@ -67,6 +70,7 @@ type
dragbegin: drageventty;
dragover: dragovereventty;
dragdrop: drageventty;
dragend: dragendeventty;
end;
sysdndinfoty = record
......@@ -137,12 +141,16 @@ type
write fonbefore.dragover;
property onbeforedragdrop: drageventty read fonbefore.dragdrop
write fonbefore.dragdrop;
property onbeforedragend: dragendeventty read fonbefore.dragend
write fonbefore.dragend;
property onafterdragbegin: drageventty read fonafter.dragbegin
write fonafter.dragbegin;
property onafterdragover: dragovereventty read fonafter.dragover
write fonafter.dragover;
property onafterdragdrop: drageventty read fonafter.dragdrop
write fonafter.dragdrop;
property onafterdragend: dragendeventty read fonafter.dragend
write fonafter.dragend;
property options;
end;
......@@ -201,9 +209,21 @@ end;
procedure tcustomdragcontroller.enddrag;
var
int1,int2: integer;
draginfo: draginfoty;
owner: twidget;
po1: pointty;
begin
// checksysdnd(sdnda_finished,nullrect);
if fdragobject <> nil then begin
owner:= fintf.getwidget();
if dos_dropped in fdragobject.state then begin
po1:= translateclientpoint(fdragobject.droppos,nil,owner);
end
else begin
po1:= fdragobject.pickpos;
end;
initdraginfo(draginfo,dek_end,po1);
owner.dragevent(draginfo);
if dos_sysdroppending in tdragobject1(fdragobject).fstate then begin
int2:= 0;
for int1:= 0 to high(fsysdndobjects) do begin
......@@ -305,6 +325,9 @@ begin
info.clientpickpos:= fpickpos;
info.pickpos:= translateclientpoint(fpickpos,fintf.getwidget,nil);
info.dragobjectpo:= @fdragobject;
if (eventkind = dek_drop) and (fdragobject <> nil) then begin
include(tdragobject1(fdragobject).fstate,dos_dropped);
end;
end;
function tcustomdragcontroller.checkclickstate(
......@@ -509,6 +532,12 @@ begin
dragdrop(fintf.getwidget,pos,dragobjectpo^,result);
end;
end;
dek_end: begin
if assigned(dragend) then begin
dragend(fintf.getwidget,pos,dragobjectpo^,(dragobjectpo^ <> nil) and
(dos_dropped in dragobjectpo^.state),result);
end;
end;
end;
end;
end;
......
......@@ -14,7 +14,7 @@ uses
mseglob,msegraphutils,mseguiglob,mseevent;
type
dragobjstatety = (dos_sysdnd,dos_write,dos_sysdroppending);
dragobjstatety = (dos_dropped,dos_sysdnd,dos_write,dos_sysdroppending);
dragobjstatesty = set of dragobjstatety;
pdragobject = ^tdragobject;
......@@ -22,6 +22,7 @@ type
private
fpickpos: pointty;
fdroppos: pointty;
function getdropped: boolean;
protected
finstancepo: pdragobject;
fsender: tobject;
......@@ -35,20 +36,21 @@ type
function geteventintf: ievent;
public
constructor create(const asender: tobject; var instance: tdragobject;
const apickpos: pointty;
const apickpos: pointty; //clientorigin
const aactions: dndactionsty = []);
destructor destroy; override;
function sender: tobject;
procedure acepted(const apos: pointty); virtual; //screenorigin
procedure refused(const apos: pointty); virtual; //screenorigin
property pickpos: pointty read fpickpos write fpickpos; //screenorigin
property pickpos: pointty read fpickpos write fpickpos; //clientorigin
property droppos: pointty read fdroppos write fdroppos; //screenorigin
property state: dragobjstatesty read fstate;
property dropped: boolean read getdropped;
property actions: dndactionsty read factions write factions;
end;
drageventkindty = (dek_begin,dek_check,dek_drop,dek_leavesysdnd,
dek_leavewidget);
drageventkindty = (dek_begin,dek_check,dek_drop,dek_end,
dek_leavesysdnd,dek_leavewidget);
draginfoty = record
eventkind: drageventkindty;
......@@ -92,6 +94,11 @@ begin
inherited;
end;
function tdragobject.getdropped: boolean;
begin
result:= dos_dropped in fstate;
end;
procedure tdragobject.acepted(const apos: pointty);
begin
//dummy
......
{ MSEgui Copyright (c) 1999-2017 by Martin Schreiber
{ MSEgui Copyright (c) 1999-2018 by Martin Schreiber
See the file COPYING.MSE, included in this distribution,
for details about the copyright.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment