summaryrefslogtreecommitdiff
path: root/src/corelib
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2010-10-18 17:12:11 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2010-10-28 10:57:21 +0200
commitc50176a7efdf0545eddaf0b9d55fca1bf357e896 (patch)
tree1846034b9fdabf00fe5b48a5143cbde63fb35cee /src/corelib
parentf436c95222de7300653a43875c481dd30e05e7ee (diff)
downloadfpGUI-c50176a7efdf0545eddaf0b9d55fca1bf357e896.tar.xz
GDI: Added OLE DND into TfpgGDIWindow.
AcceptDrops: is implemented and can be toggled at runtime or designtime. Windows cursor also changes to show that target windows can accept drops.
Diffstat (limited to 'src/corelib')
-rw-r--r--src/corelib/gdi/fpg_gdi.pas35
-rw-r--r--src/corelib/gdi/fpgui_toolkit.lpk9
-rw-r--r--src/corelib/gdi/fpgui_toolkit.pas4
3 files changed, 25 insertions, 23 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas
index e7c3db3c..356c7cb1 100644
--- a/src/corelib/gdi/fpg_gdi.pas
+++ b/src/corelib/gdi/fpg_gdi.pas
@@ -37,6 +37,7 @@ uses
{$IFDEF DEBUG}
,dbugintf
{$ENDIF DEBUG}
+ ,fpg_OLEDragDrop
;
{ Constants missing on windows unit }
@@ -145,8 +146,8 @@ type
TfpgGDIWindow = class(TfpgWindowBase)
private
- FDragManager: TGDIDragManager;
- function GetDragManager: TGDIDragManager;
+ FDropManager: TfpgOLEDropTarget;
+ function GetDropManager: TfpgOLEDropTarget;
private
FMouseInWindow: boolean;
FNonFullscreenRect: TfpgRect;
@@ -156,7 +157,7 @@ type
QueueAcceptDrops: boolean;
function DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean;
procedure WindowSetFullscreen(aFullScreen, aUpdate: boolean);
- property DragManager: TGDIDragManager read GetDragManager;
+ property DropManager: TfpgOLEDropTarget read GetDropManager;
protected
FWinHandle: TfpgWinHandle;
FModalForWin: TfpgGDIWindow;
@@ -260,17 +261,15 @@ type
end;
- { TGDIDragManager }
-
TGDIDragManager = class(TInterfacedObject, IDropTarget)
private
FDropTarget: TObject; { actually a TfpgWidget }
FRegistered: boolean;
{ IDropTarget }
- function DragEnter(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HResult;StdCall;
- function DragOver(grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HResult;StdCall;
- function DragLeave: HResult;StdCall;
- function Drop(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD):HResult;StdCall;
+ function DragEnter(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HResult;StdCall;
+ function DragOver(grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD): HResult;StdCall;
+ function DragLeave: HResult;StdCall;
+ function Drop(const dataObj: IDataObject; grfKeyState: DWORD; pt: TPoint; var dwEffect: DWORD):HResult;StdCall;
public
constructor Create(ADropTarget: TObject); reintroduce;
destructor Destroy; override;
@@ -1313,11 +1312,11 @@ var
// this are required for Windows MouseEnter & MouseExit detection.
uLastWindowHndl: TfpgWinHandle;
-function TfpgGDIWindow.GetDragManager: TGDIDragManager;
+function TfpgGDIWindow.GetDropManager: TfpgOLEDropTarget;
begin
- if not Assigned(FDragManager) then
- FDragManager := TGDIDragManager.Create(self);
- Result := FDragManager;
+ if not Assigned(FDropManager) then
+ FDropManager := TfpgOLEDropTarget.Create(self);
+ Result := FDropManager;
end;
function TfpgGDIWindow.DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean;
@@ -1720,14 +1719,14 @@ begin
if AValue then
begin
if HasHandle then
- DragManager.RegisterDragDrop
+ DropManager.RegisterDragDrop
else
QueueAcceptDrops := True; // we need to do this once we have a winhandle
end
else
begin
if HasHandle then
- DragManager.RevokeDragDrop;
+ DropManager.RevokeDragDrop;
QueueAcceptDrops := False;
end;
end;
@@ -1736,14 +1735,14 @@ constructor TfpgGDIWindow.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FWinHandle := 0;
+ FDropManager := nil;
FFullscreenIsSet := false;
end;
destructor TfpgGDIWindow.Destroy;
begin
- if (self as TfpgWidget).AcceptDrops and Assigned(FDragManager) then
- FDragManager.RevokeDragDrop;
- FDragManager := nil; { frees drag manager instance }
+ if (self as TfpgWidget).AcceptDrops and Assigned(FDropManager) then
+ FDropManager.Free;
inherited Destroy;
end;
diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk
index 11731043..2f606e9f 100644
--- a/src/corelib/gdi/fpgui_toolkit.lpk
+++ b/src/corelib/gdi/fpgui_toolkit.lpk
@@ -5,7 +5,7 @@
<Name Value="fpgui_toolkit"/>
<Author Value="Graeme Geldenhuys"/>
<CompilerOptions>
- <Version Value="8"/>
+ <Version Value="9"/>
<PathDelim Value="\"/>
<SearchPaths>
<IncludeFiles Value="..\..\"/>
@@ -16,7 +16,6 @@
<SyntaxOptions>
<AllowLabel Value="False"/>
<CPPInline Value="False"/>
- <UseAnsiStrings Value="True"/>
</SyntaxOptions>
</Parsing>
<CodeGeneration>
@@ -31,7 +30,7 @@
<Description Value="fpGUI Toolkit"/>
<License Value="LGPL 2 with static linking exception."/>
<Version Minor="7"/>
- <Files Count="80">
+ <Files Count="81">
<Item1>
<Filename Value="..\stdimages.inc"/>
<Type Value="Include"/>
@@ -352,6 +351,10 @@
<Filename Value="..\..\VERSION_FILE.inc"/>
<Type Value="Include"/>
</Item80>
+ <Item81>
+ <Filename Value="fpg_oledragdrop.pas"/>
+ <UnitName Value="fpg_OLEDragDrop"/>
+ </Item81>
</Files>
<LazDoc Paths="..\..\..\docs\xml\corelib\;..\..\..\docs\xml\corelib\x11\;..\..\..\docs\xml\corelib\gdi\;..\..\..\docs\xml\gui\"/>
<RequiredPkgs Count="1">
diff --git a/src/corelib/gdi/fpgui_toolkit.pas b/src/corelib/gdi/fpgui_toolkit.pas
index 2e3e81b6..adc1c74d 100644
--- a/src/corelib/gdi/fpgui_toolkit.pas
+++ b/src/corelib/gdi/fpgui_toolkit.pas
@@ -1,4 +1,4 @@
-{ This file was automatically created by Lazarus. do not edit!
+{ This file was automatically created by Lazarus. Do not edit!
This source is only used to compile and install the package.
}
@@ -18,7 +18,7 @@ uses
fpg_radiobutton, fpg_scrollbar, fpg_style, fpg_tab, fpg_trackbar, fpg_tree,
fpgui_db, fpg_gdi, fpg_impl, fpg_splitter, fpg_hint, fpg_spinedit,
fpg_extgraphics, fpg_ColorMapping, fpg_ColorWheel, fpg_interface,
- fpg_editbtn, fpg_imgfmt_jpg, fpg_imgutils;
+ fpg_editbtn, fpg_imgfmt_jpg, fpg_imgutils, fpg_OLEDragDrop;
implementation