OSDN Git Service

Merge with stable
[winmerge-jp/winmerge-jp.git] / Src / IListCtrlImpl.h
index 131b0c5..0ea356d 100644 (file)
@@ -39,6 +39,15 @@ public:
                return text;
        }
 
+       void *GetItemData(int row) const
+       {
+               LVITEM lvi = {0};\r
+               lvi.iItem = row;\r
+               lvi.mask = LVIF_PARAM;\r
+               ::SendMessage(m_hwndListCtrl, LVM_GETITEM, 0, (LPARAM)&lvi);\r
+               return (void *)lvi.lParam;\r
+       }
+
        int GetBackColor(int row) const
        {
                NMLVCUSTOMDRAW nmlvcd = {0};
@@ -51,6 +60,26 @@ public:
                return nmlvcd.clrTextBk;
        }
 
+       bool IsSelectedItem(int sel) const
+       {
+               return !!ListView_GetItemState(m_hwndListCtrl, sel, LVIS_SELECTED);
+       }
+
+       int GetNextItem(int sel, bool selected = false, bool reverse = false) const
+       {
+               return ListView_GetNextItem(m_hwndListCtrl, sel, (selected ? LVNI_SELECTED : 0) | (reverse ? LVNI_ABOVE : 0));          
+       }
+
+       int GetNextSelectedItem(int sel, bool reverse = false) const
+       {
+               return ListView_GetNextItem(m_hwndListCtrl, sel, LVNI_SELECTED | (reverse ? LVNI_ABOVE : 0));           
+       }
+
+       unsigned GetSelectedCount() const
+       {
+               return ListView_GetSelectedCount(m_hwndListCtrl);
+       }
+
        int GetIndent(int row) const
        {
                LVITEM item = {0};
@@ -115,7 +144,7 @@ public:
                DeleteObject(hbmpImage);
                return ret;
        }
-
+\r
 protected:
        HWND m_hwndListCtrl;
 };