[PATCH 08/18] explorerframe: Use an iface instead of a vtbl pointer in NSTC2Impl.
Michael Stefaniuc
mstefani at redhat.de
Sun Nov 28 17:56:54 CST 2010
---
dlls/explorerframe/nstc.c | 61 ++++++++++++++++++++++++--------------------
1 files changed, 33 insertions(+), 28 deletions(-)
diff --git a/dlls/explorerframe/nstc.c b/dlls/explorerframe/nstc.c
index 6ae1458..9293a1a 100644
--- a/dlls/explorerframe/nstc.c
+++ b/dlls/explorerframe/nstc.c
@@ -47,7 +47,7 @@ typedef struct nstc_root {
} nstc_root;
typedef struct {
- const INameSpaceTreeControl2Vtbl *lpVtbl;
+ INameSpaceTreeControl2 INameSpaceTreeControl2_iface;
const IOleWindowVtbl *lpowVtbl;
LONG ref;
@@ -71,6 +71,11 @@ static const DWORD unsupported_styles2 =
NSTCS2_INTERRUPTNOTIFICATIONS | NSTCS2_SHOWNULLSPACEMENU | NSTCS2_DISPLAYPADDING |
NSTCS2_DISPLAYPINNEDONLY | NTSCS2_NOSINGLETONAUTOEXPAND | NTSCS2_NEVERINSERTNONENUMERATED;
+static inline NSTC2Impl *impl_from_INameSpaceTreeControl2(INameSpaceTreeControl2 *iface)
+{
+ return CONTAINING_RECORD(iface, NSTC2Impl, INameSpaceTreeControl2_iface);
+}
+
/* Forward declarations */
static LRESULT CALLBACK tv_wndproc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM lParam);
@@ -799,7 +804,7 @@ static HRESULT WINAPI NSTC2_fnQueryInterface(INameSpaceTreeControl2* iface,
REFIID riid,
void **ppvObject)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
TRACE("%p (%s, %p)\n", This, debugstr_guid(riid), ppvObject);
*ppvObject = NULL;
@@ -825,7 +830,7 @@ static HRESULT WINAPI NSTC2_fnQueryInterface(INameSpaceTreeControl2* iface,
static ULONG WINAPI NSTC2_fnAddRef(INameSpaceTreeControl2* iface)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("%p - ref %d\n", This, ref);
@@ -835,7 +840,7 @@ static ULONG WINAPI NSTC2_fnAddRef(INameSpaceTreeControl2* iface)
static ULONG WINAPI NSTC2_fnRelease(INameSpaceTreeControl2* iface)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("%p - ref: %d\n", This, ref);
@@ -856,7 +861,7 @@ static HRESULT WINAPI NSTC2_fnInitialize(INameSpaceTreeControl2* iface,
RECT *prc,
NSTCSTYLE nstcsFlags)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
WNDCLASSW wc;
DWORD window_style, window_ex_style;
RECT rc;
@@ -915,7 +920,7 @@ static HRESULT WINAPI NSTC2_fnTreeAdvise(INameSpaceTreeControl2* iface,
IUnknown *punk,
DWORD *pdwCookie)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
HRESULT hr;
TRACE("%p (%p, %p)\n", This, punk, pdwCookie);
@@ -938,7 +943,7 @@ static HRESULT WINAPI NSTC2_fnTreeAdvise(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnTreeUnadvise(INameSpaceTreeControl2* iface,
DWORD dwCookie)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
TRACE("%p (%x)\n", This, dwCookie);
/* The cookie is ignored. */
@@ -959,7 +964,7 @@ static HRESULT WINAPI NSTC2_fnInsertRoot(INameSpaceTreeControl2* iface,
NSTCROOTSTYLE grfRootStyle,
IShellItemFilter *pif)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
nstc_root *new_root;
struct list *add_after_entry;
HTREEITEM add_after_hitem;
@@ -1021,7 +1026,7 @@ static HRESULT WINAPI NSTC2_fnAppendRoot(INameSpaceTreeControl2* iface,
NSTCROOTSTYLE grfRootStyle,
IShellItemFilter *pif)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
UINT root_count;
TRACE("%p, %p, %x, %x, %p\n",
This, psiRoot, grfEnumFlags, grfRootStyle, pif);
@@ -1034,7 +1039,7 @@ static HRESULT WINAPI NSTC2_fnAppendRoot(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnRemoveRoot(INameSpaceTreeControl2* iface,
IShellItem *psiRoot)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
nstc_root *cursor, *root = NULL;
TRACE("%p (%p)\n", This, psiRoot);
@@ -1071,7 +1076,7 @@ static HRESULT WINAPI NSTC2_fnRemoveRoot(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnRemoveAllRoots(INameSpaceTreeControl2* iface)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
nstc_root *cur1, *cur2;
UINT removed = 0;
TRACE("%p\n", This);
@@ -1091,7 +1096,7 @@ static HRESULT WINAPI NSTC2_fnRemoveAllRoots(INameSpaceTreeControl2* iface)
static HRESULT WINAPI NSTC2_fnGetRootItems(INameSpaceTreeControl2* iface,
IShellItemArray **ppsiaRootItems)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
IShellFolder *psf;
LPITEMIDLIST *array;
nstc_root *root;
@@ -1128,7 +1133,7 @@ static HRESULT WINAPI NSTC2_fnSetItemState(INameSpaceTreeControl2* iface,
NSTCITEMSTATE nstcisMask,
NSTCITEMSTATE nstcisFlags)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
TVITEMEXW tvi;
HTREEITEM hitem;
@@ -1191,7 +1196,7 @@ static HRESULT WINAPI NSTC2_fnGetItemState(INameSpaceTreeControl2* iface,
NSTCITEMSTATE nstcisMask,
NSTCITEMSTATE *pnstcisFlags)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
HTREEITEM hitem;
TVITEMEXW tvi;
TRACE("%p (%p, %x, %p)\n", This, psi, nstcisMask, pnstcisFlags);
@@ -1223,7 +1228,7 @@ static HRESULT WINAPI NSTC2_fnGetItemState(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnGetSelectedItems(INameSpaceTreeControl2* iface,
IShellItemArray **psiaItems)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
IShellItem *psiselected;
HRESULT hr;
TRACE("%p (%p)\n", This, psiaItems);
@@ -1241,7 +1246,7 @@ static HRESULT WINAPI NSTC2_fnGetItemCustomState(INameSpaceTreeControl2* iface,
IShellItem *psi,
int *piStateNumber)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
FIXME("stub, %p (%p, %p)\n", This, psi, piStateNumber);
return E_NOTIMPL;
}
@@ -1250,7 +1255,7 @@ static HRESULT WINAPI NSTC2_fnSetItemCustomState(INameSpaceTreeControl2* iface,
IShellItem *psi,
int iStateNumber)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
FIXME("stub, %p (%p, %d)\n", This, psi, iStateNumber);
return E_NOTIMPL;
}
@@ -1258,7 +1263,7 @@ static HRESULT WINAPI NSTC2_fnSetItemCustomState(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnEnsureItemVisible(INameSpaceTreeControl2* iface,
IShellItem *psi)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
HTREEITEM hitem;
TRACE("%p (%p)\n", This, psi);
@@ -1276,7 +1281,7 @@ static HRESULT WINAPI NSTC2_fnEnsureItemVisible(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnSetTheme(INameSpaceTreeControl2* iface,
LPCWSTR pszTheme)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
FIXME("stub, %p (%p)\n", This, pszTheme);
return E_NOTIMPL;
}
@@ -1286,7 +1291,7 @@ static HRESULT WINAPI NSTC2_fnGetNextItem(INameSpaceTreeControl2* iface,
NSTCGNI nstcgi,
IShellItem **ppsiNext)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
HTREEITEM hitem, hnext;
UINT tvgn;
TRACE("%p (%p, %x, %p)\n", This, psi, nstcgi, ppsiNext);
@@ -1330,7 +1335,7 @@ static HRESULT WINAPI NSTC2_fnHitTest(INameSpaceTreeControl2* iface,
POINT *ppt,
IShellItem **ppsiOut)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
HTREEITEM hitem;
TRACE("%p (%p, %p)\n", This, ppsiOut, ppt);
@@ -1356,7 +1361,7 @@ static HRESULT WINAPI NSTC2_fnGetItemRect(INameSpaceTreeControl2* iface,
IShellItem *psi,
RECT *prect)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
HTREEITEM hitem;
TRACE("%p (%p, %p)\n", This, psi, prect);
@@ -1379,7 +1384,7 @@ static HRESULT WINAPI NSTC2_fnGetItemRect(INameSpaceTreeControl2* iface,
static HRESULT WINAPI NSTC2_fnCollapseAll(INameSpaceTreeControl2* iface)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
nstc_root *root;
TRACE("%p\n", This);
@@ -1393,7 +1398,7 @@ static HRESULT WINAPI NSTC2_fnSetControlStyle(INameSpaceTreeControl2* iface,
NSTCSTYLE nstcsMask,
NSTCSTYLE nstcsStyle)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
static const DWORD tv_style_flags =
NSTCS_HASEXPANDOS | NSTCS_HASLINES | NSTCS_FULLROWSELECT |
NSTCS_HORIZONTALSCROLL | NSTCS_ROOTHASEXPANDO |
@@ -1448,7 +1453,7 @@ static HRESULT WINAPI NSTC2_fnGetControlStyle(INameSpaceTreeControl2* iface,
NSTCSTYLE nstcsMask,
NSTCSTYLE *pnstcsStyle)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
TRACE("%p (%x, %p)\n", This, nstcsMask, pnstcsStyle);
*pnstcsStyle = (This->style & nstcsMask);
@@ -1460,7 +1465,7 @@ static HRESULT WINAPI NSTC2_fnSetControlStyle2(INameSpaceTreeControl2* iface,
NSTCSTYLE2 nstcsMask,
NSTCSTYLE2 nstcsStyle)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
TRACE("%p (%x, %x)\n", This, nstcsMask, nstcsStyle);
if((nstcsStyle & nstcsMask) & unsupported_styles2)
@@ -1478,7 +1483,7 @@ static HRESULT WINAPI NSTC2_fnGetControlStyle2(INameSpaceTreeControl2* iface,
NSTCSTYLE2 nstcsMask,
NSTCSTYLE2 *pnstcsStyle)
{
- NSTC2Impl *This = (NSTC2Impl*)iface;
+ NSTC2Impl *This = impl_from_INameSpaceTreeControl2(iface);
TRACE("%p (%x, %p)\n", This, nstcsMask, pnstcsStyle);
*pnstcsStyle = (This->style2 & nstcsMask);
@@ -1587,7 +1592,7 @@ HRESULT NamespaceTreeControl_Constructor(IUnknown *pUnkOuter, REFIID riid, void
nstc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(NSTC2Impl));
nstc->ref = 1;
- nstc->lpVtbl = &vt_INameSpaceTreeControl2;
+ nstc->INameSpaceTreeControl2_iface.lpVtbl = &vt_INameSpaceTreeControl2;
nstc->lpowVtbl = &vt_IOleWindow;
list_init(&nstc->roots);
--
1.7.3.2
More information about the wine-patches
mailing list