X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7de8eddef5a45c55c1043afa8185379dcc48d928..6415637cb0da1aa1eb0b6a73b9f1757e80f53a9a:/src/common/layout.cpp?ds=sidebyside diff --git a/src/common/layout.cpp b/src/common/layout.cpp index c542527219..5fbe0e19f6 100644 --- a/src/common/layout.cpp +++ b/src/common/layout.cpp @@ -17,10 +17,6 @@ // headers // ---------------------------------------------------------------------------- -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma implementation "layout.h" -#endif - // For compilers that support precompilation, includes "wx.h". #include "wx/wxprec.h" @@ -48,6 +44,32 @@ IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject) + +inline void wxGetAsIs(wxWindowBase* win, int* w, int* h) +{ +#if 1 + // The old way. Works for me. + win->GetSize(w, h); +#endif + +#if 0 + // Vadim's change. Breaks wxPython's LayoutAnchors + win->GetBestSize(w, h); +#endif + +#if 0 + // Proposed compromise. Doesn't work. + int sw, sh, bw, bh; + win->GetSize(&sw, &sh); + win->GetBestSize(&bw, &bh); + if (w) + *w = wxMax(sw, bw); + if (h) + *h = wxMax(sh, bh); +#endif +} + + wxIndividualLayoutConstraint::wxIndividualLayoutConstraint() { myEdge = wxTop; @@ -300,7 +322,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr { int x, y; int w, h; - win->GetBestSize(&w, &h); + wxGetAsIs(win, &w, &h); win->GetPosition(&x, &y); value = x + w; done = true; @@ -453,7 +475,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr { int x, y; int w, h; - win->GetBestSize(&w, &h); + wxGetAsIs(win, &w, &h); win->GetPosition(&x, &y); value = h + y; done = true; @@ -621,7 +643,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr if (win) { int h; - win->GetBestSize(&value, &h); + wxGetAsIs(win, &value, &h); done = true; return true; } @@ -679,7 +701,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr if (win) { int w; - win->GetBestSize(&w, &value); + wxGetAsIs(win, &w, &value); done = true; return true; }