+wxSize wxBookCtrlBase::CalcSizeFromPage(const wxSize& sizePage) const
+{
+ // We need to add the size of the controller and the border between if it's
+ // shown. Notice that we don't use GetControllerSize() here as it returns
+ // the actual size while we want the best size here.
+ if ( !m_bookctrl || !m_bookctrl->IsShown() )
+ return sizePage;
+
+ const wxSize sizeController = m_bookctrl->GetBestSize();
+
+ wxSize size = sizePage;
+ if ( IsVertical() )
+ {
+ if ( sizeController.x > sizePage.x )
+ size.x = sizeController.x;
+ size.y += sizeController.y + GetInternalBorder();
+ }
+ else // left/right aligned
+ {
+ size.x += sizeController.x + GetInternalBorder();
+ if ( sizeController.y > sizePage.y )
+ size.y = sizeController.y;
+ }
+
+ return size;
+}
+