]> git.saurik.com Git - wxWidgets.git/commitdiff
added wxFlexGridSizer::Add{Row,Col}Growable() (#2603)
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 Jul 2008 18:06:50 +0000 (18:06 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 13 Jul 2008 18:06:50 +0000 (18:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54607 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

docs/changes.txt
include/wx/sizer.h
interface/wx/sizer.h
src/common/sizer.cpp

index 57a2def444411288cb5fbc4b59c471b238876bfd..90ff54651148d1b764774b93dfa2f38e256de541 100644 (file)
@@ -372,6 +372,7 @@ All (GUI):
 - Implement wxListCtrl::GetSubItemRect() in generic version (David Barnard).
 - Added wxVListBox::GetItemRect() (Javier Urien).
 - Show busy cursor in wxLaunchDefaultBrowser and add wxBROWSER_NOBUSYCURSOR.
+- Added wxFlexGridSizer::Is{Row,Col}Growable() (Marcin Wojdyr).
 
 wxGTK:
 
index 85c5292c4ff3f763f45e7c51a0e5801a65d3e737..771fcf5f1ab47538aa5d01d1ccc293464f33dae2 100644 (file)
@@ -785,6 +785,8 @@ public:
     void AddGrowableCol( size_t idx, int proportion = 0 );
     void RemoveGrowableCol( size_t idx );
 
+    bool IsRowGrowable( size_t idx );
+    bool IsColGrowable( size_t idx );
 
     // the sizer cells may grow in both directions, not grow at all or only
     // grow in one direction but not the other
index 66c5d207faf3851a9bcf99bc557481512d44075a..0bd0c7cf0bbda0126b964ba85b6785b4b4444048 100644 (file)
@@ -571,17 +571,24 @@ public:
     /**
         Specifies that column @a idx (starting from zero) should be grown if
         there is extra space available to the sizer.
-        The @a proportion parameter has the same meaning as the stretch factor for
-        the sizers() except that if all proportions are 0,
-        then all columns are resized equally (instead of not being resized at all).
+
+        The @a proportion parameter has the same meaning as the stretch factor
+        for the sizers() except that if all proportions are 0, then all columns
+        are resized equally (instead of not being resized at all).
+
+        Notice that the row must not be already growable, if you need to change
+        the proportion you must call RemoveGrowableCol() first and then make it
+        growable (with a different proportion) again. You can use IsColGrowable()
+        to check whether a column is already growable.
     */
     void AddGrowableCol(size_t idx, int proportion = 0);
 
     /**
         Specifies that row idx (starting from zero) should be grown if there
         is extra space available to the sizer.
-        See AddGrowableCol() for the description
-        of @a proportion parameter.
+
+        This is identical to AddGrowableCol() except that it works with rows
+        and not columns.
     */
     void AddGrowableRow(size_t idx, int proportion = 0);
 
@@ -606,6 +613,20 @@ public:
     */
     int GetNonFlexibleGrowMode() const;
 
+    /**
+        Returns @true if column @a idx is growable.
+
+        @since 2.9.0
+    */
+    bool IsColGrowable(size_t idx);
+
+    /**
+        Returns @true if row @a idx is growable.
+
+        @since 2.9.0
+    */
+    bool IsRowGrowable(size_t idx);
+
     /**
         Specifies that column idx is no longer growable.
     */
index 5a300a0f9fd3d21779e92e1f639be32eacc69e9b..071ee210399dd61bff052261de581b394e3ba23e 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 );
 }