Fix handling of not fully specified min/max size in wxBoxSizer.
wxSizerItem::AddBorderToSize() added in r72344 (see #11497) didn't work correctly as it replaced unspecified (i.e. set to -1) components of wxSize with the small positive values that did take effect, contrary to the intention. Fix it to only adjust the actually set component(s) of wxSize. Closes #14696. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72586 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -209,18 +209,28 @@ void wxSizerItem::DoSetSpacer(const wxSize& size)
|
|||||||
|
|
||||||
wxSize wxSizerItem::AddBorderToSize(const wxSize& size) const
|
wxSize wxSizerItem::AddBorderToSize(const wxSize& size) const
|
||||||
{
|
{
|
||||||
if (size == wxDefaultSize)
|
|
||||||
return size;
|
|
||||||
|
|
||||||
wxSize result = size;
|
wxSize result = size;
|
||||||
if (m_flag & wxWEST)
|
|
||||||
result.x += m_border;
|
// Notice that we shouldn't modify the unspecified component(s) of the
|
||||||
if (m_flag & wxEAST)
|
// size, it's perfectly valid to have either min or max size specified in
|
||||||
result.x += m_border;
|
// one direction only and it shouldn't be applied in the other one then.
|
||||||
if (m_flag & wxNORTH)
|
|
||||||
result.y += m_border;
|
if ( result.x != wxDefaultCoord )
|
||||||
if (m_flag & wxSOUTH)
|
{
|
||||||
result.y += m_border;
|
if (m_flag & wxWEST)
|
||||||
|
result.x += m_border;
|
||||||
|
if (m_flag & wxEAST)
|
||||||
|
result.x += m_border;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( result.y != wxDefaultCoord )
|
||||||
|
{
|
||||||
|
if (m_flag & wxNORTH)
|
||||||
|
result.y += m_border;
|
||||||
|
if (m_flag & wxSOUTH)
|
||||||
|
result.y += m_border;
|
||||||
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user