Add possibility to use sizers in ribbon panel, fixes #12404: wxRibbonPanel and wxSizer

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2010-08-29 09:42:55 +00:00
parent c063e45035
commit 66ddc77b88
2 changed files with 33 additions and 9 deletions

View File

@@ -577,15 +577,20 @@ bool wxRibbonPanel::Layout()
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;