diff options
author | Graeme Geldenhuys <graemeg@gmail.com> | 2015-04-12 00:47:32 +0100 |
---|---|---|
committer | Graeme Geldenhuys <graemeg@gmail.com> | 2015-04-12 00:47:32 +0100 |
commit | 99ec9891ba45ca0c0439765a8043c934761f2c52 (patch) | |
tree | b68922d99eddb957efd2ac65ba07c851a719a930 | |
parent | 5de8dcdc6605fa60b4c9f103e5dd6bba112a4bd2 (diff) | |
download | fpGUI-99ec9891ba45ca0c0439765a8043c934761f2c52.tar.xz |
Win: DND support is now toggled by a feature compile define, not platform define
Old behaviour was to disable DND when WINCE is active. The HAS_DND
compiler define now does this. HAS_DND is enabled by default for Windows,
and disabled for WinCE platforms.
-rw-r--r-- | src/corelib/gdi/fpg_gdi.pas | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index eb051fa7..e909782e 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -30,6 +30,14 @@ unit fpg_gdi; {.$Define DND_DEBUG} {.$Define DEBUGKEYS} +// enable or disable DND support. Disabled by default while implementing AlienWindows. +{$define HAS_DND} + +{$IFDEF WINCE} + // WinCE doesn't have DND support + {$undefine HAS_DND} +{$ENDIF} + interface uses @@ -42,7 +50,7 @@ uses {$IFDEF DEBUG} ,fpg_dbugintf {$ENDIF DEBUG} - {$IFNDEF wince} + {$IFDEF HAS_DND} ,fpg_OLEDragDrop {$ENDIF} ; @@ -155,13 +163,13 @@ type TfpgGDIWindow = class(TfpgWindowBase) private - {$IFNDEF WINCE} + {$IFDEF HAS_DND} FDropManager: TfpgOLEDropTarget; {$ENDIF} FDropPos: TPoint; FUserMimeSelection: TfpgString; FUserAcceptDrag: Boolean; - {$IFNDEF WINCE} + {$IFDEF HAS_DND} procedure HandleDNDLeave(Sender: TObject); procedure HandleDNDEnter(Sender: TObject; DataObj: IDataObject; KeyState: Longint; PT: TPoint; var Effect: DWORD); function GetDropManager: TfpgOLEDropTarget; @@ -177,7 +185,7 @@ type QueueAcceptDrops: boolean; function DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean; procedure WindowSetFullscreen(aFullScreen, aUpdate: boolean); - {$IFNDEF WINCE} + {$IFDEF HAS_DND} property DropManager: TfpgOLEDropTarget read GetDropManager; {$ENDIF} protected @@ -1453,7 +1461,7 @@ var // this are required for Windows MouseEnter & MouseExit detection. uLastWindowHndl: TfpgWinHandle; -{$IFNDEF WINCE} +{$IFDEF HAS_DND} procedure TfpgGDIWindow.HandleDNDLeave(Sender: TObject); var wg: TfpgWidget; @@ -1619,7 +1627,7 @@ begin end; Result := FDropManager; end; -{$ENDIF} +{$ENDIF HAS_DND} function TfpgGDIWindow.DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean; var @@ -2026,7 +2034,7 @@ end; procedure TfpgGDIWindow.DoAcceptDrops(const AValue: boolean); begin - {$IFNDEF WINCE} + {$IFDEF HAS_DND} if AValue then begin if HasHandle then @@ -2097,7 +2105,7 @@ constructor TfpgGDIWindow.Create(AOwner: TComponent); begin inherited Create(AOwner); FWinHandle := 0; - {$IFNDEF WINCE} + {$IFDEF HAS_DND} FDropManager := nil; {$ENDIF} FDropPos.x := 0; @@ -2109,7 +2117,7 @@ end; destructor TfpgGDIWindow.Destroy; begin - {$IFNDEF WINCE} + {$IFDEF HAS_DND} if Assigned(FDropManager) then FDropManager.Free; {$ENDIF} @@ -3046,13 +3054,13 @@ var M: PStgMedium; itm: TfpgMimeDataItem; lEffects: DWORD; - {$IFNDEF WINCE} + {$IFDEF HAS_DND} FDataObject: TfpgOLEDataObject; FDropSource: TfpgOLEDropSource; {$ENDIF} lIsTranslated: boolean; begin - {$IFNDEF WINCE} + {$IFDEF HAS_DND} if FDragging then begin {$IFDEF DND_DEBUG} @@ -3143,7 +3151,7 @@ begin // (FDropSource as IUnknown)._Release; // (FDataObject as IUnknown)._Release; end; - {$ENDIF} + {$ENDIF HAS_DND} end; { TGDIDragManager } @@ -3187,14 +3195,14 @@ end; procedure TGDIDragManager.RegisterDragDrop; begin - {$IFNDEF WINCE} + {$IFDEF HAS_DND} Activex.RegisterDragDrop(TfpgWidget(FDropTarget).WinHandle, self as IDropTarget) {$ENDIF} end; procedure TGDIDragManager.RevokeDragDrop; begin - {$IFNDEF WINCE} + {$IFDEF HAS_DND} ActiveX.RevokeDragDrop(TfpgWidget(FDropTarget).WinHandle); {$ENDIF} end; |