Invalidate wxListBox best size immediately without waiting for idle time.

Since r53743 the listbox best size was only invalidated during idle time but
this meant that it could be laid out using incorrect old best size. So while
we still defer (expensive) horizontal extent calculation until later, do
invalidate the best size immediately to ensure the listbox is laid out
correctly.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-05-08 10:28:01 +00:00
parent 1544ba0edc
commit 316bba0c72
2 changed files with 32 additions and 11 deletions

View File

@@ -145,6 +145,8 @@ public:
// returns true if the platform should explicitly apply a theme border
virtual bool CanApplyThemeBorder() const { return false; }
virtual void OnInternalIdle();
protected:
virtual wxSize DoGetBestClientSize() const;
@@ -164,8 +166,8 @@ protected:
// this can't be called DoHitTest() because wxWindow already has this method
virtual int DoHitTestList(const wxPoint& point) const;
bool m_updateHorizontalExtent;
virtual void OnInternalIdle();
// free memory (common part of Clear() and dtor)
void Free();
unsigned int m_noItems;
@@ -175,6 +177,14 @@ protected:
#endif
private:
// call this when items are added to or deleted from the listbox or an
// items text changes
void MSWOnItemsChanged();
// flag indicating whether the max horizontal extent should be updated,
// i.e. if we need to call SetHorizontalExtent() from OnInternalIdle()
bool m_updateHorizontalExtent;
DECLARE_DYNAMIC_CLASS_NO_COPY(wxListBox)
};