X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cc0bffacebe299b312ce7fdf49a8825f466cf73f..e1d6e01c88876f9ff57056e2847eaaa91b074abb:/include/wx/bookctrl.h diff --git a/include/wx/bookctrl.h b/include/wx/bookctrl.h index 883a27bebc..49952ecb2c 100644 --- a/include/wx/bookctrl.h +++ b/include/wx/bookctrl.h @@ -5,7 +5,7 @@ // Modified by: // Created: 19.08.03 // RCS-ID: $Id$ -// Copyright: (c) 2003 Vadim Zeitlin +// Copyright: (c) 2003 Vadim Zeitlin // Licence: wxWindows licence /////////////////////////////////////////////////////////////////////////////// @@ -79,6 +79,14 @@ public: // get the panel which represents the given page virtual wxWindow *GetPage(size_t n) { return m_pages[n]; } + // get the current page or NULL if none + wxWindow *GetCurrentPage() const + { + int n = GetSelection(); + return n == wxNOT_FOUND ? NULL + : wx_const_cast(wxBookCtrl *, this)->GetPage(n); + } + // get the currently selected page or wxNOT_FOUND if none virtual int GetSelection() const = 0; @@ -122,10 +130,19 @@ public: virtual bool DeletePage(size_t n); // remove one page from the notebook, without deleting it - virtual bool RemovePage(size_t n) { return DoRemovePage(n) != NULL; } + virtual bool RemovePage(size_t n) + { + InvalidateBestSize(); + return DoRemovePage(n) != NULL; + } // remove all pages and delete them - virtual bool DeleteAllPages() { WX_CLEAR_ARRAY(m_pages); return true; } + virtual bool DeleteAllPages() + { + InvalidateBestSize(); + WX_CLEAR_ARRAY(m_pages); + return true; + } // adds a new page to the control virtual bool AddPage(wxWindow *page, @@ -133,6 +150,7 @@ public: bool bSelect = false, int imageId = -1) { + InvalidateBestSize(); return InsertPage(GetPageCount(), page, text, bSelect, imageId); } @@ -146,7 +164,7 @@ public: // set the currently selected page, return the index of the previously // selected one (or -1 on error) // - // NB: this function will _not_ generate PAGE_CHANGING/ED events + // NB: this function will generate PAGE_CHANGING/ED events virtual int SetSelection(size_t n) = 0; @@ -177,6 +195,8 @@ protected: // common part of all ctors void Init(); + // Always rely on GetBestSize, which will look at all the pages + virtual void SetInitialBestSize(const wxSize& WXUNUSED(size)) { } // the array of all pages of this control wxArrayPages m_pages;