]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/notebook.cpp
allow specifying the mask colour in wxImage::ConvertAlphaToMask() (closes #10143)
[wxWidgets.git] / src / msw / notebook.cpp
index 6ee2c39230b7c9b38020bb69fe8ccca0f2e0a836..a4ee7df0d4a6863732b773e3706f64bc0f2b1efd 100644 (file)
@@ -325,7 +325,7 @@ bool wxNotebook::Create(wxWindow *parent,
             if ( ::GetClassInfo(NULL, WC_TABCONTROL, &wc) )
             {
                 gs_wndprocNotebook =
-                    wx_reinterpret_cast(WXFARPROC, wc.lpfnWndProc);
+                    reinterpret_cast<WXFARPROC>(wc.lpfnWndProc);
                 wc.lpszClassName = wxT("_wx_SysTabCtl32");
                 wc.style &= ~(CS_HREDRAW | CS_VREDRAW);
                 wc.hInstance = wxGetInstance();
@@ -653,16 +653,18 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
         tabSize.y = rect.bottom - rect.top;
     }
 
+    const int rows = GetRowCount();
+
     // add an extra margin in both directions
     const int MARGIN = 8;
     if ( IsVertical() )
     {
         sizeTotal.x += MARGIN;
-        sizeTotal.y += tabSize.y + MARGIN;
+        sizeTotal.y += tabSize.y * rows + MARGIN;
     }
     else // horizontal layout
     {
-        sizeTotal.x += tabSize.x + MARGIN;
+        sizeTotal.x += tabSize.x * rows + MARGIN;
         sizeTotal.y += MARGIN;
     }
 
@@ -1026,6 +1028,10 @@ void wxNotebook::OnSize(wxSizeEvent& event)
                     MAKELPARAM(rc.right, rc.bottom));
             s_isInOnSize = false;
         }
+
+        // The best size depends on the number of rows of tabs, which can
+        // change when the notepad is resized.
+        InvalidateBestSize();
     }
 
 #if wxUSE_UXTHEME