Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042 #ifndef _OLE_DND_H
00043 #define _OLE_DND_H
00044
00045
00046 #include "vtkTcl.h"
00047 #include "vtkTk.h"
00048
00049 #include <windows.h>
00050 #include <ole2.h>
00051
00052 #ifdef DND_ENABLE_DROP_TARGET_HELPER
00053 #include <atlbase.h>
00054 #include <shlobj.h>
00055 #include <shlguid.h>
00056
00057 struct __declspec(uuid("{4657278B-411B-11d2-839A-00C04FD918D0}"))
00058 IDropTargetHelper;
00059 #endif /* DND_ENABLE_DROP_TARGET_HELPER */
00060
00061 #include <tcl.h>
00062 #include <tk.h>
00063 #include "tkDND.h"
00064 #include "tkOleDND_TEnumFormatEtc.h"
00065
00066 #ifdef DND_DEBUG
00067 extern FILE *TkDND_Log;
00068 #endif
00069
00070 typedef struct _OLEDND_Struct {
00071 Tk_Window MainWindow; /* The main window of our application */
00072 Tcl_Interp *interp; /* A Tcl Interpreter */
00073 Display *display; /* Display Pointer */
00074 int x; /* Current position of the mouse */
00075 int y; /* Current position of the mouse */
00076 int button; /* Current button used for drag operation */
00077 Tk_Window CursorWindow; /* A window to replace cursor */
00078 char * CursorCallback; /* A Callback to update cursor window */
00079
00080 Tk_Window DraggerWindow; /* Window of the drag source */
00081 DWORD DraggerActions; /* Actions supported by the drag source */
00082 Tcl_DString DraggerTypes; /* The list of types of the drag source */
00083 CLIPFORMAT DesiredType; /* The drop desired type */
00084 char *DesiredTypeStr; /* The drop desired type (string) */
00085 char DesiredAction[10]; /* The drop desired action */
00086 int CallbackStatus; /* The return value of last tcl callback */
00087 Tcl_Obj *data; /* The object contained data to be dropped */
00088 int length; /* length of the data */
00089
00090 /* Some useful CLIPFORMATS... */
00091 CLIPFORMAT UniformResourceLocator; /* Netscape, IE */
00092 CLIPFORMAT FileName; /* Windows Explorer */
00093 CLIPFORMAT HTML_Format; /* Word, IE */
00094 CLIPFORMAT RichTextFormat; /* Word, IE */
00095 CLIPFORMAT FileGroupDescriptor; /* Explorer, files not in the file */
00096 CLIPFORMAT FileGroupDescriptorW; /* system */
00097 } OleDND;
00098 #define DndClass OleDND
00099
00100 /*****************************************************************************
00101 * Drop Source Related Class.
00102 ****************************************************************************/
00103 class TkDND_DropSource: public IDropSource {
00104 private:
00105 ULONG m_refCnt; /* Reference count */
00106 DndInfo *infoPtr; /* Pointer to hash table entry */
00107
00108 public:
00109 TkDND_DropSource(DndInfo *infoPtr);
00110 ~TkDND_DropSource(void);
00111
00112 /* IUnknown interface members */
00113 STDMETHODIMP QueryInterface(REFIID, LPVOID *);
00114 STDMETHODIMP_(ULONG) AddRef(void);
00115 STDMETHODIMP_(ULONG) Release(void);
00116
00117 /* IDropSource interface members */
00118 STDMETHODIMP QueryContinueDrag(BOOL, DWORD);
00119 STDMETHODIMP GiveFeedback(DWORD);
00120 }; /* TkDND_DropSource */
00121
00122 /*****************************************************************************
00123 * Data object Related Class (needed by Drag Source for OLE DND)...
00124 ****************************************************************************/
00125 class TkDND_DataObject: public IDataObject {
00126 private:
00127 ULONG m_refCnt; /* Reference Count */
00128 DndInfo *infoPtr; /* Pointer to hash table entry */
00129
00130 /* The clipboard formats that can be handled */
00131 UINT m_numTypes; /* Number of types in list */
00132 UINT m_maxTypes; /* Number of types that fit */
00133 FORMATETC *m_typeList; /* List of types */
00134
00135 public:
00136 TkDND_DataObject(DndInfo *infoPtr);
00137 ~TkDND_DataObject(void);
00138
00139 /* IUnknown interface members */
00140 STDMETHODIMP QueryInterface(REFIID, LPVOID *);
00141 STDMETHODIMP_(ULONG) AddRef(void);
00142 STDMETHODIMP_(ULONG) Release(void);
00143
00144 /* IDataObject interface methods */
00145 STDMETHODIMP GetData(LPFORMATETC, LPSTGMEDIUM);
00146 STDMETHODIMP GetDataHere(LPFORMATETC, LPSTGMEDIUM);
00147 STDMETHODIMP QueryGetData(LPFORMATETC);
00148 STDMETHODIMP GetCanonicalFormatEtc(LPFORMATETC, LPFORMATETC);
00149 STDMETHODIMP SetData(LPFORMATETC, LPSTGMEDIUM, BOOL);
00150 STDMETHODIMP EnumFormatEtc(DWORD, LPENUMFORMATETC *);
00151 STDMETHODIMP DAdvise(LPFORMATETC, DWORD, LPADVISESINK, DWORD *);
00152 STDMETHODIMP DUnadvise(DWORD);
00153 STDMETHODIMP EnumDAdvise(IEnumSTATDATA **);
00154
00155 /* TkDND additional interface methods */
00156 int AddDataType(UINT clipFormat);
00157 int DelDataType(UINT clipFormat);
00158 }; /* TkDND_DataObject */
00159
00160 /*****************************************************************************
00161 * Drop Target Related Class.
00162 ****************************************************************************/
00163 class TkDND_DropTarget;
00164 typedef class TkDND_DropTarget *PTDropTarget;
00165 class TkDND_DropTarget: public IDropTarget {
00166 private:
00167 ULONG m_refCnt; /* Reference count */
00168 DndInfo *infoPtr; /* Pointer to hash table entry */
00169 DWORD KeyState; /* Remember KeyState for <DragLeave> */
00170 LPDATAOBJECT DataObject; /* Keep data object available */
00171 #ifdef DND_ENABLE_DROP_TARGET_HELPER
00172 CComPtr<IDropTargetHelper> DropHelper; /* IDropTargetHelper support. This
00173 helper does some interesting
00174 things, like drawing explorer
00175 icons during drops... */
00176 int UseDropHelper; /* A flag whether to use the helper
00177 or not... */
00178 #endif /* DND_ENABLE_DROP_TARGET_HELPER */
00179
00180 public:
00181 TkDND_DropTarget(DndInfo *info);
00182 ~TkDND_DropTarget(void);
00183
00184 /* IUnknown interface members */
00185 STDMETHODIMP QueryInterface(REFIID, LPVOID *);
00186 STDMETHODIMP_(ULONG) AddRef(void);
00187 STDMETHODIMP_(ULONG) Release(void);
00188
00189 /* IDropTarget interface members */
00190 STDMETHODIMP DragEnter(LPDATAOBJECT, DWORD, POINTL,LPDWORD);
00191 STDMETHODIMP DragOver(DWORD, POINTL, LPDWORD);
00192 STDMETHODIMP DragLeave(void);
00193 STDMETHODIMP Drop(LPDATAOBJECT, DWORD, POINTL, LPDWORD);
00194
00195 /* TkDND additional interface methods */
00196 DWORD ParseAction(void);
00197 Tcl_Obj *GetAndConvertData(LPDATAOBJECT,
00198 DndType *, char *, FORMATETC *, STGMEDIUM *);
00199 }; /* TkDND_DropTarget */
00200
00201 #endif _OLE_DND_H