fix for rather mysterious problem when deleting the list ctrl

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11129 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2001-07-20 20:54:17 +00:00
parent 2350e91520
commit 5fe143dfdf

View File

@@ -819,6 +819,9 @@ private:
// initialize the current item if needed // initialize the current item if needed
void UpdateCurrent(); void UpdateCurrent();
// delete all items but don't refresh: called from dtor
void DoDeleteAllItems();
// called when an item is [un]focuded, i.e. becomes [not] current // called when an item is [un]focuded, i.e. becomes [not] current
// //
// currently unused // currently unused
@@ -2159,7 +2162,7 @@ wxListMainWindow::wxListMainWindow( wxWindow *parent,
wxListMainWindow::~wxListMainWindow() wxListMainWindow::~wxListMainWindow()
{ {
DeleteEverything(); DoDeleteAllItems();
delete m_highlightBrush; delete m_highlightBrush;
@@ -3549,7 +3552,8 @@ void wxListMainWindow::SetItemCount(long count)
ResetVisibleLinesRange(); ResetVisibleLinesRange();
Refresh(); // scrollbars must be reset
m_dirty = TRUE;
} }
int wxListMainWindow::GetSelectedItemCount() int wxListMainWindow::GetSelectedItemCount()
@@ -3608,9 +3612,6 @@ bool wxListMainWindow::GetItemPosition(long item, wxPoint& pos)
void wxListMainWindow::RecalculatePositions() void wxListMainWindow::RecalculatePositions()
{ {
if ( IsEmpty() )
return;
wxClientDC dc( this ); wxClientDC dc( this );
dc.SetFont( GetFont() ); dc.SetFont( GetFont() );
@@ -3839,7 +3840,7 @@ void wxListMainWindow::DeleteColumn( int col )
m_columns.DeleteNode( node ); m_columns.DeleteNode( node );
} }
void wxListMainWindow::DeleteAllItems() void wxListMainWindow::DoDeleteAllItems()
{ {
if ( IsEmpty() ) if ( IsEmpty() )
{ {
@@ -3871,11 +3872,13 @@ void wxListMainWindow::DeleteAllItems()
} }
m_lines.Clear(); m_lines.Clear();
}
// NB: don't just set m_dirty to TRUE here as RecalculatePositions() void wxListMainWindow::DeleteAllItems()
// doesn't do anything if the control is empty and so we won't be {
// refreshed DoDeleteAllItems();
Refresh();
RecalculatePositions();
} }
void wxListMainWindow::DeleteEverything() void wxListMainWindow::DeleteEverything()