If there is a sizer then use it's calculated minimum in wxStaticBox::DoGetBestSize
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71653 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -118,6 +118,9 @@ WXDWORD wxStaticBox::MSWGetStyle(long style, WXDWORD *exstyle) const
|
|||||||
|
|
||||||
wxSize wxStaticBox::DoGetBestSize() const
|
wxSize wxStaticBox::DoGetBestSize() const
|
||||||
{
|
{
|
||||||
|
wxSize best;
|
||||||
|
|
||||||
|
// Calculate the size needed by the label
|
||||||
int cx, cy;
|
int cx, cy;
|
||||||
wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
|
wxGetCharSize(GetHWND(), &cx, &cy, GetFont());
|
||||||
|
|
||||||
@@ -127,8 +130,19 @@ wxSize wxStaticBox::DoGetBestSize() const
|
|||||||
wBox += 3*cx;
|
wBox += 3*cx;
|
||||||
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
int hBox = EDIT_HEIGHT_FROM_CHAR_HEIGHT(cy);
|
||||||
|
|
||||||
wxSize best(wBox, hBox);
|
// If there is a sizer then the base best size is the sizer's minimum
|
||||||
CacheBestSize(best);
|
if (GetSizer() != NULL)
|
||||||
|
{
|
||||||
|
wxSize cm(GetSizer()->CalcMin());
|
||||||
|
best = ClientToWindowSize(cm);
|
||||||
|
// adjust for a long label if needed
|
||||||
|
best.x = wxMax(best.x, wBox);
|
||||||
|
}
|
||||||
|
// otherwise the best size falls back to the label size
|
||||||
|
else
|
||||||
|
{
|
||||||
|
best = wxSize(wBox, hBox);
|
||||||
|
}
|
||||||
return best;
|
return best;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user