X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/277ea1b4906b519dcfe59383f77eb91aa27306cf..18e989043be8f46e5744735fbf2d56840d2c34a7:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index cfcee8e268..bc9bb84c92 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -341,6 +341,9 @@ public: void SetImage( int image ) { SetImage(0, image); } int GetImage() const { return GetImage(0); } + void SetImage( int index, int image ); + int GetImage( int index ) const; + bool HasImage() const { return GetImage() != -1; } bool HasText() const { return !GetText(0).empty(); } @@ -390,11 +393,6 @@ private: // draw the text on the DC with the correct justification; also add an // ellipsis if the text is too large to fit in the current width void DrawTextFormatted(wxDC *dc, const wxString &text, int col, int x, int y, int width); - - // these are only used by GetImage/SetImage above, we don't support images - // with subitems at the public API level yet - void SetImage( int index, int image ); - int GetImage( int index ) const; }; WX_DECLARE_EXPORTED_OBJARRAY(wxListLineData, wxListLineDataArray); @@ -2226,9 +2224,9 @@ void wxListMainWindow::CacheLineData(size_t line) for ( size_t col = 0; col < countCol; col++ ) { ld->SetText(col, listctrl->OnGetItemText(line, col)); + ld->SetImage(col, listctrl->OnGetItemColumnImage(line, col)); } - ld->SetImage(listctrl->OnGetItemImage(line)); ld->SetAttr(listctrl->OnGetItemAttr(line)); } @@ -5470,11 +5468,18 @@ int wxGenericListCtrl::OnGetItemImage(long WXUNUSED(item)) const { wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL), -1, - wxT("List control has an image list: OnGetItemImage should be overridden.")); - + wxT("List control has an image list, OnGetItemImage or OnGetItemColumnImage should be overridden.")); return -1; } +int wxGenericListCtrl::OnGetItemColumnImage(long item, long column) const +{ + if (!column) + return OnGetItemImage(item); + + return -1; +} + wxListItemAttr * wxGenericListCtrl::OnGetItemAttr(long WXUNUSED_UNLESS_DEBUG(item)) const { @@ -5533,7 +5538,6 @@ void wxGenericListCtrl::Refresh(bool eraseBackground, const wxRect *rect) rectHeader.Offset(-x, -y); m_headerWin->Refresh(eraseBackground, &rectHeader); } - } // Refresh the main window