From 034957673ccd2006aee3937c5b86245e51d4bf62 Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Thu, 26 Jun 2003 10:05:13 +0000
Subject: [PATCH] changing the number of items in wxHtmlListBox should flush
 the cache

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@21421 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 include/wx/htmllbox.h    | 4 ++--
 include/wx/vlbox.h       | 2 +-
 src/generic/htmllbox.cpp | 8 ++++++++
 3 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/include/wx/htmllbox.h b/include/wx/htmllbox.h
index 97f2ae413e..666717632b 100644
--- a/include/wx/htmllbox.h
+++ b/include/wx/htmllbox.h
@@ -61,9 +61,9 @@ public:
     // destructor cleans up whatever resources we use
     virtual ~wxHtmlListBox();
 
-    // refresh everything
+    // override some base class virtuals
     virtual void RefreshAll();
-
+    virtual void SetItemCount(size_t count);
 
 protected:
     // this method must be implemented in the derived class and should return
diff --git a/include/wx/vlbox.h b/include/wx/vlbox.h
index 5e09100e7f..276076ece7 100644
--- a/include/wx/vlbox.h
+++ b/include/wx/vlbox.h
@@ -130,7 +130,7 @@ public:
     // set the number of items to be shown in the control
     //
     // this is just a synonym for wxVScrolledWindow::SetLineCount()
-    void SetItemCount(size_t count);
+    virtual void SetItemCount(size_t count);
 
     // delete all items from the control
     void Clear() { SetItemCount(0); }
diff --git a/src/generic/htmllbox.cpp b/src/generic/htmllbox.cpp
index a9d2f468c3..dff147a45c 100644
--- a/src/generic/htmllbox.cpp
+++ b/src/generic/htmllbox.cpp
@@ -262,6 +262,14 @@ void wxHtmlListBox::RefreshAll()
     wxVListBox::RefreshAll();
 }
 
+void wxHtmlListBox::SetItemCount(size_t count)
+{
+    // the items are going to change, forget the old ones
+    m_cache->Clear();
+
+    wxVListBox::SetItemCount(count);
+}
+
 // ----------------------------------------------------------------------------
 // wxHtmlListBox implementation of wxVListBox pure virtuals
 // ----------------------------------------------------------------------------
-- 
2.47.2