shell32: Fallback to IShellDetails while filling shell view columns if IShellFolder2 is missed.

This commit is contained in:
Nikolay Sivov 2010-04-18 18:51:45 +04:00 committed by Alexandre Julliard
parent 1b31b377b6
commit 066063541d
2 changed files with 45 additions and 16 deletions

View File

@ -389,40 +389,47 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
*/
static void ShellView_InitList(IShellViewImpl *This)
{
IShellDetails *details = NULL;
LVCOLUMNW lvColumn;
SHELLDETAILS sd;
WCHAR nameW[50];
HRESULT hr;
INT i;
TRACE("(%p)\n", This);
SendMessageW(This->hWndList, LVM_DELETEALLITEMS, 0, 0);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
lvColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT;
lvColumn.pszText = nameW;
if (This->pSF2Parent)
if (!This->pSF2Parent)
{
HRESULT hr;
INT i;
for (i = 0; 1; i++)
hr = IShellFolder_QueryInterface(This->pSFParent, &IID_IShellDetails, (void**)&details);
if (hr != S_OK)
{
hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
if (FAILED(hr)) break;
lvColumn.fmt = sd.fmt;
lvColumn.cx = sd.cxChar*8; /* chars->pixel */
StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
WARN("IShellFolder2/IShellDetails not supported\n");
return;
}
}
else
for (i = 0; 1; i++)
{
FIXME("no SF2\n");
if (This->pSFParent)
hr = IShellFolder2_GetDetailsOf(This->pSF2Parent, NULL, i, &sd);
else
hr = IShellDetails_GetDetailsOf(details, NULL, i, &sd);
if (FAILED(hr)) break;
lvColumn.fmt = sd.fmt;
lvColumn.cx = sd.cxChar*8; /* chars->pixel */
StrRetToStrNW(nameW, sizeof(nameW)/sizeof(WCHAR), &sd.str, NULL);
SendMessageW(This->hWndList, LVM_INSERTCOLUMNW, i, (LPARAM) &lvColumn);
}
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_SMALL, (LPARAM)ShellSmallIconList);
SendMessageW(This->hWndList, LVM_SETIMAGELIST, LVSIL_NORMAL, (LPARAM)ShellBigIconList);
if (details) IShellDetails_Release(details);
}
/**********************************************************

View File

@ -346,6 +346,28 @@ typedef struct
#define FCIDM_TOOLBAR (FCIDM_BROWSERFIRST + 0)
#define FCIDM_STATUS (FCIDM_BROWSERFIRST + 1)
#define INTERFACE IShellDetails
DECLARE_INTERFACE_(IShellDetails, IUnknown)
{
/*** IUnknown methods ***/
STDMETHOD_(HRESULT,QueryInterface) (THIS_ REFIID riid, void **ppv) PURE;
STDMETHOD_(ULONG,AddRef) (THIS) PURE;
STDMETHOD_(ULONG,Release) (THIS) PURE;
/*** IShellDetails methods ***/
STDMETHOD(GetDetailsOf)(THIS_ PCUITEMID_CHILD pidl, UINT iColumn, SHELLDETAILS *pDetails) PURE;
STDMETHOD(ColumnClick)(THIS_ UINT iColumn) PURE;
};
#undef INTERFACE
#if !defined(__cplusplus) || defined(CINTERFACE)
/*** IUnknown methods ***/
#define IShellDetails_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b)
#define IShellDetails_AddRef(p) (p)->lpVtbl->AddRef(p)
#define IShellDetails_Release(p) (p)->lpVtbl->Release(p)
/*** IShellDetails methods ***/
#define IShellDetails_GetDetailsOf(p,a,b,c) (p)->lpVtbl->GetDetailsOf(p,a,b,c)
#define IShellDetails_ColumnClick(p,a) (p)->lpVtbl->ColumnClick(p,a)
#endif
/****************************************************************************
* IShellIcon interface