https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c69ef281c07bac913c876…
commit c69ef281c07bac913c8761c3d4dba7f702e9f9ee
Author: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
AuthorDate: Mon Oct 22 23:51:37 2018 +0300
Commit: Giannis Adamopoulos <gadamopoulos(a)reactos.org>
CommitDate: Mon Oct 22 23:51:37 2018 +0300
[rosctrls.h] CListView: Add Arrange method
[SHELL32] CDefView: Start implementing Auto arrange.
So far its effect is only shown when the browser window resizes.
---
dll/win32/shell32/CDefView.cpp | 45 +++++++++++++++++++++---------------------
sdk/include/reactos/rosctrls.h | 6 ++++++
2 files changed, 29 insertions(+), 22 deletions(-)
diff --git a/dll/win32/shell32/CDefView.cpp b/dll/win32/shell32/CDefView.cpp
index cd2b91d41c..0032366568 100644
--- a/dll/win32/shell32/CDefView.cpp
+++ b/dll/win32/shell32/CDefView.cpp
@@ -125,7 +125,6 @@ class CDefView :
HRESULT OnStateChange(UINT uFlags);
void UpdateStatusbar();
void CheckToolbar();
- void SetStyle(DWORD dwAdd, DWORD dwRemove);
BOOL CreateList();
void UpdateListColors();
BOOL InitList();
@@ -500,18 +499,6 @@ void CDefView::UpdateStatusbar()
*
* ##### helperfunctions for initializing the view #####
*/
-/**********************************************************
- * change the style of the listview control
- */
-void CDefView::SetStyle(DWORD dwAdd, DWORD dwRemove)
-{
- DWORD tmpstyle;
-
- TRACE("(%p)\n", this);
-
- tmpstyle = ::GetWindowLongPtrW(m_ListView, GWL_STYLE);
- ::SetWindowLongPtrW(m_ListView, GWL_STYLE, dwAdd | (tmpstyle & ~dwRemove));
-}
/**********************************************************
* ShellView_CreateList()
@@ -1193,10 +1180,18 @@ HRESULT CDefView::FillArrangeAsMenu(HMENU hmenuArrange)
MF_BYCOMMAND);
if (m_FolderSettings.ViewMode == FVM_DETAILS || m_FolderSettings.ViewMode ==
FVM_LIST)
+ {
EnableMenuItem(hmenuArrange, FCIDM_SHVIEW_AUTOARRANGE, MF_BYCOMMAND |
MF_GRAYED);
+ }
else
+ {
EnableMenuItem(hmenuArrange, FCIDM_SHVIEW_AUTOARRANGE, MF_BYCOMMAND);
+ if (GetAutoArrange() == S_OK)
+ CheckMenuItem(hmenuArrange, FCIDM_SHVIEW_AUTOARRANGE, MF_CHECKED);
+ }
+
+
return S_OK;
}
@@ -1560,25 +1555,25 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM
lParam, BOOL &bHand
{
case FCIDM_SHVIEW_SMALLICON:
m_FolderSettings.ViewMode = FVM_SMALLICON;
- SetStyle (LVS_SMALLICON, LVS_TYPEMASK);
+ m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_SMALLICON);
CheckToolbar();
break;
case FCIDM_SHVIEW_BIGICON:
m_FolderSettings.ViewMode = FVM_ICON;
- SetStyle (LVS_ICON, LVS_TYPEMASK);
+ m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_ICON);
CheckToolbar();
break;
case FCIDM_SHVIEW_LISTVIEW:
m_FolderSettings.ViewMode = FVM_LIST;
- SetStyle (LVS_LIST, LVS_TYPEMASK);
+ m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_LIST);
CheckToolbar();
break;
case FCIDM_SHVIEW_REPORTVIEW:
m_FolderSettings.ViewMode = FVM_DETAILS;
- SetStyle (LVS_REPORT, LVS_TYPEMASK);
+ m_ListView.ModifyStyle(LVS_TYPEMASK, LVS_REPORT);
CheckToolbar();
break;
@@ -1593,9 +1588,14 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM
lParam, BOOL &bHand
break;
case FCIDM_SHVIEW_SNAPTOGRID:
- case FCIDM_SHVIEW_AUTOARRANGE:
//FIXME
break;
+ case FCIDM_SHVIEW_AUTOARRANGE:
+ if (GetAutoArrange() == S_OK)
+ m_ListView.ModifyStyle(LVS_AUTOARRANGE, 0);
+ else
+ AutoArrange();
+ break;
case FCIDM_SHVIEW_SELECTALL:
m_ListView.SetItemState(-1, LVIS_SELECTED, LVIS_SELECTED);
break;
@@ -2380,7 +2380,7 @@ HRESULT STDMETHODCALLTYPE CDefView::SetCurrentViewMode(UINT
ViewMode)
}
}
- SetStyle(dwStyle, LVS_TYPEMASK);
+ m_ListView.ModifyStyle(LVS_TYPEMASK, dwStyle);
/* This will not necessarily be the actual mode set above.
This mimics the behavior of Windows XP. */
@@ -2481,7 +2481,7 @@ HRESULT STDMETHODCALLTYPE CDefView::GetDefaultSpacing(POINT *ppt)
HRESULT STDMETHODCALLTYPE CDefView::GetAutoArrange()
{
- return E_NOTIMPL;
+ return ((m_ListView.GetStyle() & LVS_AUTOARRANGE) ? S_OK : S_FALSE);
}
HRESULT STDMETHODCALLTYPE CDefView::SelectItem(int iItem, DWORD dwFlags)
@@ -2666,8 +2666,9 @@ HRESULT STDMETHODCALLTYPE CDefView::ArrangeGrid()
HRESULT STDMETHODCALLTYPE CDefView::AutoArrange()
{
- FIXME("(%p) stub\n", this);
- return E_NOTIMPL;
+ m_ListView.ModifyStyle(0, LVS_AUTOARRANGE);
+ m_ListView.Arrange(LVA_DEFAULT);
+ return S_OK;
}
HRESULT STDMETHODCALLTYPE CDefView::AddObject(PITEMID_CHILD pidl, UINT *item)
diff --git a/sdk/include/reactos/rosctrls.h b/sdk/include/reactos/rosctrls.h
index eb5cebc026..6d3481a042 100644
--- a/sdk/include/reactos/rosctrls.h
+++ b/sdk/include/reactos/rosctrls.h
@@ -224,6 +224,12 @@ public:
{
return (BOOL)SendMessage(LVM_SETITEMPOSITION, nItem, MAKELPARAM(pPoint->x,
pPoint->y));
}
+
+ BOOL Arrange(UINT nCode)
+ {
+ return (BOOL)SendMessage(LVM_ARRANGE, nCode, 0);
+ }
+
};
template<typename TItemData = DWORD_PTR>