diff options
Diffstat (limited to 'CPP/Windows/Control/ListView.cpp')
| -rw-r--r-- | CPP/Windows/Control/ListView.cpp | 47 |
1 files changed, 27 insertions, 20 deletions
diff --git a/CPP/Windows/Control/ListView.cpp b/CPP/Windows/Control/ListView.cpp index 16cfd39..3e8786a 100644 --- a/CPP/Windows/Control/ListView.cpp +++ b/CPP/Windows/Control/ListView.cpp | |||
| @@ -20,78 +20,85 @@ bool CListView::CreateEx(DWORD exStyle, DWORD style, | |||
| 20 | height, parentWindow, idOrHMenu, instance, createParam); | 20 | height, parentWindow, idOrHMenu, instance, createParam); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | bool CListView::GetItemParam(int index, LPARAM ¶m) const | 23 | /* note: LVITEM and LVCOLUMN structures contain optional fields |
| 24 | depending from preprocessor macros: | ||
| 25 | #if (_WIN32_IE >= 0x0300) | ||
| 26 | #if (_WIN32_WINNT >= 0x0501) | ||
| 27 | #if (_WIN32_WINNT >= 0x0600) | ||
| 28 | */ | ||
| 29 | |||
| 30 | bool CListView::GetItemParam(unsigned index, LPARAM ¶m) const | ||
| 24 | { | 31 | { |
| 25 | LVITEM item; | 32 | LVITEM item; |
| 26 | item.iItem = index; | 33 | item.iItem = (int)index; |
| 27 | item.iSubItem = 0; | 34 | item.iSubItem = 0; |
| 28 | item.mask = LVIF_PARAM; | 35 | item.mask = LVIF_PARAM; |
| 29 | bool aResult = GetItem(&item); | 36 | const bool res = GetItem(&item); |
| 30 | param = item.lParam; | 37 | param = item.lParam; |
| 31 | return aResult; | 38 | return res; |
| 32 | } | 39 | } |
| 33 | 40 | ||
| 34 | int CListView::InsertColumn(int columnIndex, LPCTSTR text, int width) | 41 | int CListView::InsertColumn(unsigned columnIndex, LPCTSTR text, int width) |
| 35 | { | 42 | { |
| 36 | LVCOLUMN ci; | 43 | LVCOLUMN ci; |
| 37 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; | 44 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; |
| 38 | ci.pszText = (LPTSTR)(void *)text; | 45 | ci.pszText = (LPTSTR)(void *)text; |
| 39 | ci.iSubItem = columnIndex; | 46 | ci.iSubItem = (int)columnIndex; |
| 40 | ci.cx = width; | 47 | ci.cx = width; |
| 41 | return InsertColumn(columnIndex, &ci); | 48 | return InsertColumn(columnIndex, &ci); |
| 42 | } | 49 | } |
| 43 | 50 | ||
| 44 | int CListView::InsertItem(int index, LPCTSTR text) | 51 | int CListView::InsertItem(unsigned index, LPCTSTR text) |
| 45 | { | 52 | { |
| 46 | LVITEM item; | 53 | LVITEM item; |
| 47 | item.mask = LVIF_TEXT | LVIF_PARAM; | 54 | item.mask = LVIF_TEXT | LVIF_PARAM; |
| 48 | item.iItem = index; | 55 | item.iItem = (int)index; |
| 49 | item.lParam = index; | 56 | item.lParam = (LPARAM)index; |
| 50 | item.pszText = (LPTSTR)(void *)text; | 57 | item.pszText = (LPTSTR)(void *)text; |
| 51 | item.iSubItem = 0; | 58 | item.iSubItem = 0; |
| 52 | return InsertItem(&item); | 59 | return InsertItem(&item); |
| 53 | } | 60 | } |
| 54 | 61 | ||
| 55 | int CListView::SetSubItem(int index, int subIndex, LPCTSTR text) | 62 | int CListView::SetSubItem(unsigned index, unsigned subIndex, LPCTSTR text) |
| 56 | { | 63 | { |
| 57 | LVITEM item; | 64 | LVITEM item; |
| 58 | item.mask = LVIF_TEXT; | 65 | item.mask = LVIF_TEXT; |
| 59 | item.iItem = index; | 66 | item.iItem = (int)index; |
| 60 | item.pszText = (LPTSTR)(void *)text; | 67 | item.pszText = (LPTSTR)(void *)text; |
| 61 | item.iSubItem = subIndex; | 68 | item.iSubItem = (int)subIndex; |
| 62 | return SetItem(&item); | 69 | return SetItem(&item); |
| 63 | } | 70 | } |
| 64 | 71 | ||
| 65 | #ifndef _UNICODE | 72 | #ifndef _UNICODE |
| 66 | 73 | ||
| 67 | int CListView::InsertColumn(int columnIndex, LPCWSTR text, int width) | 74 | int CListView::InsertColumn(unsigned columnIndex, LPCWSTR text, int width) |
| 68 | { | 75 | { |
| 69 | LVCOLUMNW ci; | 76 | LVCOLUMNW ci; |
| 70 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; | 77 | ci.mask = LVCF_TEXT | LVCF_WIDTH | LVCF_SUBITEM; |
| 71 | ci.pszText = (LPWSTR)(void *)text; | 78 | ci.pszText = (LPWSTR)(void *)text; |
| 72 | ci.iSubItem = columnIndex; | 79 | ci.iSubItem = (int)columnIndex; |
| 73 | ci.cx = width; | 80 | ci.cx = width; |
| 74 | return InsertColumn(columnIndex, &ci); | 81 | return InsertColumn(columnIndex, &ci); |
| 75 | } | 82 | } |
| 76 | 83 | ||
| 77 | int CListView::InsertItem(int index, LPCWSTR text) | 84 | int CListView::InsertItem(unsigned index, LPCWSTR text) |
| 78 | { | 85 | { |
| 79 | LVITEMW item; | 86 | LVITEMW item; |
| 80 | item.mask = LVIF_TEXT | LVIF_PARAM; | 87 | item.mask = LVIF_TEXT | LVIF_PARAM; |
| 81 | item.iItem = index; | 88 | item.iItem = (int)index; |
| 82 | item.lParam = index; | 89 | item.lParam = (LPARAM)index; |
| 83 | item.pszText = (LPWSTR)(void *)text; | 90 | item.pszText = (LPWSTR)(void *)text; |
| 84 | item.iSubItem = 0; | 91 | item.iSubItem = 0; |
| 85 | return InsertItem(&item); | 92 | return InsertItem(&item); |
| 86 | } | 93 | } |
| 87 | 94 | ||
| 88 | int CListView::SetSubItem(int index, int subIndex, LPCWSTR text) | 95 | int CListView::SetSubItem(unsigned index, unsigned subIndex, LPCWSTR text) |
| 89 | { | 96 | { |
| 90 | LVITEMW item; | 97 | LVITEMW item; |
| 91 | item.mask = LVIF_TEXT; | 98 | item.mask = LVIF_TEXT; |
| 92 | item.iItem = index; | 99 | item.iItem = (int)index; |
| 93 | item.pszText = (LPWSTR)(void *)text; | 100 | item.pszText = (LPWSTR)(void *)text; |
| 94 | item.iSubItem = subIndex; | 101 | item.iSubItem = (int)subIndex; |
| 95 | return SetItem(&item); | 102 | return SetItem(&item); |
| 96 | } | 103 | } |
| 97 | 104 | ||
