diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-12 17:20:40 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-28 10:57:21 +0200 |
commit | 295242c96cf0c0f791fcc4aeea7555269d493503 (patch) | |
tree | b8bcaca64f5260fec6134a8c91b6f99ee84e4e43 /src/corelib | |
parent | 8c7e0c3444a9746fbff7caecbc2014e114b837c6 (diff) | |
download | fpGUI-295242c96cf0c0f791fcc4aeea7555269d493503.tar.xz |
TfpgWindowBase introduced a new abstract method
* This abstract method is called from TfpgWidget's AcceptDrops setter function
* Template implementation in X11
* Actual implementation in GDI
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/fpg_base.pas | 1 | ||||
-rw-r--r-- | src/corelib/fpg_widget.pas | 1 | ||||
-rw-r--r-- | src/corelib/gdi/fpg_gdi.pas | 29 | ||||
-rw-r--r-- | src/corelib/x11/fpg_x11.pas | 6 |
4 files changed, 35 insertions, 2 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 143238cf..ff4230e8 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -446,6 +446,7 @@ type procedure DoSetWindowTitle(const ATitle: string); virtual; abstract; procedure DoSetMouseCursor; virtual; abstract; procedure DoDNDEnabled(const AValue: boolean); virtual; abstract; + procedure DoAcceptDrops(const AValue: boolean); virtual; abstract; procedure SetParent(const AValue: TfpgWindowBase); virtual; function GetParent: TfpgWindowBase; virtual; function GetCanvas: TfpgCanvasBase; virtual; diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index 2afb667a..45a480dc 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -286,6 +286,7 @@ begin if FAcceptDrops = AValue then exit; FAcceptDrops := AValue; + DoAcceptDrops(AValue); end; function TfpgWidget.GetHint: TfpgString; diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index 7da02311..e7c3db3c 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -28,9 +28,10 @@ unit fpg_gdi; interface uses - Windows, Classes, SysUtils, + Windows, + ActiveX, fpg_base, fpg_impl {$IFDEF DEBUG} @@ -152,6 +153,7 @@ type FNonFullscreenStyle: longword; FFullscreenIsSet: boolean; FSkipResizeMessage: boolean; + QueueAcceptDrops: boolean; function DoMouseEnterLeaveCheck(AWindow: TfpgGDIWindow; uMsg, wParam, lParam: Cardinal): Boolean; procedure WindowSetFullscreen(aFullScreen, aUpdate: boolean); property DragManager: TGDIDragManager read GetDragManager; @@ -173,6 +175,7 @@ type procedure DoSetWindowTitle(const ATitle: string); override; procedure DoSetMouseCursor; override; procedure DoDNDEnabled(const AValue: boolean); override; + procedure DoAcceptDrops(const AValue: boolean); override; property WinHandle: TfpgWinHandle read FWinHandle; public constructor Create(AOwner: TComponent); override; @@ -1587,6 +1590,11 @@ begin // the forms require some adjustments before the Window appears SetWindowParameters; FSkipResizeMessage := False; + + if QueueAcceptDrops then + begin + DoAcceptDrops(True); + end; end; procedure TfpgGDIWindow.DoReleaseWindowHandle; @@ -1704,7 +1712,24 @@ end; procedure TfpgGDIWindow.DoDNDEnabled(const AValue: boolean); begin - // TODO: still needs to be implemented + { GDI has nothing to do here } +end; + +procedure TfpgGDIWindow.DoAcceptDrops(const AValue: boolean); +begin + if AValue then + begin + if HasHandle then + DragManager.RegisterDragDrop + else + QueueAcceptDrops := True; // we need to do this once we have a winhandle + end + else + begin + if HasHandle then + DragManager.RevokeDragDrop; + QueueAcceptDrops := False; + end; end; constructor TfpgGDIWindow.Create(AOwner: TComponent); diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index f56a4851..4f9c4ce8 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -231,6 +231,7 @@ type procedure DoUpdateWindowPosition; override; procedure DoSetMouseCursor; override; procedure DoDNDEnabled(const AValue: boolean); override; + procedure DoAcceptDrops(const AValue: boolean); override; property WinHandle: TfpgWinHandle read FWinHandle; public constructor Create(AOwner: TComponent); override; @@ -2396,6 +2397,11 @@ begin XDeleteProperty(xapplication.Display, WinHandle, xapplication.XdndAware); end; +procedure TfpgX11Window.DoAcceptDrops(const AValue: boolean); +begin + { TODO : Remove EnableDrops, then recurse from here to parent top level from, and set XDNDAware property for form. } +end; + procedure TfpgX11Window.DoSetWindowTitle(const ATitle: string); var tp: TXTextProperty; |