X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/93b87dd910cadc9d20b4a5b2a17e1bee5e60e2bc..ac6a837eeddb76f2fabe2389cf5fe39ca3b99041:/src/common/sizer.cpp diff --git a/src/common/sizer.cpp b/src/common/sizer.cpp index 88c971ab58..bcc5bad25b 100644 --- a/src/common/sizer.cpp +++ b/src/common/sizer.cpp @@ -209,18 +209,28 @@ void wxSizerItem::DoSetSpacer(const wxSize& size) wxSize wxSizerItem::AddBorderToSize(const wxSize& size) const { - if (size == wxDefaultSize) - return size; - wxSize result = size; - if (m_flag & wxWEST) - result.x += m_border; - if (m_flag & wxEAST) - result.x += m_border; - if (m_flag & wxNORTH) - result.y += m_border; - if (m_flag & wxSOUTH) - result.y += m_border; + + // Notice that we shouldn't modify the unspecified component(s) of the + // size, it's perfectly valid to have either min or max size specified in + // one direction only and it shouldn't be applied in the other one then. + + if ( result.x != wxDefaultCoord ) + { + 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; }