differences) in the window's bestsize
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31730
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
- wxGetPowerType() and wxGetBatteryState() addition
- wxSystemSettings::GetSystem*() members deprecated and replaced with
wxSystemSettings::Get*()
- wxGetPowerType() and wxGetBatteryState() addition
- wxSystemSettings::GetSystem*() members deprecated and replaced with
wxSystemSettings::Get*()
+- wxWindowBase::DoGetBestSize now includes the difference (if any) between
+ the client size and total size of the window. Code that sets the
+ client size using the best size, or that added extra space to sizers
+ to compensate for this bug may need to be changed.
+
{
if ( GetChildren().GetCount() > 0 )
{
{
if ( GetChildren().GetCount() > 0 )
{
- SetClientSize(GetBestSize());
+ SetSize(GetBestSize());
}
//else: do nothing if we have no children
}
}
//else: do nothing if we have no children
}
// return the size best suited for the current window
wxSize wxWindowBase::DoGetBestSize() const
{
// return the size best suited for the current window
wxSize wxWindowBase::DoGetBestSize() const
{
- return m_windowSizer->GetMinSize();
+ best = m_windowSizer->GetMinSize();
}
#if wxUSE_CONSTRAINTS
else if ( m_constraints )
}
#if wxUSE_CONSTRAINTS
else if ( m_constraints )
// will never return a size bigger than the current one :-(
}
// will never return a size bigger than the current one :-(
}
- return wxSize(maxX, maxY);
+ best = wxSize(maxX, maxY);
}
#endif // wxUSE_CONSTRAINTS
else if ( !GetChildren().empty()
}
#endif // wxUSE_CONSTRAINTS
else if ( !GetChildren().empty()
- return wxSize(maxX, maxY);
+ best = wxSize(maxX, maxY);
}
else // ! has children
{
}
else // ! has children
{
- // for a generic window there is no natural best size - just use either the
- // minimum size if there is one, or the current size
+ // For a generic window there is no natural best size - just use
+ // either the minimum size if there is one, or the current size.
+ // These are returned as-is, unadjusted by the client size difference.
if ( GetMinSize().IsFullySpecified() )
return GetMinSize();
else
return GetSize();
}
if ( GetMinSize().IsFullySpecified() )
return GetMinSize();
else
return GetSize();
}
+
+ // Add any difference between size and client size
+ wxSize diff = GetSize() - GetClientSize();
+ best.x += wxMax(0, diff.x);
+ best.y += wxMax(0, diff.y);
+
+ return best;