]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/sizer.cpp
Removed run-time dependency on libpangocairo
[wxWidgets.git] / src / common / sizer.cpp
index 1258062d21ceb2c67881fdfa2acf0cf7eee3e528..1df3fd4885dc1eeb473179b28def08c89f2adb90 100644 (file)
@@ -522,6 +522,9 @@ wxSizerItem* wxSizer::Insert( size_t index, wxSizerItem *item )
     if ( item->GetWindow() )
         item->GetWindow()->SetContainingSizer( this );
 
+    if ( item->GetSizer() )
+        item->GetSizer()->SetContainingWindow( m_containingWindow );
+
     return item;
 }
 
@@ -1352,6 +1355,8 @@ void wxFlexGridSizer::RecalcSizes()
     AdjustForGrowables(sz);
 
     wxSizerItemList::const_iterator i = m_children.begin();
+    const wxSizerItemList::const_iterator end = m_children.end();
+
     int y = 0;
     for ( int r = 0; r < nrows; r++ )
     {
@@ -1359,7 +1364,12 @@ void wxFlexGridSizer::RecalcSizes()
         {
             // this row is entirely hidden, skip it
             for ( int c = 0; c < ncols; c++ )
+            {
+                if ( i == end )
+                    return;
+
                 ++i;
+            }
 
             continue;
         }
@@ -1370,22 +1380,13 @@ void wxFlexGridSizer::RecalcSizes()
             h = hrow;
 
         int x = 0;
-        for ( int c = 0; c < ncols; c++, ++i )
+        for ( int c = 0; c < ncols && i != end; c++, ++i )
         {
             const int wcol = m_colWidths[c];
 
             if ( wcol == -1 )
                 continue;
 
-            // check if there are any remaining children: it may happen that
-            // the last row is incomplete
-            if ( i == m_children.end() )
-            {
-                wxASSERT_MSG( r == nrows - 1, _T("too few items") );
-
-                return;
-            }
-
             int w = sz.x - x; // max possible value, ensure we don't overflow
             if ( wcol < w )
                 w = wcol;
@@ -1395,6 +1396,9 @@ void wxFlexGridSizer::RecalcSizes()
             x += wcol + m_hgap;
         }
 
+        if ( i == end )
+            return;
+
         y += hrow + m_vgap;
     }
 }
@@ -1973,7 +1977,7 @@ void wxStdDialogButtonSizer::Realize()
             Add((wxWindow*)m_buttonNegative, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);
         }
 
-        // according to HIG, in explicit apply windows the order is: 
+        // according to HIG, in explicit apply windows the order is:
         // [ Help                     Apply   Cancel   OK ]
         if (m_buttonApply)
             Add((wxWindow*)m_buttonApply, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, 3);