]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/layout.cpp
add extra space for top border when wxDIALOG_UNIT_COMPATIBILITY == 1 too
[wxWidgets.git] / src / common / layout.cpp
index adadfe0be554a8cf6c167419d7fe3c4a73f3659b..f94d850617cac6cf324a22115389676de01f6f9b 100644 (file)
     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;
@@ -60,10 +86,6 @@ wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
     otherWin = (wxWindowBase *) NULL;
 }
 
-wxIndividualLayoutConstraint::~wxIndividualLayoutConstraint()
-{
-}
-
 void wxIndividualLayoutConstraint::Set(wxRelationship rel, wxWindowBase *otherW, wxEdge otherE, int val, int marg)
 {
     if (rel == wxSameAs)
@@ -304,7 +326,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                 {
                     int x, y;
                     int w, h;
-                    win->GetSize(&w, &h);
+                    wxGetAsIs(win, &w, &h);
                     win->GetPosition(&x, &y);
                     value = x + w;
                     done = true;
@@ -457,7 +479,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                 {
                     int x, y;
                     int w, h;
-                    win->GetSize(&w, &h);
+                    wxGetAsIs(win, &w, &h);
                     win->GetPosition(&x, &y);
                     value = h + y;
                     done = true;
@@ -625,7 +647,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                     if (win)
                     {
                         int h;
-                        win->GetSize(&value, &h);
+                        wxGetAsIs(win, &value, &h);
                         done = true;
                         return true;
                     }
@@ -683,7 +705,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                     if (win)
                     {
                         int w;
-                        win->GetSize(&w, &value);
+                        wxGetAsIs(win, &w, &value);
                         done = true;
                         return true;
                     }
@@ -960,10 +982,6 @@ wxLayoutConstraints::wxLayoutConstraints()
     height.SetEdge(wxHeight);
 }
 
-wxLayoutConstraints::~wxLayoutConstraints()
-{
-}
-
 bool wxLayoutConstraints::SatisfyConstraints(wxWindowBase *win, int *nChanges)
 {
     int noChanges = 0;