From: Vadim Zeitlin Date: Thu, 26 Jun 2003 10:05:13 +0000 (+0000) Subject: changing the number of items in wxHtmlListBox should flush the cache X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/034957673ccd2006aee3937c5b86245e51d4bf62 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 --- 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 // ----------------------------------------------------------------------------