Class TDropSource (unit DropSource)

Inherits from

TInterfacedObject

IDropSource

IDataObject

----------------------------------------------------------------------------- Project: Drag and Drop source Module: DropSource Description: Simple implementation of a DropSource object Version: 2.0 Release: 2 Date: 14-MAR-1998 Target: Win32, Delphi 3 Author: Anders Melander, anders@melander.dk Copyright (c) 1997,98 by Anders Melander Formatting: 2 space indent, 8 space tabs, 80 columns. ----------------------------------------------------------------------------- Portions copyright (c) Borland International. ----------------------------------------------------------------------------- You are free to use the source in any way you please, but please give me credit for my work. If you make improvements (as I'm sure you will have to) or derive new components from my stuff, I would very much like to see your improvements. ----------------------------------------------------------------------------- Revision history: // 0100 290597 anme - Initial attempt based on clues from jape@planetmail.net // 0101 030697 anme - Yet another attempt. Copied a lot of stuff from ContextM.pas - Close, but no cigar. // 0102 100697 anme - Hmmm - maybe I shouldn't delete my object after calling DoDragDrop. OK, that got rid of a GPF, but still no drop. // 0103 100697 anme - Found stuff from stefc@fabula.com, looks like he's had the same problems. Adapted GetData from his source. Aha! I _do_ need to implement EnumFormatEtc after all. Copied TEnumFormatEtc from OleCtnrs.pas and... Voila! // 0104 160697 anme - Modified TDropSource to handle CF_HDROP instead of CF_TEXT just for the fun of it... OLE initialization was missing, so when I removed the memo field from the test form, the demo stopped working. Works nicely, but can't get DROPEFFECT_LINK to play. // 0200 140398 anme - Remodelled design. TDropSource is now an abstract base class from which TDropTextSource and TDropFileSource is derived. - Changed TDropSource base class from TComObject to TInterfacedObject. We don't need support for object factories. -----------------------------------------------------------------------------

Constructors



Functions

function DAdvise(const formatetc: TFormatEtc; advf: Longint; const advSink: IAdviseSink; out dwConnection: Longint): HResult;


function DUnadvise(dwConnection: Longint): HResult;


function EnumDAdvise(out enumAdvise: IEnumStatData): HResult;


function EnumFormatEtc(dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult;


function GetCanonicalFormatEtc(const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult;


function GetData(const formatetcIn: TFormatEtc; out medium: TStgMedium):HResult;

IDataObject implementation

function GetDataHere(const formatetc: TFormatEtc; out medium: TStgMedium):HResult;


function GiveFeedback(dwEffect: Longint): HResult;


function QueryContinueDrag(fEscapePressed: BOOL; grfKeyState: Longint): HResult;

IDropSource implementation

----------------------------------------------------------------------------- TDropSource -----------------------------------------------------------------------------


function QueryGetData(const formatetc: TFormatEtc): HResult;


function SetData(const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult;


function DoEnumFormatEtc(dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult;


function DoGetData(const formatetcIn: TFormatEtc; out medium: TStgMedium):HResult;


function DoGetDataHere(const formatetc: TFormatEtc; out medium: TStgMedium):HResult;


function DoQueryGetData(const formatetc: TFormatEtc): HResult;


Properties

Events

Variables


Constructors


Functions


function DAdvise(const formatetc: TFormatEtc; advf: Longint; const advSink: IAdviseSink; out dwConnection: Longint): HResult;


function DUnadvise(dwConnection: Longint): HResult;


function EnumDAdvise(out enumAdvise: IEnumStatData): HResult;


function EnumFormatEtc(dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult;


function GetCanonicalFormatEtc(const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult;


function GetData(const formatetcIn: TFormatEtc; out medium: TStgMedium):HResult;

IDataObject implementation


function GetDataHere(const formatetc: TFormatEtc; out medium: TStgMedium):HResult;


function GiveFeedback(dwEffect: Longint): HResult;


function QueryContinueDrag(fEscapePressed: BOOL; grfKeyState: Longint): HResult;

IDropSource implementation

----------------------------------------------------------------------------- TDropSource -----------------------------------------------------------------------------


function QueryGetData(const formatetc: TFormatEtc): HResult;


function SetData(const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult;


function DoEnumFormatEtc(dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult;


function DoGetData(const formatetcIn: TFormatEtc; out medium: TStgMedium):HResult;


function DoGetDataHere(const formatetc: TFormatEtc; out medium: TStgMedium):HResult;


function DoQueryGetData(const formatetc: TFormatEtc): HResult;


Properties


Events


Variables