Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

wkgl::DropTarget Class Reference

This class allows a component to become a drop target. More...

#include <DropTarget.h>

List of all members.

Public Methods

 DropTarget (Component *target)
 Makes the given component a target for drops.

 ~DropTarget ()
 Unregisters the component for drops.

void addDropTargetCallBack (DROPTARGET_CALLBACK callback)
 Adds the given callback to listen for drop target events.

HRESULT fireEvent (DWORD event, DROPTARGET_DATA &data, DWORD *effects)
 Fires the given event to the callbacks.

void addFormat (FORMATETC *format)
 Adds a format to the end of the list.

virtual HRESULT _stdcall Drop (IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
virtual HRESULT _stdcall DragLeave ()
virtual HRESULT _stdcall DragOver (DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
virtual HRESULT _stdcall DragEnter (IDataObject *pDataObject, DWORD grfKeyState, POINTL pt, DWORD *pdwEffect)
virtual ULONG _stdcall Release ()
virtual ULONG _stdcall AddRef ()
virtual HRESULT _stdcall QueryInterface (REFIID iid, void **ppvObject)

Protected Methods

HRESULT queryGetData (DWORD event, DROPTARGET_DATA &data, DWORD *effects)
 Tests the event source against the formats.


Protected Attributes

ULONG nrefs
 Used by IQueryInterface.

FORMATNODEflist
 Doubly linked list of FORMATETC's.

FORMATNODElastnode
 The last node in the list.

DWORD nformats
 The number of items in the list.

Componenttarget
 The drop target component.

IDataObject * lastobj
 The last object that entered the target.

bool dropok
 Flag specifing the object can be droped.

std::vector< DROPTARGET_CALLBACKcallbacks
 The list of callback functions to call.


Detailed Description

This class allows a component to become a drop target.

Author:
Micheal Nooner
To properly handle the events you should reference the windows docs for the IDropTarget interface. The messages and events that are exposed are simply encapsulations of the DragEnter, Drop, etc. methods. You should note that events are passed to callback functions of the type DROPTARGET_CALLBACK. Note that for DTM_LEAVE none of the fields of the LPDROPTARGET_DATA struct are filled in, this event is used simply to notify you if you need to do any clean up operations. Also note currently DTM_OVER is unsupported. To tell the system that you will accept the IDataObject you must set the DWORD pointer's value to either DROPEFFECT_COPY, DROPEFFECT_MOVE, or DROPEFFECT_LINK. To tell the system you do not wish to accept the IDataObject set the pointer's value to DROPEFFECT_NONE.


Constructor & Destructor Documentation

DropTarget::DropTarget Component   target
 

Makes the given component a target for drops.

Parameters:
target  The component to make a drop target

DropTarget::~DropTarget  
 

Unregisters the component for drops.


Member Function Documentation

void DropTarget::addDropTargetCallBack DROPTARGET_CALLBACK    callback
 

Adds the given callback to listen for drop target events.

Parameters:
callback  The function to use as a callback.

void DropTarget::addFormat FORMATETC *    format
 

Adds a format to the end of the list.

Parameters:
format  The format to append to the end of the list

ULONG DropTarget::AddRef   [virtual]
 

HRESULT DropTarget::DragEnter IDataObject *    pDataObject,
DWORD    grfKeyState,
POINTL    pt,
DWORD *    pdwEffect
[virtual]
 

HRESULT DropTarget::DragLeave   [virtual]
 

HRESULT DropTarget::DragOver DWORD    grfKeyState,
POINTL    pt,
DWORD *    pdwEffect
[virtual]
 

HRESULT DropTarget::Drop IDataObject *    pDataObject,
DWORD    grfKeyState,
POINTL    pt,
DWORD *    pdwEffect
[virtual]
 

HRESULT DropTarget::fireEvent DWORD    event,
DROPTARGET_DATA   data,
DWORD *    effects
 

Fires the given event to the callbacks.

Parameters:
event  The event identifier, either DTM_ENTER, DTM_LEAVE, DTM_OVER, or DTM_DROP
data  The data to send to the callbacks
effects  The effect returned by the callback.
Returns:
S_OK if at least one of the callbacks returned S_OK, otherwise it returns what was returned by the last callback.

HRESULT DropTarget::queryGetData DWORD    event,
DROPTARGET_DATA   data,
DWORD *    effects
[protected]
 

Tests the event source against the formats.

It tests to see if any of the formats in the list are acceptable to this type of DataObject. If one is it calls FireEvent. It then proceeds to to test the next format.

Parameters:
event  The Drop Target Message associated with this event
data  The param, used by the callback
effects  The effect of from the callback
Returns:
S_OK if at least one call to FireEvents() resulted in S_OK, otherwise it returns what was returned by the last call to FireEvents().

HRESULT DropTarget::QueryInterface REFIID    iid,
void **    ppvObject
[virtual]
 

ULONG DropTarget::Release   [virtual]
 


Member Data Documentation

std::vector<DROPTARGET_CALLBACK> wkgl::DropTarget::callbacks [protected]
 

The list of callback functions to call.

bool wkgl::DropTarget::dropok [protected]
 

Flag specifing the object can be droped.

FORMATNODE* wkgl::DropTarget::flist [protected]
 

Doubly linked list of FORMATETC's.

FORMATNODE* wkgl::DropTarget::lastnode [protected]
 

The last node in the list.

IDataObject* wkgl::DropTarget::lastobj [protected]
 

The last object that entered the target.

DWORD wkgl::DropTarget::nformats [protected]
 

The number of items in the list.

ULONG wkgl::DropTarget::nrefs [protected]
 

Used by IQueryInterface.

Component* wkgl::DropTarget::target [protected]
 

The drop target component.


The documentation for this class was generated from the following files:
Generated on Tue Apr 29 03:18:54 2003 for GuiLib by doxygen1.2.18