1. wxListBox::Delete() refresh bug fixed

2. wxScrollBar::HitTest() fixed (=> fixing refresh problem) for scrollbars
   without range


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/wxUNIVERSAL@8500 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-10-09 17:07:23 +00:00
parent ca818da556
commit a978bcef22
4 changed files with 28 additions and 6 deletions

View File

@@ -276,6 +276,19 @@ void wxListBox::Delete(int n)
m_itemsClientData.RemoveAt(n);
// when the item disappears we must not keep using its index
if ( n == m_current )
{
m_current = -1;
}
else if ( n < m_current )
{
m_current--;
}
//else: current item may stay
m_selections.Remove(n);
m_updateScrollbarY = TRUE;
}
@@ -340,9 +353,16 @@ int wxListBox::GetSelection() const
return m_selections.IsEmpty() ? -1 : m_selections[0];
}
int wxCMPFUNC_CONV wxCompareInts(int *n, int *m)
{
return *n - *m;
}
int wxListBox::GetSelections(wxArrayInt& selections) const
{
// always return sorted array to the user
selections = m_selections;
selections.Sort(wxCompareInts);
return m_selections.GetCount();
}
@@ -393,9 +413,10 @@ void wxListBox::RefreshItems(int from, int count)
}
else // m_updateFrom >= from
{
m_updateCount = wxMax(m_updateCount,
from + count - m_updateFrom);
int updateLast = wxMax(m_updateFrom + m_updateCount,
from + count);
m_updateFrom = from;
m_updateCount = updateLast - m_updateFrom;
}
}
}