move more dlls
[reactos.git] / reactos / dll / ddraw / winedraw.h
1 /*
2 * Copyright 2000-2001 TransGaming Technologies Inc.
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 */
18 #ifndef _DDCOMIMPL_H_
19 #define _DDCOMIMPL_H_
20
21 #include <stddef.h>
22
23 /* Generates the name for a vtable pointer for a given interface. */
24 /* The canonical name for a single interface is "lpVtbl". */
25 #define ICOM_VFIELD_MULTI_NAME2(iface) ITF_##iface
26 #define ICOM_VFIELD_MULTI_NAME(iface) ICOM_VFIELD_MULTI_NAME2(iface)
27
28 /* Declares a vtable pointer field in an implementation. */
29 #define ICOM_VFIELD_MULTI(iface) \
30 iface ICOM_VFIELD_MULTI_NAME(iface)
31
32 /* Returns the offset of a vtable pointer within an implementation object. */
33 #define ICOM_VFIELD_OFFSET(impltype, iface) \
34 offsetof(impltype, ICOM_VFIELD_MULTI_NAME(iface))
35
36 /* Given an interface pointer, returns the implementation pointer. */
37 #define ICOM_OBJECT(impltype, ifacename, ifaceptr) \
38 (impltype*)((ifaceptr) == NULL ? NULL \
39 : (char*)(ifaceptr) - ICOM_VFIELD_OFFSET(impltype,ifacename))
40
41 #define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
42 impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
43
44 /* Given an object and interface name, returns a pointer to that interface. */
45 #define ICOM_INTERFACE(implobj, iface) \
46 (&((implobj)->ICOM_VFIELD_MULTI_NAME(iface)))
47
48 #define ICOM_INIT_INTERFACE(implobj, ifacename, vtblname) \
49 do { \
50 (implobj)->ICOM_VFIELD_MULTI_NAME(ifacename).lpVtbl = &(vtblname); \
51 } while (0)
52
53 #define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
54 ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
55
56 #endif /* _DDCOMIMPL_H_ */
57
58 #ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
59 #define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
60
61 /* MAY NOT CONTAIN X11 or DGA specific includes/defines/structs! */
62
63 #include <stdarg.h>
64 #include <stdio.h>
65
66 #include "windef.h"
67 #include "winbase.h"
68 #include "wtypes.h"
69 #include "wingdi.h"
70 #include "winuser.h"
71 #include "ddraw.h"
72 #include "d3d.h"
73 #include "ddrawi.h"
74
75 /*****************************************************************************
76 * IDirectDraw implementation structure
77 */
78
79 typedef struct IDirectDrawImpl IDirectDrawImpl;
80 typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
81
82 struct IDirectDrawImpl
83 {
84 ICOM_VFIELD_MULTI(IDirectDraw7);
85 ICOM_VFIELD_MULTI(IDirectDraw4);
86 ICOM_VFIELD_MULTI(IDirectDraw2);
87 ICOM_VFIELD_MULTI(IDirectDraw);
88 };
89
90 /*****************************************************************************
91 * IDirectDrawSurface implementation structure
92 */
93
94 struct IDirectDrawSurfaceImpl
95 {
96 /* IUnknown fields */
97 ICOM_VFIELD_MULTI(IDirectDrawSurface7);
98 ICOM_VFIELD_MULTI(IDirectDrawSurface3);
99 };
100
101 #endif /* __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H */