invalidate best size of the book controller too when the pages are added/removed, this fixes a lot of sizing problems with treebook

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43027 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-11-04 12:20:09 +00:00
parent 72db44b528
commit e8a147a6c3
5 changed files with 157 additions and 140 deletions

View File

@@ -168,14 +168,14 @@ public:
// remove one page from the notebook, without deleting it
virtual bool RemovePage(size_t n)
{
InvalidateBestSize();
DoInvalidateBestSize();
return DoRemovePage(n) != NULL;
}
// remove all pages and delete them
virtual bool DeleteAllPages()
{
InvalidateBestSize();
DoInvalidateBestSize();
WX_CLEAR_ARRAY(m_pages);
return true;
}
@@ -186,7 +186,7 @@ public:
bool bSelect = false,
int imageId = -1)
{
InvalidateBestSize();
DoInvalidateBestSize();
return InsertPage(GetPageCount(), page, text, bSelect, imageId);
}
@@ -229,6 +229,7 @@ public:
// we do have multiple pages
virtual bool HasMultiplePages() const { return true; }
protected:
// flags for DoSetSelection()
enum
@@ -279,6 +280,11 @@ protected:
// Lay out controls
void DoSize();
// This method also invalidates the size of the controller and should be
// called instead of just InvalidateBestSize() whenever pages are added or
// removed as this also affects the controller
void DoInvalidateBestSize();
#if wxUSE_HELP
// Show the help for the corresponding page
void OnHelp(wxHelpEvent& event);
@@ -308,10 +314,10 @@ protected:
bool m_fitToCurrentPage;
// the sizer containing the choice control
wxSizer* m_controlSizer;
wxSizer *m_controlSizer;
// the margin around the choice control
int m_controlMargin;
int m_controlMargin;
private: