X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b31989e20882186006e2b2c4b8062ba8394b539d..3bce6687f47dfa5fb8d4bab92702a5b5b1eb3485:/src/generic/listctrl.cpp diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 6cfc4bec2c..b85060db7f 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -47,8 +47,16 @@ #include "wx/textctrl.h" #endif -#include "wx/imaglist.h" -#include "wx/listctrl.h" +// Include wx/listctrl.h (with wxListView declaration) +// only when wxGenericListCtrl is the only +// implementation, and therefore wxListView needs +// to be derived from the 'generic' version. + +#if defined(__WIN32__) && !defined(__WXUNIVERSAL__) + #include "wx/generic/listctrl.h" +#else + #include "wx/listctrl.h" +#endif #if defined(__WXGTK__) #include @@ -144,7 +152,7 @@ public: void SetItemCount(size_t count) { m_count = count; } // special case of SetItemCount(0) - void Clear() { m_itemsSel.Clear(); m_count = 0; } + void Clear() { m_itemsSel.Clear(); m_count = 0; m_defaultState = FALSE; } // must be called when a new item is inserted/added void OnItemAdd(size_t item) { wxFAIL_MSG( _T("TODO") ); } @@ -646,7 +654,7 @@ public: void GetImageSize( int index, int &width, int &height ) const; int GetTextLength( const wxString &s ) const; - void SetImageList( wxGenericImageList *imageList, int which ); + void SetImageList( wxImageListType *imageList, int which ); void SetItemSpacing( int spacing, bool isSmall = FALSE ); int GetItemSpacing( bool isSmall = FALSE ); @@ -775,8 +783,8 @@ public: wxColour *m_highlightColour; int m_xScroll, m_yScroll; - wxGenericImageList *m_small_image_list; - wxGenericImageList *m_normal_image_list; + wxImageListType *m_small_image_list; + wxImageListType *m_normal_image_list; int m_small_spacing; int m_normal_spacing; bool m_hasFocus; @@ -1922,7 +1930,7 @@ void wxListHeaderWindow::OnPaint( wxPaintEvent &WXUNUSED(event) ) int image = item.m_image; if ( image != -1 ) { - wxGenericImageList *imageList = m_owner->m_small_image_list; + wxImageListType *imageList = m_owner->m_small_image_list; if ( imageList ) { int ix, iy; @@ -2280,8 +2288,8 @@ void wxListMainWindow::Init() m_headerWidth = m_lineHeight = 0; - m_small_image_list = (wxGenericImageList *) NULL; - m_normal_image_list = (wxGenericImageList *) NULL; + m_small_image_list = (wxImageListType *) NULL; + m_normal_image_list = (wxImageListType *) NULL; m_small_spacing = 30; m_normal_spacing = 40; @@ -2664,22 +2672,24 @@ void wxListMainWindow::RefreshAfter( size_t lineFrom ) { if ( HasFlag(wxLC_REPORT) ) { - size_t visibleFrom; - GetVisibleLinesRange(&visibleFrom, NULL); + size_t visibleFrom, visibleTo; + GetVisibleLinesRange(&visibleFrom, &visibleTo); if ( lineFrom < visibleFrom ) lineFrom = visibleFrom; + else if ( lineFrom > visibleTo ) + return; wxRect rect; rect.x = 0; rect.y = GetLineY(lineFrom); + CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); wxSize size = GetClientSize(); rect.width = size.x; // refresh till the bottom of the window rect.height = size.y - rect.y; - CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y ); RefreshRect( rect ); } else // !report @@ -3529,7 +3539,7 @@ int wxListMainWindow::GetTextLength( const wxString &s ) const return lw + AUTOSIZE_COL_MARGIN; } -void wxListMainWindow::SetImageList( wxGenericImageList *imageList, int which ) +void wxListMainWindow::SetImageList( wxImageListType *imageList, int which ) { m_dirty = TRUE; @@ -4511,7 +4521,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxListItem, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxGenericListCtrl, wxControl) #if !defined(__WIN32__) -IMPLEMENT_DYNAMIC_CLASS(wxListView, wxGenericListCtrl) +IMPLEMENT_DYNAMIC_CLASS(wxListView, wxListCtrl) IMPLEMENT_DYNAMIC_CLASS(wxListEvent, wxNotifyEvent) #endif @@ -4532,9 +4542,9 @@ IMPLEMENT_DYNAMIC_CLASS(wxListCtrl, wxGenericListCtrl) wxGenericListCtrl::wxGenericListCtrl() { - m_imageListNormal = (wxGenericImageList *) NULL; - m_imageListSmall = (wxGenericImageList *) NULL; - m_imageListState = (wxGenericImageList *) NULL; + m_imageListNormal = (wxImageListType *) NULL; + m_imageListSmall = (wxImageListType *) NULL; + m_imageListState = (wxImageListType *) NULL; m_ownsImageListNormal = m_ownsImageListSmall = @@ -4575,7 +4585,7 @@ bool wxGenericListCtrl::Create(wxWindow *parent, { m_imageListNormal = m_imageListSmall = - m_imageListState = (wxGenericImageList *) NULL; + m_imageListState = (wxImageListType *) NULL; m_ownsImageListNormal = m_ownsImageListSmall = m_ownsImageListState = FALSE; @@ -4879,7 +4889,7 @@ long wxGenericListCtrl::GetNextItem( long item, int geom, int state ) const return m_mainWin->GetNextItem( item, geom, state ); } -wxGenericImageList *wxGenericListCtrl::GetImageList(int which) const +wxImageListType *wxGenericListCtrl::GetImageList(int which) const { if (which == wxIMAGE_LIST_NORMAL) { @@ -4893,10 +4903,10 @@ wxGenericImageList *wxGenericListCtrl::GetImageList(int which) const { return m_imageListState; } - return (wxGenericImageList *) NULL; + return (wxImageListType *) NULL; } -void wxGenericListCtrl::SetImageList( wxGenericImageList *imageList, int which ) +void wxGenericListCtrl::SetImageList( wxImageListType *imageList, int which ) { if ( which == wxIMAGE_LIST_NORMAL ) { @@ -4920,7 +4930,7 @@ void wxGenericListCtrl::SetImageList( wxGenericImageList *imageList, int which ) m_mainWin->SetImageList( imageList, which ); } -void wxGenericListCtrl::AssignImageList(wxGenericImageList *imageList, int which) +void wxGenericListCtrl::AssignImageList(wxImageListType *imageList, int which) { SetImageList(imageList, which); if ( which == wxIMAGE_LIST_NORMAL )