supporting Freeze and Thaw in native control, has huge implications on performance of lists with many thousands of elements

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@53881 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2008-05-31 17:30:06 +00:00
parent 4cfb1203e1
commit bb6fc02ac1

View File

@@ -220,7 +220,10 @@ public:
virtual void MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item ); virtual void MacSetColumnInfo( unsigned int row, unsigned int column, wxListItem* item );
virtual void MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item ); virtual void MacGetColumnInfo( unsigned int row, unsigned int column, wxListItem& item );
virtual void UpdateState(wxMacDataItem* dataItem, wxListItem* item); virtual void UpdateState(wxMacDataItem* dataItem, wxListItem* item);
virtual void SetDrawingEnabled( bool enable );
int GetFlags() { return m_flags; } int GetFlags() { return m_flags; }
bool IsDrawingEnabled() { return m_drawingEnabled; }
protected: protected:
// we need to override to provide specialized handling for virtual wxListCtrls // we need to override to provide specialized handling for virtual wxListCtrls
@@ -277,6 +280,7 @@ protected:
wxClientDataType m_clientDataItemsType; wxClientDataType m_clientDataItemsType;
bool m_isVirtual; bool m_isVirtual;
int m_flags; int m_flags;
bool m_drawingEnabled;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListCtrlControl) DECLARE_DYNAMIC_CLASS_NO_COPY(wxMacDataBrowserListCtrlControl)
}; };
@@ -2341,7 +2345,8 @@ void wxListCtrl::RefreshItem(long item)
else else
id = item+1; id = item+1;
m_dbImpl->wxMacDataBrowserControl::UpdateItems if ( m_dbImpl->IsDrawingEnabled() )
m_dbImpl->wxMacDataBrowserControl::UpdateItems
( (
kDataBrowserNoItem, kDataBrowserNoItem,
1, &id, 1, &id,
@@ -2359,7 +2364,7 @@ void wxListCtrl::RefreshItems(long itemFrom, long itemTo)
return; return;
} }
if (m_dbImpl) if (m_dbImpl && m_dbImpl->IsDrawingEnabled())
{ {
const long count = itemTo - itemFrom + 1; const long count = itemTo - itemFrom + 1;
DataBrowserItemID *ids = new DataBrowserItemID[count]; DataBrowserItemID *ids = new DataBrowserItemID[count];
@@ -2523,6 +2528,7 @@ wxMacDataBrowserListCtrlControl::wxMacDataBrowserListCtrlControl( wxWindow *peer
m_clientDataItemsType = wxClientData_None; m_clientDataItemsType = wxClientData_None;
m_isVirtual = false; m_isVirtual = false;
m_flags = 0; m_flags = 0;
m_drawingEnabled = true;
if ( style & wxLC_VIRTUAL ) if ( style & wxLC_VIRTUAL )
m_isVirtual = true; m_isVirtual = true;
@@ -3192,7 +3198,7 @@ void wxMacDataBrowserListCtrlControl::MacSetColumnInfo( unsigned int row, unsign
// only the sorted column would be refreshed, meaning only first column text labels // only the sorted column would be refreshed, meaning only first column text labels
// would be shown. Making sure not to update items until the control is visible // would be shown. Making sure not to update items until the control is visible
// seems to fix this issue. // seems to fix this issue.
if (hasInfo && list->IsShown()) if (hasInfo && list->IsShown() && IsDrawingEnabled() )
UpdateItem( wxMacDataBrowserRootContainer, listItem , kMinColumnId + column ); UpdateItem( wxMacDataBrowserRootContainer, listItem , kMinColumnId + column );
} }
} }
@@ -3267,6 +3273,20 @@ wxMacDataItem* wxMacDataBrowserListCtrlControl::CreateItem()
return new wxMacListCtrlItem(); return new wxMacListCtrlItem();
} }
void wxMacDataBrowserListCtrlControl::SetDrawingEnabled( bool enable )
{
if ( m_drawingEnabled != enable )
{
m_drawingEnabled = enable;
if( enable )
{
verify_noerr( wxMacDataBrowserControl::UpdateItems( kDataBrowserNoItem , 0,
NULL, kDataBrowserItemNoProperty /* notSorted */, kDataBrowserNoItem ) );
}
}
wxMacDataItemBrowserControl::SetDrawingEnabled(enable);
}
wxMacListCtrlItem::wxMacListCtrlItem() wxMacListCtrlItem::wxMacListCtrlItem()
{ {
m_rowItems = wxListItemList(); m_rowItems = wxListItemList();