]> git.saurik.com Git - wxWidgets.git/commitdiff
Update wxFlexGridSizer ctors to match (new) wxGridSizer ones.
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 10 Aug 2009 11:18:23 +0000 (11:18 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 10 Aug 2009 11:18:23 +0000 (11:18 +0000)
Confusing wxFlexGridSizer(int cols, int vgap = 0, int hgap = 0) was removed as
well as corresponding wxGridSizer ctor overload. New ctor overloads taking gap
as wxSize were added.

See #11040.

Closes #11091.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61635 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

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

index a3f2ff23e27155d4989b5cbc20062085ee68bacc..494d413e22ce5c6a017af8d6cddc86e2261fd08f 100644 (file)
@@ -141,7 +141,8 @@ Changes in behaviour not resulting in compilation errors, please read this!
   easy to mistake for wxGridSizer(int rows, int cols) overload was removed, you
   will need to specify both vertical and horizontal gap if you want to use this
   overload or specify both rows and columns and the gap otherwise. Use of the
-  new constructors taking wxSize for the gap argument is preferred.
+  new constructors taking wxSize for the gap argument is preferred. The same
+  applies to wxFlexGridSizer as well.
 
 
 Changes in behaviour which may result in compilation errors
index f07d6f58863c5ee291d473eb3928099405fbb877..7839946cd1ff3d39751d26889cb436ea0d3abf9b 100644 (file)
@@ -730,8 +730,8 @@ public:
     wxGridSizer( int cols, const wxSize& gap = wxSize(0, 0) );
 
     // ctors specifying the number of rows and columns
-    wxGridSizer( int rows, int cols, const wxSize& gap );
     wxGridSizer( int rows, int cols, int vgap, int hgap );
+    wxGridSizer( int rows, int cols, const wxSize& gap );
 
     virtual wxSizerItem *Insert(size_t index, wxSizerItem *item);
 
@@ -794,11 +794,17 @@ enum wxFlexSizerGrowMode
 class WXDLLIMPEXP_CORE wxFlexGridSizer: public wxGridSizer
 {
 public:
-    // ctors/dtor
+    // ctors specifying the number of columns only: number of rows will be
+    // deduced automatically depending on the number of sizer elements
+    wxFlexGridSizer( int cols, int vgap, int hgap );
+    wxFlexGridSizer( int cols, const wxSize& gap = wxSize(0, 0) );
+
+    // ctors specifying the number of rows and columns
     wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
-    wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 );
-    virtual ~wxFlexGridSizer();
+    wxFlexGridSizer( int rows, int cols, const wxSize& gap );
 
+    // dtor
+    virtual ~wxFlexGridSizer();
 
     // set the rows/columns which will grow (the others will remain of the
     // constant initial size)
index 2296c39f61e93455528f5d0d1ce5a9730e2cfc20..886ba9ddb0d768a8e76365015044fbea02986813 100644 (file)
@@ -1435,17 +1435,27 @@ class wxFlexGridSizer : public wxGridSizer
 public:
     //@{
     /**
-        Constructor for a wxFlexGridSizer.
+        wxFlexGridSizer constructors.
 
-        @a rows and @a cols determine the number of columns and rows in the sizer -
-        if either of the parameters is zero, it will be calculated to form the
-        total number of children in the sizer, thus making the sizer grow
-        dynamically.
+        Usually only the number of columns in the flex grid sizer needs to be
+        specified using @a cols argument. The number of rows will be deduced
+        automatically depending on the number of the elements added to the
+        sizer. If the number of @a rows is explicitly specified (and not zero),
+        the sizer will check that it no more than @code cols*rows @endcode
+        elements are added to it.
 
-        @a vgap and @a hgap define extra space between all children.
+        The @a gap (or @a vgap and @a hgap, which correspond to the height and
+        width of the wxSize object) argument defines the size of the padding
+        between the rows (its vertical component, or @a vgap) and columns
+        (its horizontal component, or @a hgap), in pixels.
+
+        @since 2.9.1 (except for the four argument overload)
     */
-    wxFlexGridSizer(int rows, int cols, int vgap, int hgap);
-    wxFlexGridSizer(int cols, int vgap = 0, int hgap = 0);
+    wxFlexGridSizer( int cols, int vgap, int hgap );
+    wxFlexGridSizer( int cols, const wxSize& gap = wxSize(0, 0) );
+
+    wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
+    wxFlexGridSizer( int rows, int cols, const wxSize& gap );
     //@}
 
     /**
index e9e7ad1193674e6d5d33b999618923441b7ce649..3d94c8bce844a12d93ed9b71649cfa25b1280b97 100644 (file)
@@ -1317,32 +1317,32 @@ bool wxSizer::IsShown( size_t index ) const
 // wxGridSizer
 //---------------------------------------------------------------------------
 
-wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap )
-    : m_rows( rows || cols ? rows : 1 ),
+wxGridSizer::wxGridSizer( int cols, int vgap, int hgap )
+    : m_rows( cols == 0 ? 1 : 0 ),
       m_cols( cols ),
       m_vgap( vgap ),
       m_hgap( hgap )
 {
 }
 
-wxGridSizer::wxGridSizer( int rows, int cols, const wxSize& gap )
-    : m_rows( rows || cols ? rows : 1 ),
+wxGridSizer::wxGridSizer( int cols, const wxSize& gap )
+    : m_rows( cols == 0 ? 1 : 0 ),
       m_cols( cols ),
       m_vgap( gap.GetHeight() ),
       m_hgap( gap.GetWidth() )
 {
 }
 
-wxGridSizer::wxGridSizer( int cols, int vgap, int hgap )
-    : m_rows( cols == 0 ? 1 : 0 ),
+wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap )
+    : m_rows( rows || cols ? rows : 1 ),
       m_cols( cols ),
       m_vgap( vgap ),
       m_hgap( hgap )
 {
 }
 
-wxGridSizer::wxGridSizer( int cols, const wxSize& gap )
-    : m_rows( cols == 0 ? 1 : 0 ),
+wxGridSizer::wxGridSizer( int rows, int cols, const wxSize& gap )
+    : m_rows( rows || cols ? rows : 1 ),
       m_cols( cols ),
       m_vgap( gap.GetHeight() ),
       m_hgap( gap.GetWidth() )
@@ -1541,6 +1541,20 @@ void wxGridSizer::SetItemBounds( wxSizerItem *item, int x, int y, int w, int h )
 // wxFlexGridSizer
 //---------------------------------------------------------------------------
 
+wxFlexGridSizer::wxFlexGridSizer( int cols, int vgap, int hgap )
+               : wxGridSizer( cols, vgap, hgap ),
+                 m_flexDirection(wxBOTH),
+                 m_growMode(wxFLEX_GROWMODE_SPECIFIED)
+{
+}
+
+wxFlexGridSizer::wxFlexGridSizer( int cols, const wxSize& gap )
+               : wxGridSizer( cols, gap ),
+                 m_flexDirection(wxBOTH),
+                 m_growMode(wxFLEX_GROWMODE_SPECIFIED)
+{
+}
+
 wxFlexGridSizer::wxFlexGridSizer( int rows, int cols, int vgap, int hgap )
                : wxGridSizer( rows, cols, vgap, hgap ),
                  m_flexDirection(wxBOTH),
@@ -1548,8 +1562,8 @@ wxFlexGridSizer::wxFlexGridSizer( int rows, int cols, int vgap, int hgap )
 {
 }
 
-wxFlexGridSizer::wxFlexGridSizer( int cols, int vgap, int hgap )
-               : wxGridSizer( cols, vgap, hgap ),
+wxFlexGridSizer::wxFlexGridSizer( int rows, int cols, const wxSize& gap )
+               : wxGridSizer( rows, cols, gap ),
                  m_flexDirection(wxBOTH),
                  m_growMode(wxFLEX_GROWMODE_SPECIFIED)
 {