]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/layout.cpp
Allow wx parents a chance to handle events fired by non-wx children. (i.e. wxActiveX...
[wxWidgets.git] / src / common / layout.cpp
index 85dcafbb11fc0d6f0daf20380f478bfb805d0620..5fbe0e19f6fb7901a1474273eae1d55143b58b11 100644 (file)
 // headers
 // ----------------------------------------------------------------------------
 
 // 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"
 
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
     IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
 
 
     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;
 wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
 {
     myEdge = wxTop;
@@ -300,7 +322,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                 {
                     int x, y;
                     int w, h;
                 {
                     int x, y;
                     int w, h;
-                    win->GetSize(&w, &h);
+                    wxGetAsIs(win, &w, &h);
                     win->GetPosition(&x, &y);
                     value = x + w;
                     done = true;
                     win->GetPosition(&x, &y);
                     value = x + w;
                     done = true;
@@ -453,7 +475,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                 {
                     int x, y;
                     int w, h;
                 {
                     int x, y;
                     int w, h;
-                    win->GetSize(&w, &h);
+                    wxGetAsIs(win, &w, &h);
                     win->GetPosition(&x, &y);
                     value = h + y;
                     done = true;
                     win->GetPosition(&x, &y);
                     value = h + y;
                     done = true;
@@ -621,7 +643,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                     if (win)
                     {
                         int h;
                     if (win)
                     {
                         int h;
-                        win->GetSize(&value, &h);
+                        wxGetAsIs(win, &value, &h);
                         done = true;
                         return true;
                     }
                         done = true;
                         return true;
                     }
@@ -679,7 +701,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                     if (win)
                     {
                         int w;
                     if (win)
                     {
                         int w;
-                        win->GetSize(&w, &value);
+                        wxGetAsIs(win, &w, &value);
                         done = true;
                         return true;
                     }
                         done = true;
                         return true;
                     }