Recalculate nItemHeight when LVS_SETIMAGELIST is called. Fixes icons
[wine] / include / wine / obj_dataobject.h
1 /*
2  * Defines the COM interfaces and APIs related to IDataObject.
3  *
4  */
5
6 #ifndef __WINE_WINE_OBJ_DATAOBJECT_H
7 #define __WINE_WINE_OBJ_DATAOBJECT_H
8
9 #ifdef __cplusplus
10 extern "C" {
11 #endif /* defined(__cplusplus) */
12
13 /*****************************************************************************
14  * Predeclare the structures
15  */
16 typedef enum tagDATADIR
17 {
18         DATADIR_GET = 1,
19         DATADIR_SET = 2
20 } DATADIR;
21  
22 typedef struct DVTARGETDEVICE16 DVTARGETDEVICE16, *LPDVTARGETDEVICE16;
23 typedef struct DVTARGETDEVICE DVTARGETDEVICE, *LPDVTARGETDEVICE;
24
25 typedef struct FORMATETC16 FORMATETC16, *LPFORMATETC16;
26 typedef struct FORMATETC FORMATETC, *LPFORMATETC;
27
28 typedef struct STGMEDIUM STGMEDIUM, *LPSTGMEDIUM;
29
30
31 /*****************************************************************************
32  * Predeclare the interfaces
33  */
34 DEFINE_OLEGUID(IID_IAdviseSink,         0x0000010fL, 0, 0);
35 typedef struct IAdviseSink IAdviseSink,*LPADVISESINK;
36
37 DEFINE_OLEGUID(IID_IAdviseSink2,        0x00000125L, 0, 0);
38 typedef struct IAdviseSink2 IAdviseSink2,*LPADVISESINK2;
39
40 DEFINE_OLEGUID(IID_IDataAdviseHolder,   0x00000110L, 0, 0);
41 typedef struct IDataAdviseHolder IDataAdviseHolder,*LPDATAADVISEHOLDER;
42
43 DEFINE_OLEGUID(IID_IDataObject,         0x0000010EL, 0, 0);
44 typedef struct IDataObject IDataObject,*LPDATAOBJECT;
45
46 DEFINE_OLEGUID(IID_IEnumFORMATETC,      0x00000103L, 0, 0);
47 typedef struct IEnumFORMATETC IEnumFORMATETC,*LPENUMFORMATETC;
48
49 DEFINE_OLEGUID(IID_IEnumSTATDATA,       0x00000105L, 0, 0);
50 typedef struct IEnumSTATDATA IEnumSTATDATA,*LPENUMSTATDATA;
51
52
53 /*****************************************************************************
54  * DVTARGETDEVICE structure
55  */
56 struct DVTARGETDEVICE
57 {
58     DWORD tdSize;
59     WORD tdDriverNameOffset;
60     WORD tdDeviceNameOffset;
61     WORD tdPortNameOffset;
62     WORD tdExtDevmodeOffset;
63     BYTE tdData[1];
64 };
65
66
67 /*****************************************************************************
68  * FORMATETC structure
69  */
70 /* wished data format */
71 struct FORMATETC
72 {
73     CLIPFORMAT cfFormat;
74     DVTARGETDEVICE* ptd;
75     DWORD dwAspect;
76     LONG lindex;
77     DWORD tymed;
78 };
79
80
81 /*****************************************************************************
82  * STGMEDIUM structure
83  */
84 typedef enum tagTYMED
85 {
86     TYMED_HGLOBAL   = 1,
87         TYMED_FILE      = 2,
88         TYMED_ISTREAM   = 4,
89         TYMED_ISTORAGE  = 8,
90         TYMED_GDI       = 16,
91         TYMED_MFPICT    = 32,
92         TYMED_ENHMF     = 64,
93         TYMED_NULL      = 0
94 } TYMED;
95   
96 typedef struct tagRemSTGMEDIUM
97 {
98         DWORD tymed;
99         DWORD dwHandleType;
100         unsigned long pData;
101         unsigned long pUnkForRelease;
102         unsigned long cbData;
103         byte data[1];
104 } RemSTGMEDIUM;
105
106 /* dataobject as answer to a request */
107 struct STGMEDIUM
108 {
109     DWORD tymed;
110     union {
111         HBITMAP hBitmap;
112         HMETAFILEPICT hMetaFilePict;
113         HENHMETAFILE hEnhMetaFile;
114         HGLOBAL hGlobal;
115         LPOLESTR lpszFileName;
116         IStream *pstm;
117         IStorage *pstg;
118     } DUMMYUNIONNAME;
119     IUnknown *pUnkForRelease;
120 };   
121
122 typedef enum tagADVF
123 {
124         ADVF_NODATA = 1,
125         ADVF_PRIMEFIRST = 2,
126         ADVF_ONLYONCE = 4,
127         ADVF_DATAONSTOP = 64,
128         ADVFCACHE_NOHANDLER = 8,
129         ADVFCACHE_FORCEBUILTIN = 16,
130         ADVFCACHE_ONSAVE = 32
131 } ADVF;
132
133 typedef struct tagSTATDATA
134 {
135         FORMATETC formatetc;
136         DWORD advf;
137         IAdviseSink *pAdvSink;
138         DWORD dwConnection;
139 } STATDATA, *LPSTATDATA;
140
141 /*****************************************************************************
142  * IAdviseSink interface
143  */
144 #define ICOM_INTERFACE IAdviseSink
145 #define IAdviseSink_METHODS \
146     ICOM_VMETHOD2(OnDataChange, FORMATETC*,pFormatetc, STGMEDIUM*,pStgmed) \
147     ICOM_VMETHOD2(OnViewChange, DWORD,dwAspect, LONG,lindex) \
148     ICOM_VMETHOD1(OnRename,     IMoniker*,pmk) \
149     ICOM_VMETHOD (OnSave) \
150     ICOM_VMETHOD (OnClose)
151 #define IAdviseSink_IMETHODS \
152     IUnknown_IMETHODS \
153     IAdviseSink_METHODS
154 ICOM_DEFINE(IAdviseSink,IUnknown)
155 #undef ICOM_INTERFACE
156
157 /*** IUnknown methods ***/
158 #define IAdviseSink_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
159 #define IAdviseSink_AddRef(p)             ICOM_CALL (AddRef,p)
160 #define IAdviseSink_Release(p)            ICOM_CALL (Release,p)
161 /*** IAdviseSink methods ***/
162 #define IAdviseSink_OnDataChange(p,a,b) ICOM_CALL2(OnDataChange,p,a,b)
163 #define IAdviseSink_OnViewChange(p,a,b) ICOM_CALL2(OnViewChange,p,a,b)
164 #define IAdviseSink_OnRename(p,a)       ICOM_CALL1(OnRename,p,a)
165 #define IAdviseSink_OnSave(p)           ICOM_CALL (OnSave,p)
166 #define IAdviseSink_OnClose(p)          ICOM_CALL (OnClose,p)
167
168
169 /*****************************************************************************
170  * IAdviseSink2 interface
171  */
172 #define ICOM_INTERFACE IAdviseSink2
173 #define IAdviseSink2_METHODS \
174     ICOM_VMETHOD1(OnLinkSrcChange, IMoniker*,pmk)
175 #define IAdviseSink2_IMETHODS \
176     IAdviseSink_IMETHODS \
177     IAdviseSink2_METHODS
178 ICOM_DEFINE(IAdviseSink2,IAdviseSink)
179 #undef ICOM_INTERFACE
180
181 /*** IUnknown methods ***/
182 #define IAdviseSink2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
183 #define IAdviseSink2_AddRef(p)             ICOM_CALL (AddRef,p)
184 #define IAdviseSink2_Release(p)            ICOM_CALL (Release,p)
185 /*** IAdviseSink methods ***/
186 #define IAdviseSink2_OnDataChange(p,a,b) ICOM_CALL2(IAdviseSink,OnDataChange,p,a,b)
187 #define IAdviseSink2_OnViewChange(p,a,b) ICOM_CALL2(IAdviseSink,OnViewChange,p,a,b)
188 #define IAdviseSink2_OnRename(p,a)       ICOM_CALL1(IAdviseSink,OnRename,p,a)
189 #define IAdviseSink2_OnSave(p)           ICOM_CALL (IAdviseSink,OnSave,p)
190 #define IAdviseSink2_OnClose(p)          ICOM_CALL (IAdviseSink,OnClose,p)
191 /*** IAdviseSink2 methods ***/
192 #define IAdviseSink2_OnLinkSrcChange(p,a) ICOM_CALL(OnLinkSrcChange,p,a)
193
194
195 /*****************************************************************************
196  * IDataAdviseHolder interface
197  */
198 #define ICOM_INTERFACE IDataAdviseHolder
199 #define IDataAdviseHolder_METHODS \
200     ICOM_METHOD5(HRESULT,Advise,           IDataObject*,pDataObject, FORMATETC*,pFetc, DWORD,advf, IAdviseSink*,pAdvise, DWORD*,pdwConnection) \
201     ICOM_METHOD1(HRESULT,Unadvise,         DWORD,dwConnection) \
202     ICOM_METHOD1(HRESULT,EnumAdvise,       IEnumSTATDATA**,ppenumAdvise) \
203     ICOM_METHOD3(HRESULT,SendOnDataChange, IDataObject*,pDataObject, DWORD,dwReserved, DWORD,advf)
204 #define IDataAdviseHolder_IMETHODS \
205     IUnknown_IMETHODS \
206     IDataAdviseHolder_METHODS
207 ICOM_DEFINE(IDataAdviseHolder,IUnknown)
208 #undef ICOM_INTERFACE
209
210 /*** IUnknown methods ***/
211 #define IDataAdviseHolder_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
212 #define IDataAdviseHolder_AddRef(p)             ICOM_CALL (AddRef,p)
213 #define IDataAdviseHolder_Release(p)            ICOM_CALL (Release,p)
214 /*** IDataAdviseHolder methods ***/
215 #define IDataAdviseHolder_Advise(p,a,b,c,d,e)       ICOM_CALL5(Advise,p,a,b,c,d,e)
216 #define IDataAdviseHolder_Unadvise(p,a)             ICOM_CALL1(Unadvise,p,a)
217 #define IDataAdviseHolder_EnumAdvise(p,a)           ICOM_CALL1(EnumAdvise,p,a)
218 #define IDataAdviseHolder_SendOnDataChange(p,a,b,c) ICOM_CALL3(SendOnDataChange,p,a,b,c)
219
220 /* FIXME: not implemented */
221 HRESULT WINAPI CreateDataAdviseHolder(LPDATAADVISEHOLDER* ppDAHolder);
222
223
224 /*****************************************************************************
225  * IDataObject interface
226  */
227 #define ICOM_INTERFACE IDataObject
228 #define IDataObject_METHODS \
229     ICOM_METHOD2(HRESULT,GetData,               LPFORMATETC,pformatetcIn, STGMEDIUM*,pmedium) \
230     ICOM_METHOD2(HRESULT,GetDataHere,           LPFORMATETC,pformatetc, STGMEDIUM*,pmedium) \
231     ICOM_METHOD1(HRESULT,QueryGetData,          LPFORMATETC,pformatetc) \
232     ICOM_METHOD2(HRESULT,GetCanonicalFormatEtc, LPFORMATETC,pformatectIn, LPFORMATETC,pformatetcOut) \
233     ICOM_METHOD3(HRESULT,SetData,               LPFORMATETC,pformatetc, STGMEDIUM*,pmedium, BOOL,fRelease) \
234     ICOM_METHOD2(HRESULT,EnumFormatEtc,         DWORD,dwDirection, IEnumFORMATETC**,ppenumFormatEtc) \
235     ICOM_METHOD4(HRESULT,DAdvise,               FORMATETC*,pformatetc, DWORD,advf, IAdviseSink*,pAdvSink, DWORD*,pdwConnection) \
236     ICOM_METHOD1(HRESULT,DUnadvise,             DWORD,dwConnection) \
237     ICOM_METHOD1(HRESULT,EnumDAdvise,           IEnumSTATDATA**,ppenumAdvise)
238 #define IDataObject_IMETHODS \
239     IUnknown_IMETHODS \
240     IDataObject_METHODS
241 ICOM_DEFINE(IDataObject,IUnknown)
242 #undef ICOM_INTERFACE
243
244 /*** IUnknown methods ***/
245 #define IDataObject_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
246 #define IDataObject_AddRef(p)             ICOM_CALL (AddRef,p)
247 #define IDataObject_Release(p)            ICOM_CALL (Release,p)
248 /*** IDataObject methods ***/
249 #define IDataObject_GetData(p,a,b)               ICOM_CALL2(GetData,p,a,b)
250 #define IDataObject_GetDataHere(p,a,b)           ICOM_CALL2(GetDataHere,p,a,b)
251 #define IDataObject_QueryGetData(p,a)            ICOM_CALL1(QueryGetData,p,a)
252 #define IDataObject_GetCanonicalFormatEtc(p,a,b) ICOM_CALL2(GetCanonicalFormatEtc,p,a,b)
253 #define IDataObject_SetData(p,a,b,c)             ICOM_CALL3(SetData,p,a,b,c)
254 #define IDataObject_EnumFormatEtc(p,a,b)         ICOM_CALL2(EnumFormatEtc,p,a,b)
255 #define IDataObject_DAdvise(p,a,b,c,d)           ICOM_CALL4(DAdvise,p,a,b,c,d)
256 #define IDataObject_DUnadvise(p,a)               ICOM_CALL1(DUnadvise,p,a)
257 #define IDataObject_EnumDAdvise(p,a)             ICOM_CALL1(EnumDAdvise,p,a)
258
259
260 /*****************************************************************************
261  * IEnumFORMATETC interface
262  */
263 #define ICOM_INTERFACE IEnumFORMATETC
264 #define IEnumFORMATETC_METHODS \
265     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, FORMATETC*,rgelt, ULONG*,pceltFethed) \
266     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
267     ICOM_METHOD (HRESULT,Reset) \
268     ICOM_METHOD1(HRESULT,Clone, IEnumFORMATETC**,ppenum)
269 #define IEnumFORMATETC_IMETHODS \
270     IUnknown_IMETHODS \
271     IEnumFORMATETC_METHODS
272 ICOM_DEFINE(IEnumFORMATETC,IUnknown)
273 #undef ICOM_INTERFACE
274
275 /*** IUnknown methods ***/
276 #define IEnumFORMATETC_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
277 #define IEnumFORMATETC_AddRef(p)             ICOM_CALL (AddRef,p)
278 #define IEnumFORMATETC_Release(p)            ICOM_CALL (Release,p)
279 /*** IEnumFORMATETC methods ***/
280 #define IEnumFORMATETC_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
281 #define IEnumFORMATETC_Skip(p,a)     ICOM_CALL1(Skip,p,a)
282 #define IEnumFORMATETC_Reset(p)      ICOM_CALL (Reset,p)
283 #define IEnumFORMATETC_Clone(p,a)    ICOM_CALL1(Clone,p,a)
284
285
286 /*****************************************************************************
287  * IEnumSTATDATA interface
288  */
289 #define ICOM_INTERFACE IEnumSTATDATA
290 #define IEnumSTATDATA_METHODS \
291     ICOM_METHOD3(HRESULT,Next,  ULONG,celt, STATDATA*,rgelt, ULONG*,pceltFethed) \
292     ICOM_METHOD1(HRESULT,Skip,  ULONG,celt) \
293     ICOM_METHOD (HRESULT,Reset) \
294     ICOM_METHOD1(HRESULT,Clone, IEnumSTATDATA**,ppenum)
295 #define IEnumSTATDATA_IMETHODS \
296     IUnknown_IMETHODS \
297     IEnumSTATDATA_METHODS
298 ICOM_DEFINE(IEnumSTATDATA,IUnknown)
299 #undef ICOM_INTERFACE
300
301 /*** IUnknown methods ***/
302 #define IEnumSTATDATA_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b)
303 #define IEnumSTATDATA_AddRef(p)             ICOM_CALL (AddRef,p)
304 #define IEnumSTATDATA_Release(p)            ICOM_CALL (Release,p)
305 /*** IEnumSTATDATA methods ***/
306 #define IEnumSTATDATA_Next(p,a,b,c) ICOM_CALL3(Next,p,a,b,c)
307 #define IEnumSTATDATA_Skip(p,a)     ICOM_CALL1(Skip,p,a)
308 #define IEnumSTATDATA_Reset(p)      ICOM_CALL (Reset,p)
309 #define IEnumSTATDATA_Clone(p,a)    ICOM_CALL1(Clone,p,a)
310
311
312 /*****************************************************************************
313  * Additional API
314  */
315
316 /* FIXME: not implemented */
317 HRESULT WINAPI CreateDataCache(LPUNKNOWN pUnkOuter, REFCLSID rclsid, REFIID iid, LPVOID* ppv);
318
319 #ifdef __cplusplus
320 } /* extern "C"  */
321 #endif /* defined(__cplusplus) */
322
323 #endif /* __WINE_WINE_OBJ_DATAOBJECT_H */