Fix wxListCtrl::Insert() bug reported by Riccardo Cohen

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@56468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling 2008-10-20 11:33:58 +00:00
parent 53b849eadf
commit 4ee5edc799
2 changed files with 12 additions and 13 deletions

View File

@ -3107,11 +3107,12 @@ Boolean wxMacDataBrowserListCtrlControl::CompareItems(DataBrowserItemID itemOneI
wxMacListCtrlItem* otherItem = (wxMacListCtrlItem*)itemTwoID;
itemOrder = item->GetOrder();
otherItemOrder = item->GetOrder();
otherItemOrder = otherItem->GetOrder();
wxListCtrlCompare func = list->GetCompareFunc();
if (func != NULL)
{
long item1 = -1;
long item2 = -1;
if (item && item->HasColumnInfo(0))

View File

@ -1038,10 +1038,9 @@ void wxMacDataItemBrowserControl::MacDelete( unsigned int n )
void wxMacDataItemBrowserControl::MacInsert( unsigned int n, wxMacDataItem* item)
{
SInt32 frontLineOrder = 0;
if ( m_sortOrder == SortOrder_None )
{
// increase the order of the lines to be shifted
unsigned int lines = MacGetCount();
for ( unsigned int i = n; i < lines; ++i)
@ -1049,22 +1048,21 @@ void wxMacDataItemBrowserControl::MacInsert( unsigned int n, wxMacDataItem* item
wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(i);
iter->SetOrder( iter->GetOrder() + 1 );
}
#if 0
// I don't understand what this code is supposed to do, RR.
SInt32 frontLineOrder = 0;
if ( n > 0 )
{
wxMacDataItem* iter = (wxMacDataItem*) GetItemFromLine(n-1);
frontLineOrder = iter->GetOrder();
frontLineOrder = iter->GetOrder()+1;
}
#else
item->SetOrder( n );
#endif
}
wxArrayMacDataItemPtr ids;
ids.SetCount( 1 );
if ( m_sortOrder == SortOrder_None )
item->SetOrder( frontLineOrder + 1 );
ids[0] = item;
AddItems( wxMacDataBrowserRootContainer, ids );
AddItem( wxMacDataBrowserRootContainer, item );
}
void wxMacDataItemBrowserControl::MacClear()