Commit 0e7a5bf7 authored by David Hedberg's avatar David Hedberg Committed by Alexandre Julliard

shell32: Implement Set/GetCurrentViewMode in the default shellview.

parent 4291823f
...@@ -312,6 +312,29 @@ static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove) ...@@ -312,6 +312,29 @@ static void SetStyle(IShellViewImpl * This, DWORD dwAdd, DWORD dwRemove)
SetWindowLongW(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove)); SetWindowLongW(This->hWndList, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
} }
static DWORD ViewModeToListStyle(UINT ViewMode)
{
DWORD dwStyle;
TRACE("%d\n", ViewMode);
switch (ViewMode)
{
case FVM_ICON: dwStyle = LVS_ICON; break;
case FVM_DETAILS: dwStyle = LVS_REPORT; break;
case FVM_SMALLICON: dwStyle = LVS_SMALLICON; break;
case FVM_LIST: dwStyle = LVS_LIST; break;
default:
{
FIXME("ViewMode %d not implemented\n", ViewMode);
dwStyle = LVS_LIST;
break;
}
}
return dwStyle;
}
/********************************************************** /**********************************************************
* ShellView_CreateList() * ShellView_CreateList()
* *
...@@ -326,19 +349,7 @@ static BOOL ShellView_CreateList (IShellViewImpl * This) ...@@ -326,19 +349,7 @@ static BOOL ShellView_CreateList (IShellViewImpl * This)
LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE; LVS_SHAREIMAGELISTS | LVS_EDITLABELS | LVS_ALIGNLEFT | LVS_AUTOARRANGE;
dwExStyle = WS_EX_CLIENTEDGE; dwExStyle = WS_EX_CLIENTEDGE;
switch (This->FolderSettings.ViewMode) dwStyle |= ViewModeToListStyle(This->FolderSettings.ViewMode);
{
case FVM_ICON: dwStyle |= LVS_ICON; break;
case FVM_DETAILS: dwStyle |= LVS_REPORT; break;
case FVM_SMALLICON: dwStyle |= LVS_SMALLICON; break;
case FVM_LIST: dwStyle |= LVS_LIST; break;
default:
{
FIXME("ViewMode %d not implemented\n", This->FolderSettings.ViewMode);
dwStyle |= LVS_LIST;
break;
}
}
if (This->FolderSettings.fFlags & FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE; if (This->FolderSettings.fFlags & FWF_AUTOARRANGE) dwStyle |= LVS_AUTOARRANGE;
if (This->FolderSettings.fFlags & FWF_DESKTOP) if (This->FolderSettings.fFlags & FWF_DESKTOP)
...@@ -2733,15 +2744,37 @@ static ULONG WINAPI IFView_Release( IFolderView *iface) ...@@ -2733,15 +2744,37 @@ static ULONG WINAPI IFView_Release( IFolderView *iface)
static HRESULT WINAPI IFView_GetCurrentViewMode(IFolderView *iface, UINT *mode) static HRESULT WINAPI IFView_GetCurrentViewMode(IFolderView *iface, UINT *mode)
{ {
IShellViewImpl *This = impl_from_IFolderView(iface); IShellViewImpl *This = impl_from_IFolderView(iface);
FIXME("(%p)->(%p), stub\n", This, mode); TRACE("(%p)->(%p), stub\n", This, mode);
return E_NOTIMPL;
if(!mode)
return E_INVALIDARG;
*mode = This->FolderSettings.ViewMode;
return S_OK;
} }
static HRESULT WINAPI IFView_SetCurrentViewMode(IFolderView *iface, UINT mode) static HRESULT WINAPI IFView_SetCurrentViewMode(IFolderView *iface, UINT mode)
{ {
IShellViewImpl *This = impl_from_IFolderView(iface); IShellViewImpl *This = impl_from_IFolderView(iface);
FIXME("(%p)->(%u), stub\n", This, mode); DWORD dwStyle;
return E_NOTIMPL; TRACE("(%p)->(%u), stub\n", This, mode);
if((mode < FVM_FIRST || mode > FVM_LAST) &&
(mode != FVM_AUTO))
return E_INVALIDARG;
/* Windows before Vista uses LVM_SETVIEW and possibly
LVM_SETEXTENDEDLISTVIEWSTYLE to set the style of the listview,
while later versions seem to accomplish this through other
means. */
dwStyle = ViewModeToListStyle(mode);
SetStyle(This, dwStyle, LVS_TYPEMASK);
/* This will not necessarily be the actual mode set above.
This mimics the behavior of Windows XP. */
This->FolderSettings.ViewMode = mode;
return S_OK;
} }
static HRESULT WINAPI IFView_GetFolder(IFolderView *iface, REFIID riid, void **ppv) static HRESULT WINAPI IFView_GetFolder(IFolderView *iface, REFIID riid, void **ppv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment