// Copyright: (C) Peter Cawley
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
+
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
+#if wxUSE_RIBBON
+
+#include "wx/ribbon/panel.h"
#include "wx/ribbon/art.h"
#include "wx/ribbon/bar.h"
-#include "wx/ribbon/panel.h"
#include "wx/dcbuffer.h"
#include "wx/display.h"
-#include "wx/frame.h"
-
-#if wxUSE_RIBBON
+#include "wx/sizer.h"
#ifndef WX_PRECOMP
+#include "wx/frame.h"
#endif
#ifdef __WXMSW__
EVT_SIZE(wxRibbonPanel::OnSize)
END_EVENT_TABLE()
-wxRibbonPanel::wxRibbonPanel()
+wxRibbonPanel::wxRibbonPanel() : m_expanded_dummy(NULL), m_expanded_panel(NULL)
{
}
Refresh();
}
-
+
wxRibbonControl::DoSetSize(x, y, width, height, sizeFlags);
}
return false;
return (at_size.GetX() <= m_minimised_size.GetX() &&
- at_size.GetY() <= m_minimised_size.GetY()) ||
+ at_size.GetY() <= m_minimised_size.GetY()) ||
at_size.GetX() < m_smallest_unminimised_size.GetX() ||
at_size.GetY() < m_smallest_unminimised_size.GetY();
}
return true;
}
- // TODO: Delegate to a sizer
+ // Get wxRibbonPanel client size
+ wxPoint position;
+ wxClientDC dc(this);
+ wxSize size = m_art->GetPanelClientSize(dc, this, GetSize(), &position);
- // Common case of no sizer and single child taking up the entire panel
- if(GetChildren().GetCount() == 1)
+ // If there is a sizer, use it instead
+ if ( GetSizer() )
+ {
+ GetSizer()->SetDimension(position.x, position.y, size.GetWidth(), size.GetHeight());
+ }
+ else if(GetChildren().GetCount() == 1)
{
+ // Common case of no sizer and single child taking up the entire panel
wxWindow* child = GetChildren().Item(0)->GetData();
- wxPoint position;
- wxClientDC dc(this);
- wxSize size = m_art->GetPanelClientSize(dc, this, GetSize(), &position);
child->SetSize(position.x, position.y, size.GetWidth(), size.GetHeight());
}
return true;