// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "sizer.h"
-#endif
-
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/intl.h"
+ #include "wx/math.h"
#endif // WX_PRECOMP
#include "wx/sizer.h"
IMPLEMENT_CLASS(wxStdDialogButtonSizer, wxBoxSizer)
#endif
-WX_DEFINE_EXPORTED_LIST( wxSizerItemList );
+WX_DEFINE_EXPORTED_LIST( wxSizerItemList )
/*
TODO PROPERTIES
// if we have to preserve aspect ratio _AND_ this is
// the first-time calculation, consider ret to be initial size
- if ((m_flag & wxSHAPED) && !m_ratio)
+ if ( (m_flag & wxSHAPED) && wxIsNullDouble(m_ratio) )
SetRatio(m_minSize);
}
else if ( IsWindow() )
}
-void wxSizerItem::SetDimension( wxPoint pos, wxSize size )
+void wxSizerItem::SetDimension( const wxPoint& pos_, const wxSize& size_ )
{
+ wxPoint pos = pos_;
+ wxSize size = size_;
if (m_flag & wxSHAPED)
{
// adjust aspect ratio
m_window->Destroy();
//Putting this after the switch will result in a spacer
//not being deleted properly on destruction
- m_kind = Item_None;
+ m_kind = Item_None;
break;
case Item_Sizer:
switch ( m_kind )
{
case Item_None:
- wxFAIL_MSG( _T("uninitialized sizer item") );
+ // we may be called from CalcMin(), just return false so that we're
+ // not used
break;
case Item_Window:
//---------------------------------------------------------------------------
wxGridSizer::wxGridSizer( int rows, int cols, int vgap, int hgap )
- : m_rows( rows )
+ : m_rows( ( cols == 0 && rows == 0 ) ? 1 : rows )
, m_cols( cols )
, m_vgap( vgap )
, m_hgap( hgap )
{
- if (m_rows == 0 && m_cols == 0)
- m_rows = 1;
}
wxGridSizer::wxGridSizer( int cols, int vgap, int hgap )
- : m_rows( 0 )
+ : m_rows( cols == 0 ? 1 : 0 )
, m_cols( cols )
, m_vgap( vgap )
, m_hgap( hgap )
{
- if (m_rows == 0 && m_cols == 0)
- m_rows = 1;
}
int wxGridSizer::CalcRowsCols(int& nrows, int& ncols) const
wxArrayInt& array = m_flexDirection == wxVERTICAL ? m_colWidths
: m_rowHeights;
- const int count = array.GetCount();
+ const size_t count = array.GetCount();
// find the largest value in this array
- int n, largest = 0;
+ size_t n;
+ int largest = 0;
+
for ( n = 0; n < count; ++n )
{
if ( array[n] > largest )
Add((wxWindow*)m_buttonHelp, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonHelp->ConvertDialogToPixels(wxSize(2, 0)).x);
#else
// GTK+1 and any other platform
-
+
// Add(0, 0, 0, wxLEFT, 5); // Not sure what this was for but it unbalances the dialog
if (m_buttonHelp)
Add((wxWindow*)m_buttonHelp, 0, wxALIGN_CENTRE | wxLEFT | wxRIGHT, m_buttonHelp->ConvertDialogToPixels(wxSize(4, 0)).x);