+// Finds the best width and height given the parent's width and height
+wxSize wxRibbonPanel::GetBestSizeForParentSize(const wxSize& parentSize) const
+{
+ if (GetChildren().GetCount() == 1)
+ {
+ wxWindow* win = GetChildren().GetFirst()->GetData();
+ wxRibbonControl* control = wxDynamicCast(win, wxRibbonControl);
+ if (control)
+ {
+ wxClientDC temp_dc((wxRibbonPanel*) this);
+ wxSize clientParentSize = m_art->GetPanelClientSize(temp_dc, this, parentSize, NULL);
+ wxSize childSize = control->GetBestSizeForParentSize(clientParentSize);
+ wxSize overallSize = m_art->GetPanelSize(temp_dc, this, childSize, NULL);
+ return overallSize;
+ }
+ }
+ return GetSize();
+}
+