]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/bookctrl.cpp
VC6 compilation fix for native wxProgressDialog implementation.
[wxWidgets.git] / src / common / bookctrl.cpp
index 2ca683a7c2c16191760e5fc7cf194034656ae331..cfc13b78a3e537c3c80629e50cfc39037a6da1eb 100644 (file)
@@ -137,6 +137,28 @@ void wxBookCtrlBase::DoInvalidateBestSize()
         wxControl::InvalidateBestSize();
 }
 
+wxSize wxBookCtrlBase::CalcSizeFromPage(const wxSize& sizePage) const
+{
+    // we need to add the size of the choice control and the border between
+    const wxSize sizeController = GetControllerSize();
+
+    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;
+}
+
 void wxBookCtrlBase::SetPageSize(const wxSize& size)
 {
     SetClientSize(CalcSizeFromPage(size));
@@ -289,12 +311,11 @@ void wxBookCtrlBase::OnSize(wxSizeEvent& event)
 
 wxSize wxBookCtrlBase::GetControllerSize() const
 {
-    if(!m_bookctrl)
-        return wxSize(0,0);
+    if ( !m_bookctrl )
+        return wxSize(0, 0);
 
     const wxSize sizeClient = GetClientSize(),
-                 sizeBorder = m_bookctrl->GetSize() - m_bookctrl->GetClientSize(),
-                 sizeCtrl = m_bookctrl->GetBestSize() + sizeBorder;
+                 sizeCtrl = m_bookctrl->GetBestSize();
 
     wxSize size;