diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 633d767f4e0..cd0fb3bf12d 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -86,6 +86,7 @@ typedef struct const IDropSourceVtbl* lpvtblDropSource; const IViewObjectVtbl* lpvtblViewObject; const IFolderViewVtbl* lpvtblFolderView; + const IShellFolderViewVtbl *lpvtblShellFolderView; IShellFolder* pSFParent; IShellFolder2* pSF2Parent; IShellBrowser* pShellBrowser; @@ -117,6 +118,7 @@ static const IDropTargetVtbl dtvt; static const IDropSourceVtbl dsvt; static const IViewObjectVtbl vovt; static const IFolderViewVtbl fviewvt; +static const IShellFolderViewVtbl shellfolderviewvt; static inline IShellViewImpl *impl_from_IOleCommandTarget( IOleCommandTarget *iface ) { @@ -143,6 +145,11 @@ static inline IShellViewImpl *impl_from_IFolderView( IFolderView *iface ) return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblFolderView)); } +static inline IShellViewImpl *impl_from_IShellFolderView( IShellFolderView *iface ) +{ + return (IShellViewImpl *)((char*)iface - FIELD_OFFSET(IShellViewImpl, lpvtblShellFolderView)); +} + /* ListView Header ID's */ #define LISTVIEW_COLUMN_NAME 0 #define LISTVIEW_COLUMN_SIZE 1 @@ -200,6 +207,7 @@ IShellView * IShellView_Constructor( IShellFolder * pFolder) sv->lpvtblDropSource=&dsvt; sv->lpvtblViewObject=&vovt; sv->lpvtblFolderView=&fviewvt; + sv->lpvtblShellFolderView=&shellfolderviewvt; sv->pSFParent = pFolder; if(pFolder) IShellFolder_AddRef(pFolder); @@ -1705,6 +1713,10 @@ static HRESULT WINAPI IShellView_fnQueryInterface(IShellView2 * iface,REFIID rii { *ppvObj = This; } + else if(IsEqualIID(riid, &IID_IShellFolderView)) + { + *ppvObj = &This->lpvtblShellFolderView; + } else if(IsEqualIID(riid, &IID_IFolderView)) { *ppvObj = &This->lpvtblFolderView; @@ -2895,3 +2907,316 @@ static const IFolderViewVtbl fviewvt = IFView_SelectItem, IFView_SelectAndPositionItems }; + +/* IShellFolderView */ +static HRESULT WINAPI IShellFolderView_fnQueryInterface( + IShellFolderView *iface, + REFIID riid, + LPVOID *ppvObj) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + TRACE("(%p)->(IID:%s,%p)\n", This, debugstr_guid(riid), ppvObj); + return IShellView2_QueryInterface((IShellView2*)This, riid, ppvObj); +} + +static ULONG WINAPI IShellFolderView_fnAddRef(IShellFolderView *iface) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + TRACE("(%p)->(count=%u)\n", This, This->ref); + return IShellView2_AddRef((IShellView2*)This); +} + +static ULONG WINAPI IShellFolderView_fnRelease(IShellFolderView *iface) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + TRACE("(%p)->(count=%u)\n", This, This->ref); + return IShellView2_Release((IShellView2*)This); +} + +static HRESULT WINAPI IShellFolderView_fnRearrange(IShellFolderView *iface, LPARAM sort) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%ld) stub\n", This, sort); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetArrangeParam(IShellFolderView *iface, LPARAM *sort) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, sort); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnArrangeGrid(IShellFolderView *iface) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p) stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnAutoArrange(IShellFolderView *iface) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p) stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetAutoArrange(IShellFolderView *iface) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p) stub\n", This); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnAddObject( + IShellFolderView *iface, + PITEMID_CHILD pidl, + UINT *item) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %p) stub\n", This, pidl, item); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetObject( + IShellFolderView *iface, + PITEMID_CHILD *pidl, + UINT item) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %d) stub\n", This, pidl, item); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnRemoveObject( + IShellFolderView *iface, + PITEMID_CHILD pidl, + UINT *item) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %p) stub\n", This, pidl, item); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetObjectCount( + IShellFolderView *iface, + UINT *count) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSetObjectCount( + IShellFolderView *iface, + UINT count, + UINT flags) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%d %x) stub\n", This, count, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnUpdateObject( + IShellFolderView *iface, + PITEMID_CHILD pidl_old, + PITEMID_CHILD pidl_new, + UINT *item) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %p %p) stub\n", This, pidl_old, pidl_new, item); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnRefreshObject( + IShellFolderView *iface, + PITEMID_CHILD pidl, + UINT *item) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %p) stub\n", This, pidl, item); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSetRedraw( + IShellFolderView *iface, + BOOL redraw) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%d) stub\n", This, redraw); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetSelectedCount( + IShellFolderView *iface, + UINT *count) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, count); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetSelectedObjects( + IShellFolderView *iface, + PCITEMID_CHILD **pidl, + UINT *items) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %p) stub\n", This, pidl, items); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnIsDropOnSource( + IShellFolderView *iface, + IDropTarget *drop_target) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, drop_target); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetDragPoint( + IShellFolderView *iface, + POINT *pt) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, pt); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetDropPoint( + IShellFolderView *iface, + POINT *pt) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, pt); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnMoveIcons( + IShellFolderView *iface, + IDataObject *obj) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, obj); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSetItemPos( + IShellFolderView *iface, + PCUITEMID_CHILD pidl, + POINT *pt) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %p) stub\n", This, pidl, pt); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnIsBkDropTarget( + IShellFolderView *iface, + IDropTarget *drop_target) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, drop_target); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSetClipboard( + IShellFolderView *iface, + BOOL move) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%d) stub\n", This, move); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSetPoints( + IShellFolderView *iface, + IDataObject *obj) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, obj); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnGetItemSpacing( + IShellFolderView *iface, + ITEMSPACING *spacing) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, spacing); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSetCallback( + IShellFolderView *iface, + IShellFolderViewCB *new_cb, + IShellFolderViewCB **old_cb) + +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p %p) stub\n", This, new_cb, old_cb); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSelect( + IShellFolderView *iface, + UINT flags) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%d) stub\n", This, flags); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnQuerySupport( + IShellFolderView *iface, + UINT *support) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, support); + return E_NOTIMPL; +} + +static HRESULT WINAPI IShellFolderView_fnSetAutomationObject( + IShellFolderView *iface, + IDispatch *disp) +{ + IShellViewImpl *This = impl_from_IShellFolderView(iface); + FIXME("(%p)->(%p) stub\n", This, disp); + return E_NOTIMPL; +} + +static const IShellFolderViewVtbl shellfolderviewvt = +{ + IShellFolderView_fnQueryInterface, + IShellFolderView_fnAddRef, + IShellFolderView_fnRelease, + IShellFolderView_fnRearrange, + IShellFolderView_fnGetArrangeParam, + IShellFolderView_fnArrangeGrid, + IShellFolderView_fnAutoArrange, + IShellFolderView_fnGetAutoArrange, + IShellFolderView_fnAddObject, + IShellFolderView_fnGetObject, + IShellFolderView_fnRemoveObject, + IShellFolderView_fnGetObjectCount, + IShellFolderView_fnSetObjectCount, + IShellFolderView_fnUpdateObject, + IShellFolderView_fnRefreshObject, + IShellFolderView_fnSetRedraw, + IShellFolderView_fnGetSelectedCount, + IShellFolderView_fnGetSelectedObjects, + IShellFolderView_fnIsDropOnSource, + IShellFolderView_fnGetDragPoint, + IShellFolderView_fnGetDropPoint, + IShellFolderView_fnMoveIcons, + IShellFolderView_fnSetItemPos, + IShellFolderView_fnIsBkDropTarget, + IShellFolderView_fnSetClipboard, + IShellFolderView_fnSetPoints, + IShellFolderView_fnGetItemSpacing, + IShellFolderView_fnSetCallback, + IShellFolderView_fnSelect, + IShellFolderView_fnQuerySupport, + IShellFolderView_fnSetAutomationObject +}; diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c index e941ff49b6e..50853d4be64 100644 --- a/dlls/shell32/tests/shlview.c +++ b/dlls/shell32/tests/shlview.c @@ -542,6 +542,34 @@ static void test_GetItemObject(void) IShellFolder_Release(desktop); } +static void test_IShellFolderView(void) +{ + IShellFolderView *folderview; + IShellFolder *desktop; + IShellView *view; + HRESULT hr; + + hr = SHGetDesktopFolder(&desktop); + ok(hr == S_OK, "got (0x%08x)\n", hr); + + hr = IShellFolder_CreateViewObject(desktop, NULL, &IID_IShellView, (void**)&view); + ok(hr == S_OK, "got (0x%08x)\n", hr); + + hr = IShellView_QueryInterface(view, &IID_IShellFolderView, (void**)&folderview); + if (hr != S_OK) + { + win_skip("IShellView doesn't provide IShellFolderView on this platform\n"); + IShellView_Release(view); + IShellFolder_Release(desktop); + return; + } + + IShellFolderView_Release(folderview); + + IShellView_Release(view); + IShellFolder_Release(desktop); +} + START_TEST(shlview) { OleInitialize(NULL); @@ -551,6 +579,7 @@ START_TEST(shlview) test_IShellView_CreateViewWindow(); test_IFolderView(); test_GetItemObject(); + test_IShellFolderView(); OleUninitialize(); } diff --git a/include/shlobj.h b/include/shlobj.h index 171cf3b838a..9f87a0a8827 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -24,6 +24,10 @@ #include #include +#ifdef WINE_NO_UNICODE_MACROS +#undef GetObject +#endif + #ifdef __cplusplus extern "C" { #endif /* defined(__cplusplus) */ @@ -539,6 +543,95 @@ DECLARE_INTERFACE_(IShellFolderViewCB,IUnknown) #define IShellFolderViewCB_MessageSFVCB(p,a,b,c) (p)->lpVtbl->MessageSFVCB(p,a,b,c) #endif +/**************************************************************************** + * IShellFolderView interface + */ + +typedef struct _ITEMSPACING +{ + int cxSmall; + int cySmall; + int cxLarge; + int cyLarge; +} ITEMSPACING; + +#define INTERFACE IShellFolderView +DEFINE_GUID(IID_IShellFolderView,0x37a378c0,0xf82d,0x11ce,0xae,0x65,0x08,0x00,0x2b,0x2e,0x12,0x62); +DECLARE_INTERFACE_(IShellFolderView, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface) (THIS_ REFIID riid, void **ppv) PURE; + STDMETHOD_(ULONG,AddRef) (THIS) PURE; + STDMETHOD_(ULONG,Release) (THIS) PURE; + + /*** IShellFolderView methods ***/ + STDMETHOD(Rearrange) (THIS_ LPARAM lParamSort) PURE; + STDMETHOD(GetArrangeParam) (THIS_ LPARAM *plParamSort) PURE; + STDMETHOD(ArrangeGrid) (THIS) PURE; + STDMETHOD(AutoArrange) (THIS) PURE; + STDMETHOD(GetAutoArrange) (THIS) PURE; + STDMETHOD(AddObject) (THIS_ PITEMID_CHILD pidl, UINT *puItem) PURE; + STDMETHOD(GetObject) (THIS_ PITEMID_CHILD *ppidl, UINT uItem) PURE; + STDMETHOD(RemoveObject) (THIS_ PITEMID_CHILD pidl, UINT *puItem) PURE; + STDMETHOD(GetObjectCount) (THIS_ UINT *puCount) PURE; + STDMETHOD(SetObjectCount) (THIS_ UINT uCount, UINT dwFlags) PURE; + STDMETHOD(UpdateObject) (THIS_ PITEMID_CHILD pidlOld, PITEMID_CHILD pidlNew, UINT *puItem) PURE; + STDMETHOD(RefreshObject) (THIS_ PITEMID_CHILD pidl, UINT *puItem) PURE; + STDMETHOD(SetRedraw) (THIS_ BOOL bRedraw) PURE; + STDMETHOD(GetSelectedCount) (THIS_ UINT *puSelected) PURE; + STDMETHOD(GetSelectedObjects) (THIS_ PCITEMID_CHILD **pppidl, UINT *puItems) PURE; + STDMETHOD(IsDropOnSource) (THIS_ IDropTarget *pDropTarget) PURE; + STDMETHOD(GetDragPoint) (THIS_ POINT *ppt) PURE; + STDMETHOD(GetDropPoint) (THIS_ POINT *ppt) PURE; + STDMETHOD(MoveIcons) (THIS_ IDataObject *pDataObject) PURE; + STDMETHOD(SetItemPos) (THIS_ PCUITEMID_CHILD pidl, POINT *ppt) PURE; + STDMETHOD(IsBkDropTarget) (THIS_ IDropTarget *pDropTarget) PURE; + STDMETHOD(SetClipboard) (THIS_ BOOL bMove) PURE; + STDMETHOD(SetPoints) (THIS_ IDataObject *pDataObject) PURE; + STDMETHOD(GetItemSpacing) (THIS_ ITEMSPACING *pSpacing) PURE; + STDMETHOD(SetCallback) (THIS_ IShellFolderViewCB* pNewCB, IShellFolderViewCB** ppOldCB) PURE; + STDMETHOD(Select) ( THIS_ UINT dwFlags ) PURE; + STDMETHOD(QuerySupport) (THIS_ UINT * pdwSupport ) PURE; + STDMETHOD(SetAutomationObject)(THIS_ IDispatch* pdisp) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IShellFolderView_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IShellFolderView_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IShellFolderView_Release(p) (p)->lpVtbl->Release(p) +/*** IShellFolderView methods ***/ +#define IShellFolderView_Rearrange(p,a) (p)->lpVtbl->Rearrange(p,a) +#define IShellFolderView_GetArrangeParam(p,a) (p)->lpVtbl->GetArrangeParam(p,a) +#define IShellFolderView_ArrangeGrid(p) (p)->lpVtbl->ArrangeGrid(p) +#define IShellFolderView_AutoArrange(p) (p)->lpVtbl->AutoArrange(p) +#define IShellFolderView_GetAutoArrange(p) (p)->lpVtbl->GetAutoArrange(p) +#define IShellFolderView_AddObject(p,a,b) (p)->lpVtbl->AddObject(p,a,b) +#define IShellFolderView_GetObject(p,a,b) (p)->lpVtbl->GetObject(p,a,b) +#define IShellFolderView_RemoveObject(p,a,b) (p)->lpVtbl->RemoveObject(p,a,b) +#define IShellFolderView_GetObjectCount(p,a) (p)->lpVtbl->GetObjectCount(p,a) +#define IShellFolderView_SetObjectCount(p,a,b) (p)->lpVtbl->SetObjectCount(p,a,b) +#define IShellFolderView_UpdateObject(p,a,b,c) (p)->lpVtbl->UpdateObject(p,a,b,c) +#define IShellFolderView_RefreshObject(p,a,b) (p)->lpVtbl->RefreshObject(p,a,b) +#define IShellFolderView_SetRedraw(p,a) (p)->lpVtbl->SetRedraw(p,a) +#define IShellFolderView_GetSelectedCount(p,a) (p)->lpVtbl->GetSelectedCount(p,a) +#define IShellFolderView_GetSelectedObjects(p,a,b) (p)->lpVtbl->GetSelectedObjects(p,a,b) +#define IShellFolderView_IsDropOnSource(p,a) (p)->lpVtbl->IsDropOnSource(p,a) +#define IShellFolderView_GetDragPoint(p,a) (p)->lpVtbl->GetDragPoint(p,a) +#define IShellFolderView_GetDropPoint(p,a) (p)->lpVtbl->GetDropPoint(p,a) +#define IShellFolderView_MoveIcons(p,a) (p)->lpVtbl->MoveIcons(p,a) +#define IShellFolderView_SetItemPos(p,a,b) (p)->lpVtbl->SetItemPos(p,a,b) +#define IShellFolderView_DropTarget(p,a) (p)->lpVtbl->DropTarget(p,a) +#define IShellFolderView_SetClipboard(p,a) (p)->lpVtbl->SetClipboard(p,a) +#define IShellFolderView_SetPoints(p,a) (p)->lpVtbl->SetPoints(p,a) +#define IShellFolderView_GetItemSpacing(p,a) (p)->lpVtbl->GetItemSpacing(p,a) +#define IShellFolderView_SetCallback(p,a) (p)->lpVtbl->SetCallback(p,a) +#define IShellFolderView_Select(p,a) (p)->lpVtbl->Select(p,a) +#define IShellFolderView_QuerySupport(p,a) (p)->lpVtbl->QuerySupport(p,a) +#define IShellFolderView_SetAutomationObject(p,a) (p)->lpVtbl->SetAutomationObject(p,a) +#endif + /* IProgressDialog interface */ #define PROGDLG_NORMAL 0x00000000 #define PROGDLG_MODAL 0x00000001 diff --git a/include/shtypes.idl b/include/shtypes.idl index 021d4671251..dd908e3c7eb 100644 --- a/include/shtypes.idl +++ b/include/shtypes.idl @@ -35,6 +35,7 @@ typedef struct _ITEMIDLIST } ITEMIDLIST,*LPITEMIDLIST; typedef const ITEMIDLIST *LPCITEMIDLIST; typedef LPITEMIDLIST PITEMID_CHILD; +typedef const PITEMID_CHILD PCITEMID_CHILD; typedef LPCITEMIDLIST PCUITEMID_CHILD; typedef LPCITEMIDLIST *PCUITEMID_CHILD_ARRAY; cpp_quote("#include ")