diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index f1159daf9f..040035ba72 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -213,17 +213,6 @@ protected: virtual wxSize DoGetBestClientSize() const wxOVERRIDE; - // return the text for the given column of the given item - virtual wxString OnGetItemText(long item, long column) const; - - // return the icon for the given item. In report view, OnGetItemImage will - // only be called for the first column. See OnGetItemColumnImage for - // details. - virtual int OnGetItemImage(long item) const; - - // return the icon for the given item and column. - virtual int OnGetItemColumnImage(long item, long column) const; - // it calls our OnGetXXX() functions friend class WXDLLIMPEXP_FWD_CORE wxListMainWindow; diff --git a/include/wx/listbase.h b/include/wx/listbase.h index 02f54a47c5..70744034db 100644 --- a/include/wx/listbase.h +++ b/include/wx/listbase.h @@ -393,9 +393,6 @@ public: virtual int GetColumnWidth(int col) const = 0; virtual bool SetColumnWidth(int col, int width) = 0; - // return the attribute for the item (may return NULL if none) - virtual wxItemAttr *OnGetItemAttr(long item) const; - // Other miscellaneous accessors. // ------------------------------ @@ -427,6 +424,26 @@ protected: // Overridden methods of the base class. virtual wxSize DoGetBestClientSize() const wxOVERRIDE; + // these functions are only used for virtual list view controls, i.e. the + // ones with wxLC_VIRTUAL style + + // return the attribute for the item (may return NULL if none) + virtual wxItemAttr* OnGetItemAttr(long item) const; + + // return the text for the given column of the given item + virtual wxString OnGetItemText(long item, long column) const; + + // return the icon for the given item. In report view, OnGetItemImage will + // only be called for the first column. See OnGetItemColumnImage for + // details. + virtual int OnGetItemImage(long item) const; + + // return the icon for the given item and column. + virtual int OnGetItemColumnImage(long item, long column) const; + + // return the attribute for the given item and column (may return NULL if none) + virtual wxItemAttr* OnGetItemColumnAttr(long item, long column) const; + private: // user defined color to draw row lines, may be invalid wxItemAttr m_alternateRowColour; diff --git a/include/wx/msw/listctrl.h b/include/wx/msw/listctrl.h index 2c27e56b6a..78da57b6cc 100644 --- a/include/wx/msw/listctrl.h +++ b/include/wx/msw/listctrl.h @@ -421,26 +421,6 @@ protected: // true if we have any items with custom attributes bool m_hasAnyAttr; - // these functions are only used for virtual list view controls, i.e. the - // ones with wxLC_VIRTUAL style - - // return the text for the given column of the given item - virtual wxString OnGetItemText(long item, long column) const; - - // return the icon for the given item. In report view, OnGetItemImage will - // only be called for the first column. See OnGetItemColumnImage for - // details. - virtual int OnGetItemImage(long item) const; - - // return the icon for the given item and column. - virtual int OnGetItemColumnImage(long item, long column) const; - - // return the attribute for the given item and column (may return NULL if none) - virtual wxItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const - { - return OnGetItemAttr(item); - } - private: // process NM_CUSTOMDRAW notification message WXLPARAM OnCustomDraw(WXLPARAM lParam); diff --git a/include/wx/qt/listctrl.h b/include/wx/qt/listctrl.h index 139bbc698d..e55b44ef98 100644 --- a/include/wx/qt/listctrl.h +++ b/include/wx/qt/listctrl.h @@ -265,27 +265,6 @@ public: // data is arbitrary data to be passed to the sort function. bool SortItems(wxListCtrlCompare fn, wxIntPtr data); - - // these functions are only used for virtual list view controls, i.e. the - // ones with wxLC_VIRTUAL style (not currently implemented in wxQT) - - // return the text for the given column of the given item - virtual wxString OnGetItemText(long item, long column) const; - - // return the icon for the given item. In report view, OnGetItemImage will - // only be called for the first column. See OnGetItemColumnImage for - // details. - virtual int OnGetItemImage(long item) const; - - // return the icon for the given item and column. - virtual int OnGetItemColumnImage(long item, long column) const; - - // return the attribute for the given item and column (may return NULL if none) - virtual wxItemAttr *OnGetItemColumnAttr(long item, long WXUNUSED(column)) const - { - return OnGetItemAttr(item); - } - virtual QWidget *GetHandle() const wxOVERRIDE; protected: diff --git a/src/common/listctrlcmn.cpp b/src/common/listctrlcmn.cpp index 70f2bf7e48..ba6292fa1c 100644 --- a/src/common/listctrlcmn.cpp +++ b/src/common/listctrlcmn.cpp @@ -25,6 +25,7 @@ #if wxUSE_LISTCTRL #include "wx/listctrl.h" +#include "wx/imaglist.h" #ifndef WX_PRECOMP #include "wx/dcclient.h" @@ -251,4 +252,34 @@ wxItemAttr *wxListCtrlBase::OnGetItemAttr(long item) const : NULL; // no attributes by default } +wxString wxListCtrlBase::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const +{ + // this is a pure virtual function, in fact - which is not really pure + // because the controls which are not virtual don't need to implement it + wxFAIL_MSG("wxListCtrl::OnGetItemText not supposed to be called"); + + return wxEmptyString; +} + +int wxListCtrlBase::OnGetItemImage(long WXUNUSED(item)) const +{ + wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL), + -1, + "List control has an image list, OnGetItemImage or OnGetItemColumnImage should be overridden."); + return -1; +} + +int wxListCtrlBase::OnGetItemColumnImage(long item, long column) const +{ + if ( !column ) + return OnGetItemImage(item); + + return -1; +} + +wxItemAttr* wxListCtrlBase::OnGetItemColumnAttr(long item, long WXUNUSED(column)) const +{ + return OnGetItemAttr(item); +} + #endif // wxUSE_LISTCTRL diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 0394bfaba7..d77de801f9 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -5533,31 +5533,6 @@ wxSize wxGenericListCtrl::DoGetBestClientSize() const // virtual list control support // ---------------------------------------------------------------------------- -wxString wxGenericListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const -{ - // this is a pure virtual function, in fact - which is not really pure - // because the controls which are not virtual don't need to implement it - wxFAIL_MSG( wxT("wxGenericListCtrl::OnGetItemText not supposed to be called") ); - - return wxEmptyString; -} - -int wxGenericListCtrl::OnGetItemImage(long WXUNUSED(item)) const -{ - wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL), - -1, - 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; -} - void wxGenericListCtrl::SetItemCount(long count) { wxASSERT_MSG( IsVirtual(), wxT("this is for virtual controls only") ); diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index c557c559f3..cb3528a877 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -3240,31 +3240,6 @@ wxListCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam) // virtual list controls // ---------------------------------------------------------------------------- -wxString wxListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const -{ - // this is a pure virtual function, in fact - which is not really pure - // because the controls which are not virtual don't need to implement it - wxFAIL_MSG( wxT("wxListCtrl::OnGetItemText not supposed to be called") ); - - return wxEmptyString; -} - -int wxListCtrl::OnGetItemImage(long WXUNUSED(item)) const -{ - wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL), - -1, - wxT("List control has an image list, OnGetItemImage or OnGetItemColumnImage should be overridden.")); - return -1; -} - -int wxListCtrl::OnGetItemColumnImage(long item, long column) const -{ - if (!column) - return OnGetItemImage(item); - - return -1; -} - wxItemAttr *wxListCtrl::DoGetItemColumnAttr(long item, long column) const { if ( IsVirtual() ) diff --git a/src/qt/listctrl.cpp b/src/qt/listctrl.cpp index 4ba6cfcefd..587961d3da 100644 --- a/src/qt/listctrl.cpp +++ b/src/qt/listctrl.cpp @@ -1010,35 +1010,6 @@ bool wxListCtrl::SortItems(wxListCtrlCompare WXUNUSED(fn), wxIntPtr WXUNUSED(dat return false; } -// ---------------------------------------------------------------------------- -// virtual list controls (not currently implemented in wxQT) -// ---------------------------------------------------------------------------- - -wxString wxListCtrl::OnGetItemText(long WXUNUSED(item), long WXUNUSED(col)) const -{ - // this is a pure virtual function, in fact - which is not really pure - // because the controls which are not virtual don't need to implement it - wxFAIL_MSG( wxT("wxListCtrl::OnGetItemText not supposed to be called") ); - - return wxEmptyString; -} - -int wxListCtrl::OnGetItemImage(long WXUNUSED(item)) const -{ - wxCHECK_MSG(!GetImageList(wxIMAGE_LIST_SMALL), - -1, - wxT("List control has an image list, OnGetItemImage or OnGetItemColumnImage should be overridden.")); - return -1; -} - -int wxListCtrl::OnGetItemColumnImage(long item, long column) const -{ - if (!column) - return OnGetItemImage(item); - - return -1; -} - QWidget *wxListCtrl::GetHandle() const { return m_qtTreeWidget;