shell32: Add IPersistIDList interface to ShellItem objects.

This commit is contained in:
Vincent Povirk 2009-02-13 16:34:42 -06:00 committed by Alexandre Julliard
parent a5c22d0070
commit 4438092960
1 changed files with 76 additions and 0 deletions

View File

@ -42,9 +42,16 @@ typedef struct _ShellItem {
const IShellItemVtbl *lpIShellItemVtbl; const IShellItemVtbl *lpIShellItemVtbl;
LONG ref; LONG ref;
LPITEMIDLIST pidl; LPITEMIDLIST pidl;
const IPersistIDListVtbl *lpIPersistIDListVtbl;
} ShellItem; } ShellItem;
static inline ShellItem *impl_from_IPersistIDList( IPersistIDList *iface )
{
return (ShellItem*)((char*)iface - FIELD_OFFSET(ShellItem, lpIPersistIDListVtbl));
}
static HRESULT WINAPI ShellItem_QueryInterface(IShellItem *iface, REFIID riid, static HRESULT WINAPI ShellItem_QueryInterface(IShellItem *iface, REFIID riid,
void **ppv) void **ppv)
{ {
@ -58,6 +65,10 @@ static HRESULT WINAPI ShellItem_QueryInterface(IShellItem *iface, REFIID riid,
{ {
*ppv = This; *ppv = This;
} }
else if (IsEqualIID(&IID_IPersist, riid) || IsEqualIID(&IID_IPersistIDList, riid))
{
*ppv = &(This->lpIPersistIDListVtbl);
}
else { else {
FIXME("not implemented for %s\n", shdebugstr_guid(riid)); FIXME("not implemented for %s\n", shdebugstr_guid(riid));
*ppv = NULL; *ppv = NULL;
@ -153,6 +164,70 @@ static const IShellItemVtbl ShellItem_Vtbl = {
}; };
static HRESULT WINAPI ShellItem_GetClassID(ShellItem* This, CLSID *pClassID)
{
TRACE("(%p,%p)\n", This, pClassID);
*pClassID = CLSID_ShellItem;
return S_OK;
}
static HRESULT WINAPI ShellItem_IPersistIDList_QueryInterface(IPersistIDList *iface,
REFIID riid, void **ppv)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_QueryInterface((IShellItem*)This, riid, ppv);
}
static ULONG WINAPI ShellItem_IPersistIDList_AddRef(IPersistIDList *iface)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_AddRef((IShellItem*)This);
}
static ULONG WINAPI ShellItem_IPersistIDList_Release(IPersistIDList *iface)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_Release((IShellItem*)This);
}
static HRESULT WINAPI ShellItem_IPersistIDList_GetClassID(IPersistIDList* iface,
CLSID *pClassID)
{
ShellItem *This = impl_from_IPersistIDList(iface);
return ShellItem_GetClassID(This, pClassID);
}
static HRESULT WINAPI ShellItem_IPersistIDList_SetIDList(IPersistIDList* iface,
LPCITEMIDLIST pidl)
{
ShellItem *This = impl_from_IPersistIDList(iface);
FIXME("(%p,%p)\n", This, pidl);
return E_NOTIMPL;
}
static HRESULT WINAPI ShellItem_IPersistIDList_GetIDList(IPersistIDList* iface,
LPITEMIDLIST *ppidl)
{
ShellItem *This = impl_from_IPersistIDList(iface);
FIXME("(%p,%p)\n", This, ppidl);
return E_NOTIMPL;
}
static const IPersistIDListVtbl ShellItem_IPersistIDList_Vtbl = {
ShellItem_IPersistIDList_QueryInterface,
ShellItem_IPersistIDList_AddRef,
ShellItem_IPersistIDList_Release,
ShellItem_IPersistIDList_GetClassID,
ShellItem_IPersistIDList_SetIDList,
ShellItem_IPersistIDList_GetIDList
};
HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv) HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **ppv)
{ {
ShellItem *This; ShellItem *This;
@ -168,6 +243,7 @@ HRESULT WINAPI IShellItem_Constructor(IUnknown *pUnkOuter, REFIID riid, void **p
This->lpIShellItemVtbl = &ShellItem_Vtbl; This->lpIShellItemVtbl = &ShellItem_Vtbl;
This->ref = 1; This->ref = 1;
This->pidl = NULL; This->pidl = NULL;
This->lpIPersistIDListVtbl = &ShellItem_IPersistIDList_Vtbl;
ret = ShellItem_QueryInterface((IShellItem*)This, riid, ppv); ret = ShellItem_QueryInterface((IShellItem*)This, riid, ppv);
ShellItem_Release((IShellItem*)This); ShellItem_Release((IShellItem*)This);