// initialize the current item if needed
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
//
// currently unused
wxListMainWindow::~wxListMainWindow()
{
- DeleteEverything();
+ DoDeleteAllItems();
delete m_highlightBrush;
wxCoord xOrig, yOrig;
CalcUnscrolledPosition(0, 0, &xOrig, &yOrig);
+ // tell the caller cache to cache the data
+ wxListEvent evCache(wxEVT_COMMAND_LIST_CACHE_HINT, GetParent()->GetId());
+ evCache.SetEventObject( GetParent() );
+ evCache.m_oldItemIndex = visibleFrom;
+ evCache.m_itemIndex = visibleTo;
+ GetParent()->GetEventHandler()->ProcessEvent( evCache );
+
for ( size_t line = visibleFrom; line <= visibleTo; line++ )
{
rectLine = GetLineRect(line);
ResetVisibleLinesRange();
- Refresh();
+ // scrollbars must be reset
+ m_dirty = TRUE;
}
int wxListMainWindow::GetSelectedItemCount()
void wxListMainWindow::RecalculatePositions()
{
- if ( IsEmpty() )
- return;
-
wxClientDC dc( this );
dc.SetFont( GetFont() );
m_columns.DeleteNode( node );
}
-void wxListMainWindow::DeleteAllItems()
+void wxListMainWindow::DoDeleteAllItems()
{
if ( IsEmpty() )
{
}
m_lines.Clear();
+}
- // NB: don't just set m_dirty to TRUE here as RecalculatePositions()
- // doesn't do anything if the control is empty and so we won't be
- // refreshed
- Refresh();
+void wxListMainWindow::DeleteAllItems()
+{
+ DoDeleteAllItems();
+
+ RecalculatePositions();
}
void wxListMainWindow::DeleteEverything()