1. fixed typo ('&' instead of '|') in wxNotebook

2. changed wxTC_MULTILINE to be equal to wxNB_MULTILINE and != 0
3. much more efficient selection handling in virtual wxListCtrl,
   we can now select 1000000 items without problems
4. kbd/mouse selection (ctrl/shift handling) fixed in wxListCtrl
5. added wxSortedArray::IndexForInsert() and AddAt(), remove Remove(size_t),
   use RemoveAt() instead


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10889 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-07 22:42:35 +00:00
parent dfdd617b4b
commit b54e41c529
17 changed files with 672 additions and 384 deletions

View File

@@ -182,37 +182,8 @@ int wxBaseArray::Index(long lItem, bool bFromEnd) const
return wxNOT_FOUND;
}
// search for an item in a sorted array (binary search)
int wxBaseArray::Index(long lItem, CMPFUNC fnCompare) const
{
size_t i,
lo = 0,
hi = m_nCount;
int res;
while ( lo < hi ) {
i = (lo + hi)/2;
res = (*fnCompare)((const void *)lItem, (const void *)m_pItems[i]);
if ( res < 0 )
hi = i;
else if ( res > 0 )
lo = i + 1;
else
return i;
}
return wxNOT_FOUND;
}
// add item at the end
void wxBaseArray::Add(long lItem)
{
Grow();
m_pItems[m_nCount++] = lItem;
}
// add item assuming the array is sorted with fnCompare function
void wxBaseArray::Add(long lItem, CMPFUNC fnCompare)
// search for a place to insert an item into a sorted array (binary search)
size_t wxBaseArray::IndexForInsert(long lItem, CMPFUNC fnCompare) const
{
size_t i,
lo = 0,
@@ -228,14 +199,33 @@ void wxBaseArray::Add(long lItem, CMPFUNC fnCompare)
else if ( res > 0 )
lo = i + 1;
else {
lo = hi = i;
lo = i;
break;
}
}
wxASSERT( lo == hi ); // I hope I got binary search right :-)
return lo;
}
Insert(lItem, lo);
// search for an item in a sorted array (binary search)
int wxBaseArray::Index(long lItem, CMPFUNC fnCompare) const
{
size_t n = IndexForInsert(lItem, fnCompare);
return n < m_nCount && m_pItems[n] == lItem ? n : wxNOT_FOUND;
}
// add item at the end
void wxBaseArray::Add(long lItem)
{
Grow();
m_pItems[m_nCount++] = lItem;
}
// add item assuming the array is sorted with fnCompare function
void wxBaseArray::Add(long lItem, CMPFUNC fnCompare)
{
Insert(lItem, IndexForInsert(lItem, fnCompare));
}
// add item at the given position