[SHELL32]
authorChristoph von Wittich <christoph_vw@reactos.org>
Sat, 4 Apr 2015 18:51:28 +0000 (18:51 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sat, 4 Apr 2015 18:51:28 +0000 (18:51 +0000)
implement invert selection

svn path=/trunk/; revision=67052

reactos/dll/win32/shell32/CDefView.cpp
reactos/include/reactos/rosctrls.h

index ccc3760..9bb4bb7 100644 (file)
@@ -1554,9 +1554,10 @@ LRESULT CDefView::OnKillFocus(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHa
 */
 LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHandled)
 {
-    DWORD                                dwCmdID;
-    DWORD                                dwCmd;
-    HWND                                hwndCmd;
+    DWORD dwCmdID;
+    DWORD dwCmd;
+    HWND  hwndCmd;
+    int   nCount; 
 
     dwCmdID = GET_WM_COMMAND_ID(wParam, lParam);
     dwCmd = GET_WM_COMMAND_CMD(wParam, lParam);
@@ -1605,6 +1606,12 @@ LRESULT CDefView::OnCommand(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL &bHand
             m_ListView.SetItemState(-1, LVIS_SELECTED, LVIS_SELECTED);
             break;
 
+        case FCIDM_SHVIEW_INVERTSELECTION:
+            nCount = m_ListView.GetItemCount();
+            for (int i=0; i < nCount; i++)
+                m_ListView.SetItemState(i, m_ListView.GetItemState(i, LVIS_SELECTED) ? 0 : LVIS_SELECTED, LVIS_SELECTED);
+            break;
+
         case FCIDM_SHVIEW_REFRESH:
             Refresh();
             break;
index e528260..d3d7500 100644 (file)
@@ -165,6 +165,11 @@ public:
         spacing.cy = HIWORD(ret);
     }
 
+    UINT GetItemState(int i, UINT mask)
+    {
+        return SendMessage(LVM_GETITEMSTATE, i, (LPARAM)mask);
+    }
+
     void SetItemState(int i, UINT state, UINT mask)
     {
         LV_ITEM item;