]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/vscroll.cpp
changing the number of items in wxHtmlListBox should flush the cache
[wxWidgets.git] / src / generic / vscroll.cpp
index 4a9cc64d7c38ec6794134a4c358afcff71ace79b..f0c58c61b89aff92f5844ef3aa972c15ef2d9398 100644 (file)
@@ -202,6 +202,35 @@ void wxVScrolledWindow::RefreshLine(size_t line)
     RefreshRect(rect);
 }
 
+void wxVScrolledWindow::RefreshLines(size_t from, size_t to)
+{
+    wxASSERT_MSG( from <= to, _T("RefreshLines(): empty range") );
+
+    // clump the range to just the visible lines -- it is useless to refresh
+    // the other ones
+    if ( from < GetFirstVisibleLine() )
+        from = GetFirstVisibleLine();
+
+    if ( to > GetLastVisibleLine() )
+        to = GetLastVisibleLine();
+
+    // calculate the rect occupied by these lines on screen
+    wxRect rect;
+    rect.width = GetClientSize().x;
+    for ( size_t nBefore = GetFirstVisibleLine(); nBefore < from; nBefore++ )
+    {
+        rect.y += OnGetLineHeight(nBefore);
+    }
+
+    for ( size_t nBetween = from; nBetween <= to; nBetween++ )
+    {
+        rect.height += OnGetLineHeight(nBetween);
+    }
+
+    // do refresh it
+    RefreshRect(rect);
+}
+
 void wxVScrolledWindow::RefreshAll()
 {
     UpdateScrollbar();