]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/layout.cpp
Correct signature of HitTest()
[wxWidgets.git] / src / common / layout.cpp
index c542527219fe1a47c5d6cda59be06d2ed8f9af3b..710ff2223e12cf68f66c5822d8e99b764ac520ed 100644 (file)
@@ -1,12 +1,12 @@
 /////////////////////////////////////////////////////////////////////////////
 /////////////////////////////////////////////////////////////////////////////
-// Name:        layout.cpp
+// Name:        src/common/layout.cpp
 // Purpose:     Constraint layout system classes
 // Author:      Julian Smart
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
 // Purpose:     Constraint layout system classes
 // Author:      Julian Smart
 // Modified by:
 // Created:     04/01/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Julian Smart
-// Licence:       wxWindows licence
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // =============================================================================
 /////////////////////////////////////////////////////////////////////////////
 
 // =============================================================================
 // 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"
 
 #ifdef __BORLANDC__
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
 #ifdef __BORLANDC__
-  #pragma hdrstop
+    #pragma hdrstop
 #endif
 
 #endif
 
+#if wxUSE_CONSTRAINTS
+
+#include "wx/layout.h"
+
 #ifndef WX_PRECOMP
 #ifndef WX_PRECOMP
-  #include "wx/defs.h"
+    #include "wx/window.h"
+    #include "wx/utils.h"
+    #include "wx/dialog.h"
+    #include "wx/msgdlg.h"
+    #include "wx/intl.h"
 #endif
 
 #endif
 
-#if wxUSE_CONSTRAINTS
 
 
-#ifndef WX_PRECOMP
-  #include "wx/window.h"
-  #include "wx/utils.h"
-  #include "wx/dialog.h"
-  #include "wx/msgdlg.h"
-  #include "wx/intl.h"
+IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, 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
 
 #endif
 
-#include "wx/layout.h"
+#if 0
+    // Vadim's change.  Breaks wxPython's LayoutAnchors
+    win->GetBestSize(w, h);
+#endif
 
 
-    IMPLEMENT_DYNAMIC_CLASS(wxIndividualLayoutConstraint, wxObject)
-    IMPLEMENT_DYNAMIC_CLASS(wxLayoutConstraints, wxObject)
+#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()
 
 
 wxIndividualLayoutConstraint::wxIndividualLayoutConstraint()
@@ -300,7 +318,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                 {
                     int x, y;
                     int w, h;
                 {
                     int x, y;
                     int w, h;
-                    win->GetBestSize(&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 +471,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                 {
                     int x, y;
                     int w, h;
                 {
                     int x, y;
                     int w, h;
-                    win->GetBestSize(&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 +639,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                     if (win)
                     {
                         int h;
                     if (win)
                     {
                         int h;
-                        win->GetBestSize(&value, &h);
+                        wxGetAsIs(win, &value, &h);
                         done = true;
                         return true;
                     }
                         done = true;
                         return true;
                     }
@@ -679,7 +697,7 @@ bool wxIndividualLayoutConstraint::SatisfyConstraint(wxLayoutConstraints *constr
                     if (win)
                     {
                         int w;
                     if (win)
                     {
                         int w;
-                        win->GetBestSize(&w, &value);
+                        wxGetAsIs(win, &w, &value);
                         done = true;
                         return true;
                     }
                         done = true;
                         return true;
                     }