X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3417c2cd3d5cb05451270b5a09fe2355406158a3..e5251d4f78176837e2eb857fae246435207ccaf2:/src/common/layout.cpp diff --git a/src/common/layout.cpp b/src/common/layout.cpp index 188d4c6d8f..74850c5631 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -44,10 +44,8 @@ #include "wx/layout.h" -#if !USE_SHARED_LIBRARY IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject) IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject) -#endif wxIndividualLayoutConstraint::wxIndividualLayoutConstraint() @@ -68,11 +66,28 @@ wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint() void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg) { - relationship = rel; - otherWin = otherW; - otherEdge = otherE; - value = val; - margin = 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 ) + { + percent = val; + } + else + { + value = val; + } + + margin = marg; } void wxIndividualLayoutConstraint::LeftOf(wxWindowBase *sibling, int marg) @@ -99,19 +114,14 @@ void wxIndividualLayoutConstraint::Below(wxWindowBase *sibling, int marg) // 'Same edge' alignment // void wxIndividualLayoutConstraint::SameAs(wxWindowBase *otherW, wxEdge edge, int marg) -{ - Set(wxPercentOf, otherW, edge, 0, marg); - percent = 100; +{ + 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) -{ - otherWin = otherW; - relationship = wxPercentOf; - percent = per; - - otherEdge = wh; +{ + Set(wxPercentOf, otherW, wh, per); } // @@ -119,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 @@ -136,8 +147,8 @@ bool wxIndividualLayoutConstraint::ResetIfWin(wxWindowBase *otherW) otherWin = (wxWindowBase *) NULL; return TRUE; } - else - return FALSE; + + return FALSE; } // Try to satisfy constraint @@ -1035,7 +1046,7 @@ bool wxLayoutConstraints::SatisfyConstraints(wxWindowBase *win, int *nChanges) Set each calculated position and size */ - + #if WXWIN_COMPATIBILITY bool wxOldDoLayout(wxWindowBase *win) {