X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4e00f54113a7d86b94a839b0f4c1a2fca54a3001..878711c01c1b9ad5b97d35f379a048b8ce1bfb49:/src/common/layout.cpp diff --git a/src/common/layout.cpp b/src/common/layout.cpp index 3b9ec73f6f..1dd0c63123 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -5,8 +5,8 @@ // Modified by: // Created: 04/01/98 // RCS-ID: $Id$ -// Copyright: (c) Julian Smart and Markus Holzem -// Licence: wxWindows license +// Copyright: (c) Julian Smart +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// // ============================================================================= @@ -66,13 +66,21 @@ wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint() void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg) { + if (rel == wxSameAs) + { + // If Set is called by the user with wxSameAs then call SameAs to do + // it since it will actually use wxPercent instead. + SameAs(otherW, otherE, marg); + return; + } + relationship = rel; otherWin = otherW; otherEdge = otherE; if ( rel == wxPercentOf ) { - percentage = val; + percent = val; } else { @@ -106,13 +114,13 @@ void wxIndividualLayoutConstraint::Below(wxWindowBase *sibling, int marg) // 'Same edge' alignment // void wxIndividualLayoutConstraint::SameAs(wxWindowBase *otherW, wxEdge edge, int marg) -{ +{ Set(wxPercentOf, otherW, edge, 100, marg); } // The edge is a percentage of the other window's edge void wxIndividualLayoutConstraint::PercentOf(wxWindowBase *otherW, wxEdge wh, int per) -{ +{ Set(wxPercentOf, otherW, wh, per); } @@ -121,7 +129,8 @@ void wxIndividualLayoutConstraint::PercentOf(wxWindowBase *otherW, wxEdge wh, in // void wxIndividualLayoutConstraint::Absolute(int val) { - value = val; relationship = wxAbsolute; + value = val; + relationship = wxAbsolute; } // Reset constraint if it mentions otherWin @@ -138,8 +147,8 @@ bool wxIndividualLayoutConstraint::ResetIfWin(wxWindowBase *otherW) otherWin = (wxWindowBase *) NULL; return TRUE; } - else - return FALSE; + + return FALSE; } // Try to satisfy constraint @@ -1037,7 +1046,7 @@ bool wxLayoutConstraints::SatisfyConstraints(wxWindowBase *win, int *nChanges) Set each calculated position and size */ - + #if WXWIN_COMPATIBILITY bool wxOldDoLayout(wxWindowBase *win) {