2 * Copyright 2000-2001 TransGaming Technologies Inc.
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.
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.
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
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)
28 /* Declares a vtable pointer field in an implementation. */
29 #define ICOM_VFIELD_MULTI(iface) \
30 iface ICOM_VFIELD_MULTI_NAME(iface)
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))
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))
41 #define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
42 impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
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)))
48 #define ICOM_INIT_INTERFACE(implobj, ifacename, vtblname) \
50 (implobj)->ICOM_VFIELD_MULTI_NAME(ifacename).lpVtbl = &(vtblname); \
53 #define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr) \
54 ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
56 #endif /* _DDCOMIMPL_H_ */
58 #ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
59 #define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
61 /* MAY NOT CONTAIN X11 or DGA specific includes/defines/structs! */
75 /*****************************************************************************
76 * IDirectDraw implementation structure
79 typedef struct IDirectDrawImpl IDirectDrawImpl
;
80 typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl
;
82 struct IDirectDrawImpl
84 ICOM_VFIELD_MULTI(IDirectDraw7
);
85 ICOM_VFIELD_MULTI(IDirectDraw4
);
86 ICOM_VFIELD_MULTI(IDirectDraw2
);
87 ICOM_VFIELD_MULTI(IDirectDraw
);
90 /*****************************************************************************
91 * IDirectDrawSurface implementation structure
94 struct IDirectDrawSurfaceImpl
97 ICOM_VFIELD_MULTI(IDirectDrawSurface7
);
98 ICOM_VFIELD_MULTI(IDirectDrawSurface3
);
101 #endif /* __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H */