Update wxFlexGridSizer ctors to match (new) wxGridSizer ones.

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
This commit is contained in:
Vadim Zeitlin 2009-08-10 11:18:23 +00:00
parent c5cc7fbd27
commit 4a00e77ce6
4 changed files with 63 additions and 32 deletions

View 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

View 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
wxFlexGridSizer( int rows, int cols, int vgap, int hgap );
wxFlexGridSizer( int cols, int vgap = 0, int hgap = 0 );
virtual ~wxFlexGridSizer();
// 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 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)

View 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 );
//@}
/**

View File

@ -1317,22 +1317,6 @@ bool wxSizer::IsShown( size_t index ) const
// wxGridSizer
//---------------------------------------------------------------------------
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 rows, int cols, const wxSize& gap )
: m_rows( rows || cols ? rows : 1 ),
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 ),
m_cols( cols ),
@ -1349,6 +1333,22 @@ wxGridSizer::wxGridSizer( int cols, const wxSize& gap )
{
}
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 rows, int cols, const wxSize& gap )
: m_rows( rows || cols ? rows : 1 ),
m_cols( cols ),
m_vgap( gap.GetHeight() ),
m_hgap( gap.GetWidth() )
{
}
wxSizerItem *wxGridSizer::Insert(size_t index, wxSizerItem *item)
{
// if only the number of columns or the number of rows is specified for a
@ -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)
{