/////////////////////////////////////////////////////////////////////////////
-// 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
#include "wx/string.h"
#include "wx/intl.h"
#include "wx/math.h"
+ #include "wx/utils.h"
#endif // WX_PRECOMP
#include "wx/sizer.h"
-#include "wx/utils.h"
#include "wx/statbox.h"
#include "wx/settings.h"
#include "wx/listimpl.cpp"
-#include "wx/intl.h"
+
#if WXWIN_COMPATIBILITY_2_4
#include "wx/notebook.h"
#endif
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 )
{
// Return a window size that will fit within the screens dimensions
wxSize wxSizer::FitSize( wxWindow *window )
{
+ if ( window->IsTopLevel() )
+ {
+ wxTopLevelWindow *tlw = wxDynamicCast(window, wxTopLevelWindow);
+ if ( tlw && tlw->IsAlwaysMaximized() )
+ {
+ return tlw->GetClientSize();
+ }
+ }
+
wxSize size = GetMinWindowSize( window );
wxSize sizeMax = GetMaxWindowSize( window );
#if wxUSE_BOOKCTRL
+#if WXWIN_COMPATIBILITY_2_6
+
wxBookCtrlSizer::wxBookCtrlSizer(wxBookCtrlBase *bookctrl)
: m_bookctrl(bookctrl)
{
wxASSERT_MSG( bookctrl, wxT("wxBookCtrlSizer needs a control") );
}
+#endif // WXWIN_COMPATIBILITY_2_6
+
void wxBookCtrlSizer::RecalcSizes()
{
m_bookctrl->SetSize( m_position.x, m_position.y, m_size.x, m_size.y );
#if wxUSE_NOTEBOOK
+#if WXWIN_COMPATIBILITY_2_6
+
wxNotebookSizer::wxNotebookSizer(wxNotebook *nb)
{
wxASSERT_MSG( nb, wxT("wxNotebookSizer needs a control") );
m_bookctrl = nb;
}
+#endif // WXWIN_COMPATIBILITY_2_6
+
#endif // wxUSE_NOTEBOOOK
#endif // wxUSE_BOOKCTRL