diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2010-09-15 00:07:15 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-09-23 16:24:41 +0200 |
commit | 65ecd294231994dbb3633d0a058ce03cf58ad2bd (patch) | |
tree | de521316a3f46acb8f1150789ffe1135f8ff3050 | |
parent | 47c31a5fbc871309e925f8351238d988e9d14f74 (diff) | |
download | fpGUI-65ecd294231994dbb3633d0a058ce03cf58ad2bd.tar.xz |
Adds OnDragExit event to TfpgWidget.
-rw-r--r-- | src/corelib/fpg_widget.pas | 2 | ||||
-rw-r--r-- | src/corelib/x11/fpg_x11.pas | 25 |
2 files changed, 25 insertions, 2 deletions
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index 3799f950..262c9717 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -44,6 +44,7 @@ type FOnClick: TNotifyEvent; FOnDoubleClick: TMouseButtonEvent; FOnDragEnter: TfpgDragEnterEvent; + FOnDragLeave: TNotifyEvent; FOnEnter: TNotifyEvent; FOnExit: TNotifyEvent; FOnMouseDown: TMouseButtonEvent; @@ -175,6 +176,7 @@ type property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground; property TextColor: TfpgColor read FTextColor write SetTextColor default clText1; property OnDragEnter: TfpgDragEnterEvent read FOnDragEnter write FOnDragEnter; + property OnDragLeave: TNotifyEvent read FOnDragLeave write FOnDragLeave; end; diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index 0b8a5495..dbae54ef 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -887,10 +887,21 @@ end; procedure TfpgX11Application.HandleDNDleave(ATopLevelWindow: TfpgX11Window; const ASource: TWindow); +var + wg: TfpgWidget; begin {$IFDEF DNDDEBUG} writeln('XdndLeave event received!'); {$ENDIF} + if FLastDropTarget <> 0 then { 0 would be first time in, so there is no last window } + begin + wg := FindWindowByHandle(FLastDropTarget) as TfpgWidget; + if wg.AcceptDrops then + begin + if Assigned(wg.OnDragLeave) then + wg.OnDragLeave(nil); + end; + end; ResetDNDVariables; end; @@ -905,6 +916,7 @@ var lTargetWinHandle: TWindow; w: TfpgX11Window; wg: TfpgWidget; + wg2: TfpgWidget; msgp: TfpgMessageParams; lDragEnterEvent: TfpgDragEnterEvent; lDropAction: TfpgDropAction; @@ -952,8 +964,17 @@ begin wg := TfpgWidget(w); if FLastDropTarget <> lTargetWinHandle then begin - fillchar(msgp, sizeof(msgp), 0); - fpgPostMessage(nil, FindWindowByHandle(FLastDropTarget), FPGM_DROPEXIT, msgp); + if FLastDropTarget <> 0 then { 0 would be first time in, so there is no last window } + begin + wg2 := FindWindowByHandle(FLastDropTarget) as TfpgWidget; + if wg2.AcceptDrops then + begin + if Assigned(wg2.OnDragLeave) then + wg2.OnDragLeave(nil); + end; + fillchar(msgp, sizeof(msgp), 0); + fpgPostMessage(nil, wg2, FPGM_DROPEXIT, msgp); + end; end; FLastDropTarget := lTargetWinHandle; if wg.AcceptDrops then |