X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/99366b91eb0134149e4900f7d2908318057b64e6..50b5e38d3ff57f33b9b3510ab8576123efd670e9:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 77d37d2738..b5bbc4a4be 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -402,15 +402,15 @@ WXDWORD wxListCtrl::MSWGetStyle(long style, WXDWORD *exstyle) const wstyle |= LVS_SHAREIMAGELISTS | LVS_SHOWSELALWAYS; -#ifdef __WXDEBUG__ +#if wxDEBUG_LEVEL size_t nModes = 0; #define MAP_MODE_STYLE(wx, ms) \ if ( style & (wx) ) { wstyle |= (ms); nModes++; } -#else // !__WXDEBUG__ +#else // !wxDEBUG_LEVEL #define MAP_MODE_STYLE(wx, ms) \ if ( style & (wx) ) wstyle |= (ms); -#endif // __WXDEBUG__ +#endif // wxDEBUG_LEVEL/!wxDEBUG_LEVEL MAP_MODE_STYLE(wxLC_ICON, LVS_ICON) MAP_MODE_STYLE(wxLC_SMALL_ICON, LVS_SMALLICON) @@ -893,7 +893,7 @@ bool wxListCtrl::SetItem(wxListItem& info) data = new wxListItemInternalData(); item.lParam = (LPARAM) data; item.mask |= LVIF_PARAM; - }; + } // user data @@ -910,15 +910,14 @@ bool wxListCtrl::SetItem(wxListItem& info) data->attr->AssignFrom(attrNew); else data->attr = new wxListItemAttr(attrNew); - }; - }; + } + } // we could be changing only the attribute in which case we don't need to // call ListView_SetItem() at all if ( item.mask ) { - item.cchTextMax = 0; if ( !ListView_SetItem(GetHwnd(), &item) ) { wxLogDebug(_T("ListView_SetItem() failed")); @@ -1626,7 +1625,7 @@ long wxListCtrl::FindItem(long start, wxUIntPtr data) if (GetItemData(idx) == data) return idx; idx++; - }; + } return -1; } @@ -1746,7 +1745,7 @@ long wxListCtrl::InsertItem(const wxListItem& info) // and remember that we have some now... m_hasAnyAttr = true; } - }; + } long rv = ListView_InsertItem(GetHwnd(), & item); @@ -2713,8 +2712,12 @@ static void HandleItemPaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) } // same thing for CDIS_FOCUS (except simpler as there is only one of them) + // + // NB: cast is needed to work around the bug in mingw32 headers which don't + // have it inside ListView_GetNextItem() itself (unlike SDK ones) if ( ::GetFocus() == hwndList && - ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED) == item ) + ListView_GetNextItem( + hwndList, static_cast(-1), LVNI_FOCUSED) == item ) { nmcd.uItemState |= CDIS_FOCUS; } @@ -3197,6 +3200,9 @@ static void wxConvertToMSWListItem(const wxListCtrl *ctrl, const wxListItem& info, LV_ITEM& lvItem) { + wxASSERT_MSG( 0 <= info.m_col && info.m_col < ctrl->GetColumnCount(), + "wxListCtrl column index out of bounds" ); + lvItem.iItem = (int) info.m_itemId; lvItem.iImage = info.m_image;