X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ad81651f00edc6f489d9b6a0839d316a964fd521..4f55a07f9f4c6ba6905aaa8e584e6fb14771d278:/src/common/layout.cpp diff --git a/src/common/layout.cpp b/src/common/layout.cpp index 678e8bd1c1..8dbb8ea8dc 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -66,11 +66,20 @@ 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; + relationship = rel; + otherWin = otherW; + otherEdge = otherE; + + if ( rel == wxPercentOf ) + { + percent = val; + } + else + { + value = val; + } + + margin = marg; } void wxIndividualLayoutConstraint::LeftOf(wxWindowBase *sibling, int marg) @@ -98,18 +107,13 @@ void wxIndividualLayoutConstraint::Below(wxWindowBase *sibling, int marg) // 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); } // @@ -117,7 +121,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 @@ -134,8 +139,8 @@ bool wxIndividualLayoutConstraint::ResetIfWin(wxWindowBase *otherW) otherWin = (wxWindowBase *) NULL; return TRUE; } - else - return FALSE; + + return FALSE; } // Try to satisfy constraint