X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce7fe42e848cc0c9058dae906c3a7bded50681e6..be10c7f969bb460dc79bd8946d59bf54c98ac660:/src/msw/listctrl.cpp?ds=inline diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 9684bf0e9a..0772db7a25 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -4,7 +4,6 @@ // Author: Julian Smart // Modified by: Agron Selimaj // Created: 04/01/98 -// RCS-ID: $Id$ // Copyright: (c) Julian Smart // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -952,7 +951,7 @@ bool wxListCtrl::SetItemColumnImage(long item, long column, int image) wxListItem info; info.m_mask = wxLIST_MASK_IMAGE; - info.m_image = image; + info.m_image = image == -1 ? I_IMAGENONE : image; info.m_itemId = item; info.m_col = column; @@ -1339,7 +1338,10 @@ void wxListCtrl::AssignImageList(wxImageList *imageList, int which) wxSize wxListCtrl::MSWGetBestViewRect(int x, int y) const { - const DWORD rc = ListView_ApproximateViewRect(GetHwnd(), x, y, -1); + // The cast is necessary to suppress a MinGW warning due to a missing cast + // to WPARAM in the definition of ListView_ApproximateViewRect() in its + // own headers (this was the case up to at least MinGW 4.8). + const DWORD rc = ListView_ApproximateViewRect(GetHwnd(), x, y, (WPARAM)-1); wxSize size(LOWORD(rc), HIWORD(rc)); @@ -1749,11 +1751,9 @@ long wxListCtrl::InsertItem(long index, int imageIndex) long wxListCtrl::InsertItem(long index, const wxString& label, int imageIndex) { wxListItem info; - info.m_image = imageIndex; + info.m_image = imageIndex == -1 ? I_IMAGENONE : imageIndex; info.m_text = label; - info.m_mask = wxLIST_MASK_TEXT; - if (imageIndex > -1) - info.m_mask |= wxLIST_MASK_IMAGE; + info.m_mask = wxLIST_MASK_TEXT | wxLIST_MASK_IMAGE; info.m_itemId = index; return InsertItem(info); }