diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-29 11:49:24 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-10-29 11:49:24 +0200 |
commit | 187ba5cd250f2561e0156520332f4614bfba1219 (patch) | |
tree | 6c17f470bf0e3d22c0a49a3f374137a342d5d38a /src/corelib/gdi | |
parent | 2cd819cc6aef31153f0223a92dc9071b413d42fe (diff) | |
download | fpGUI-187ba5cd250f2561e0156520332f4614bfba1219.tar.xz |
GDI: Implemented StringToHandle in TfpgGDIDrag class
This is needed so we can store a string in a global buffer for DND.
This will also reduce code duplication a bit, by simply allowing
us to call this function.
Diffstat (limited to 'src/corelib/gdi')
-rw-r--r-- | src/corelib/gdi/fpg_gdi.pas | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index 980339b4..18b04da0 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -265,7 +265,10 @@ type end; + { Used mainly for sending drags - being the source of the drag } TfpgGDIDrag = class(TfpgDragBase) + private + function StringToHandle(const AString: TfpgString): HGLOBAL; protected FSource: TfpgGDIWindow; function GetSource: TfpgGDIWindow; virtual; @@ -2747,6 +2750,22 @@ end; { TfpgGDIDrag } +function TfpgGDIDrag.StringToHandle(const AString: TfpgString): HGLOBAL; +var + dest: HGLOBAL; + l: integer; + p: PChar; +begin + p := PChar(AString); + l := Length(AString)+1; + { allocate and lock a global memory buffer. Make it fixed + data so we don't have to use GlobalLock } + dest := GlobalAlloc(GMEM_FIXED, l); + { Copy the string into the buffer } + Move(p^, PChar(dest)^, l); + Result := dest; +end; + function TfpgGDIDrag.GetSource: TfpgGDIWindow; begin Result := FSource; |