X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/25e6a4a698b15d72874bd1dbf4d260163a60f005..caf6e6dee8d177844bb633786ec8c05eba6972bc:/src/msw/listctrl.cpp diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 2406e000c1..e680736293 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -918,12 +918,19 @@ bool wxListCtrl::SetItemState(long item, long state, long stateMask) // Sets the item image bool wxListCtrl::SetItemImage(long item, int image, int WXUNUSED(selImage)) +{ + return SetItemColumnImage(item, 0, image); +} + +// Sets the item image +bool wxListCtrl::SetItemColumnImage(long item, long column, int image) { wxListItem info; info.m_mask = wxLIST_MASK_IMAGE; info.m_image = image; info.m_itemId = item; + info.m_col = column; return SetItem(info); } @@ -2420,12 +2427,16 @@ static void HandleSubItemPrepaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) } // notice that even if this item doesn't have any image, the list - // control still leaves space for the image if the image list is not - // empty (presumably so that items with and without images align?) - int wImage, hImage; - ImageList_GetIconSize(himl, &wImage, &hImage); + // control still leaves space for the image in the first column if the + // image list is not empty (presumably so that items with and without + // images align?) + if ( it.iImage != -1 || it.iSubItem == 0 ) + { + int wImage, hImage; + ImageList_GetIconSize(himl, &wImage, &hImage); - rc.left += wImage + 2; + rc.left += wImage + 2; + } } ::SetBkMode(hdc, TRANSPARENT); @@ -2479,7 +2490,8 @@ static void HandleItemPaint(LPNMLVCUSTOMDRAW pLVCD, HFONT hfont) } // same thing for CDIS_FOCUS (except simpler as there is only one of them) - if ( ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED) == item ) + if ( ::GetFocus() == hwndList && + ListView_GetNextItem(hwndList, -1, LVNI_FOCUSED) == item ) { nmcd.uItemState |= CDIS_FOCUS; } @@ -2540,12 +2552,12 @@ static WXLPARAM HandleItemPrepaint(wxListCtrl *listctrl, // set the colours to use for text drawing - pLVCD->clrText = wxColourToRGB(attr->HasTextColour() - ? attr->GetTextColour() - : listctrl->GetTextColour()); - pLVCD->clrTextBk = wxColourToRGB(attr->HasBackgroundColour() - ? attr->GetBackgroundColour() - : listctrl->GetBackgroundColour()); + pLVCD->clrText = attr->HasTextColour() + ? wxColourToRGB(attr->GetTextColour()) + : wxColourToRGB(listctrl->GetTextColour()); + pLVCD->clrTextBk = attr->HasBackgroundColour() + ? wxColourToRGB(attr->GetBackgroundColour()) + : wxColourToRGB(listctrl->GetBackgroundColour()); // select the font if non default one is specified if ( attr->HasFont() )