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

@@ -226,6 +226,7 @@ bool LboxTestApp::OnInit()
frame->Show(); frame->Show();
//wxLog::AddTraceMask(_T("listbox")); //wxLog::AddTraceMask(_T("listbox"));
wxLog::AddTraceMask(_T("scrollbar"));
return TRUE; return TRUE;
} }

View File

@@ -276,6 +276,19 @@ void wxListBox::Delete(int n)
m_itemsClientData.RemoveAt(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; m_updateScrollbarY = TRUE;
} }
@@ -340,9 +353,16 @@ int wxListBox::GetSelection() const
return m_selections.IsEmpty() ? -1 : m_selections[0]; 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 int wxListBox::GetSelections(wxArrayInt& selections) const
{ {
// always return sorted array to the user
selections = m_selections; selections = m_selections;
selections.Sort(wxCompareInts);
return m_selections.GetCount(); return m_selections.GetCount();
} }
@@ -393,9 +413,10 @@ void wxListBox::RefreshItems(int from, int count)
} }
else // m_updateFrom >= from else // m_updateFrom >= from
{ {
m_updateCount = wxMax(m_updateCount, int updateLast = wxMax(m_updateFrom + m_updateCount,
from + count - m_updateFrom); from + count);
m_updateFrom = from; m_updateFrom = from;
m_updateCount = updateLast - m_updateFrom;
} }
} }
} }

View File

@@ -275,8 +275,8 @@ wxHitTest wxRenderer::StandardHitTestScrollbar(const wxScrollBar *scrollbar,
int range = scrollbar->GetRange(); int range = scrollbar->GetRange();
if ( !range ) if ( !range )
{ {
thumbStart = // clicking the scrollbar without range has no effect
thumbEnd = 0; return wxHT_NOWHERE;
} }
else else
{ {

View File

@@ -158,10 +158,10 @@ public:
virtual wxRect GetTextTotalArea(const wxTextCtrl *text, virtual wxRect GetTextTotalArea(const wxTextCtrl *text,
const wxRect& rect) const wxRect& rect)
{ wxRect rectTotal = rect; rectTotal.Inflate(10); return rectTotal; } { wxRect rectTotal = rect; rectTotal.Inflate(2); return rectTotal; }
virtual wxRect GetTextClientArea(const wxTextCtrl *text, virtual wxRect GetTextClientArea(const wxTextCtrl *text,
const wxRect& rect) const wxRect& rect)
{ wxRect rectText = rect; rectText.Inflate(-10); return rectText; } { wxRect rectText = rect; rectText.Inflate(-2); return rectText; }
// helpers for "wxBitmap wxColourScheme::Get()" // helpers for "wxBitmap wxColourScheme::Get()"
void DrawCheckBitmap(wxDC& dc, const wxRect& rect); void DrawCheckBitmap(wxDC& dc, const wxRect& rect);