void ReverseHighlight( size_t line )
{ HighlightLine(line, !IsHighlighted(line)); RefreshLine(line); }
+ // return true if the line is highlighted
+ bool IsHighlighted(size_t line) const;
+
// refresh one or several lines at once
void RefreshLine( size_t line );
void RefreshLines( size_t lineFrom, size_t lineTo );
- // return true if the line is highlighted
- bool IsHighlighted(size_t line) const;
+ // refresh all lines below the given one: the difference with
+ // RefreshLines() is that the index here might not be a valid one (happens
+ // when the last line is deleted)
+ void RefreshAfter( size_t lineFrom );
// the methods which are forwarded to wxListLineData itself in list/icon
// modes but are here because the lines don't store their positions in the
// we suppose that they are ordered by caller
wxASSERT_MSG( lineFrom <= lineTo, _T("indices in disorder") );
+ wxASSERT_MSG( lineTo < GetItemCount(), _T("invalid line range") );
+
if ( HasFlag(wxLC_REPORT) )
{
size_t visibleFrom, visibleTo;
}
}
+void wxListMainWindow::RefreshAfter( size_t lineFrom )
+{
+ if ( HasFlag(wxLC_REPORT) )
+ {
+ size_t visibleFrom;
+ GetVisibleLinesRange(&visibleFrom, NULL);
+
+ if ( lineFrom < visibleFrom )
+ lineFrom = visibleFrom;
+
+ wxRect rect;
+ rect.x = 0;
+ rect.y = GetLineY(lineFrom);
+
+ wxSize size = GetClientSize();
+ rect.width = size.x;
+ // refresh till the bottom of the window
+ rect.height = size.y - rect.y;
+
+ CalcScrolledPosition( rect.x, rect.y, &rect.x, &rect.y );
+ RefreshRect( rect );
+
+ }
+ else // !report
+ {
+ // TODO: how to do it more efficiently?
+ m_dirty = TRUE;
+ }
+}
+
void wxListMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
{
// Note: a wxPaintDC must be constructed even if no drawing is
if ( InReportView() )
{
- if ( m_lineTo == GetItemCount() - 1 )
- {
- m_lineTo--;
- }
+ ResetVisibleLinesRange();
}
- // refresh before removing the line
- RefreshLines(index, GetItemCount() - 1);
-
if ( IsVirtual() )
{
m_countVirt--;
{
m_lines.RemoveAt( index );
}
+
+ RefreshAfter(index);
}
void wxListMainWindow::DeleteColumn( int col )
ResetVisibleLinesRange();
}
+ if ( InReportView() )
+ {
+ ResetVisibleLinesRange();
+ }
+
m_lines.Clear();
m_selStore.Clear();
m_lineTo = count - 1;
}
+ wxASSERT_MSG( m_lineFrom <= m_lineTo && m_lineTo < GetItemCount(),
+ _T("GetVisibleLinesRange() returns incorrect result") );
+
if ( from )
*from = m_lineFrom;
if ( to )