]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/sizer.cpp
removed the strange __WXMSW__ test in AddFile(bitmap) -- why should this function...
[wxWidgets.git] / src / common / sizer.cpp
index 5a300a0f9fd3d21779e92e1f639be32eacc69e9b..206f09a255ff4ee3fe6ea8ec7b881580abf30f38 100644 (file)
@@ -1820,15 +1820,28 @@ void wxFlexGridSizer::AdjustForGrowables(const wxSize& sz)
     }
 }
 
+bool wxFlexGridSizer::IsRowGrowable( size_t idx )
+{
+    return m_growableRows.Index( idx ) != wxNOT_FOUND;
+}
+
+bool wxFlexGridSizer::IsColGrowable( size_t idx )
+{
+    return m_growableCols.Index( idx ) != wxNOT_FOUND;
+}
 
 void wxFlexGridSizer::AddGrowableRow( size_t idx, int proportion )
 {
+    wxASSERT_MSG( !IsRowGrowable( idx ), 
+                  "AddGrowableRow() called for growable row" );
     m_growableRows.Add( idx );
     m_growableRowsProportions.Add( proportion );
 }
 
 void wxFlexGridSizer::AddGrowableCol( size_t idx, int proportion )
 {
+    wxASSERT_MSG( !IsColGrowable( idx ), 
+                  "AddGrowableCol() called for growable column" );
     m_growableCols.Add( idx );
     m_growableColsProportions.Add( proportion );
 }
@@ -1926,15 +1939,22 @@ void wxBoxSizer::RecalcSizes()
 
         // adjust the size in the major direction using the proportion
         wxCoord majorSize = GetSizeInMajorDir(sizeThis);
-        const int propItem = item->GetProportion();
-        if ( propItem )
+
+        // if there is not enough space, don't try to distribute negative space
+        // among the children, this would result in overlapping windows which
+        // we don't want
+        if ( delta > 0 )
         {
-            const int deltaItem = (delta * propItem) / totalProportion;
+            const int propItem = item->GetProportion();
+            if ( propItem )
+            {
+                const int deltaItem = (delta * propItem) / totalProportion;
 
-            majorSize += deltaItem;
+                majorSize += deltaItem;
 
-            delta -= deltaItem;
-            totalProportion -= propItem;
+                delta -= deltaItem;
+                totalProportion -= propItem;
+            }
         }