/////////////////////////////////////////////////////////////////////////////
-// Name: sizer.cpp
+// Name: src/common/sizer.cpp
// Purpose: provide new wxSizer class for layout
// Author: Robert Roebling and Robin Dunn, contributions by
// Dirk Holtwick, Ron Lee
#ifndef WX_PRECOMP
#include "wx/string.h"
#include "wx/intl.h"
+ #include "wx/math.h"
#endif // WX_PRECOMP
#include "wx/sizer.h"
// 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() )
return m_window->IsShown();
case Item_Sizer:
- return m_sizer->IsShown();
+ // arbitrarily decide that if at least one of our elements is
+ // shown, so are we (this arbitrariness is the reason for
+ // deprecating this function)
+ {
+ for ( wxSizerItemList::compatibility_iterator
+ node = m_sizer->GetChildren().GetFirst();
+ node;
+ node = node->GetNext() )
+ {
+ if ( node->GetData()->IsShown() )
+ return true;
+ }
+ }
+ return false;
case Item_Spacer:
return m_spacer->IsShown();
return false;
}
+#if WXWIN_COMPATIBILITY_2_6
void wxSizerItem::SetOption( int option )
{
SetProportion( option );
{
return GetProportion();
}
+#endif // WXWIN_COMPATIBILITY_2_6
//---------------------------------------------------------------------------
// wxSizer
//---------------------------------------------------------------------------
-wxSizer::wxSizer()
-{
- m_isShown = true;
-}
-
wxSizer::~wxSizer()
{
WX_CLEAR_LIST(wxSizerItemList, m_children);
return item;
}
+#if WXWIN_COMPATIBILITY_2_6
bool wxSizer::Remove( wxWindow *window )
{
return Detach( window );
}
+#endif // WXWIN_COMPATIBILITY_2_6
bool wxSizer::Remove( wxSizer *sizer )
{
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 )