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

# DropTarget.h

Go to the documentation of this file.

    00001
    00002
    00003
    00004 #ifndef TRAYICON_H
    00005 #define TRAYICON_H
    00006
    00007 #include "Component.h"
    00008 #include <oleidl.h>
    00009 #include <objidl.h>
    00010 #include <vector>
    00011
    00012 namespace wkgl {
    00013
    00014 //DropTarget Events
    00015 #define DTM_ENTER WM_USER + 0x0A
    00016 #define DTM_LEAVE WM_USER + 0x0B
    00017 #define DTM_OVER  WM_USER + 0x0C
    00018 #define DTM_DROP  WM_USER + 0x0D
    00019
    00024 typedef struct tag_DROPTARGET_DATA
    00025 {
    00026   IDataObject *pDataObject;
    00027   DWORD grfKeyState;
    00028   POINTL pt;
    00029   FORMATETC *format;
    00030 } DROPTARGET_DATA, *LPDROPTARGET_DATA;
    00031
    00040 typedef HRESULT (*DROPTARGET_CALLBACK)( Component* com, DWORD message,
    00041                                         LPDROPTARGET_DATA params,
    00042                                         DWORD* effect );
    00043
    00062 class DropTarget : public IDropTarget
    00063 {
    00064   protected:
    00068     struct FORMATNODE
    00069     {
    00070       FORMATNODE *next;
    00071       FORMATNODE *prev;
    00072       FORMATETC format;
    00073     };
    00074
    00075     ULONG nrefs;
    00076     FORMATNODE *flist;
    00077     FORMATNODE *lastnode;
    00078     DWORD nformats;
    00079     Component* target;
    00080     IDataObject* lastobj;
    00081     bool dropok;
    00082
    00086     std::vector <DROPTARGET_CALLBACK> callbacks;
    00087
    00091     HRESULT queryGetData( DWORD event, DROPTARGET_DATA &data, DWORD *effects );
    00092   public:
    00093     /**********************DropTarget Methods*******************************/
    00097     DropTarget( Component *target );
    00098
    00102     ~DropTarget();
    00103
    00107     void addDropTargetCallBack( DROPTARGET_CALLBACK callback );
    00108
    00112     HRESULT fireEvent( DWORD event, DROPTARGET_DATA &data, DWORD *effects );
    00113
    00117     void addFormat( FORMATETC *format );
    00118
    00119     /******************IDropTarget Interface definitions**********************/
    00120     virtual HRESULT _stdcall Drop( IDataObject *pDataObject, DWORD grfKeyState,
    00121                                    POINTL pt, DWORD *pdwEffect );
    00122     virtual HRESULT _stdcall DragLeave();
    00123     virtual HRESULT _stdcall DragOver( DWORD grfKeyState, POINTL pt,
    00124                                        DWORD *pdwEffect );
    00125     virtual HRESULT _stdcall DragEnter( IDataObject *pDataObject,
    00126                                         DWORD grfKeyState, POINTL pt,
    00127                                         DWORD *pdwEffect );
    00128
    00129     /*********************IUnknown Interface definitions***********************/
    00130     virtual ULONG _stdcall Release();
    00131     virtual ULONG _stdcall AddRef();
    00132     virtual HRESULT _stdcall QueryInterface( REFIID iid, void **ppvObject );
    00133 };
    00134 }
    00135 #endif