// Modified by:
// Created: 19.08.03
// RCS-ID: $Id$
-// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
+// Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwidgets.org>
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
// construction
// ------------
- wxBookCtrl();
+ wxBookCtrl()
+ {
+ Init();
+ }
wxBookCtrl(wxWindow *parent,
wxWindowID winid,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize,
long style = 0,
- const wxString& name = wxEmptyString);
+ const wxString& name = wxEmptyString)
+ {
+ Init();
+
+ (void)Create(parent, winid, pos, size, style, name);
+ }
// quasi ctor
bool Create(wxWindow *parent,
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,
bool bSelect = false,
int imageId = -1)
{
+ InvalidateBestSize();
return InsertPage(GetPageCount(), page, text, bSelect, imageId);
}
// 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;
}
}
+ virtual void ApplyParentThemeBackground(const wxColour& bg)
+ { SetBackgroundColour(bg); }
+
protected:
// remove the page and return a pointer to it
virtual wxWindow *DoRemovePage(size_t page) = 0;
// 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;