]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/sashwin.cpp
* Big memory bug fixed in socket/getline fixed.
[wxWidgets.git] / src / generic / sashwin.cpp
index 2553c9f70044d3224dd4d0d565983729c941e3e3..b079f5c250f70943f994e56f16918f2b99960a42 100644 (file)
@@ -32,6 +32,7 @@
 #include "wx/string.h"
 #include "wx/dcscreen.h"
 #include "wx/sashwin.h"
+#include "wx/laywin.h"
 
 #if !USE_SHARED_LIBRARY
 IMPLEMENT_DYNAMIC_CLASS(wxSashWindow, wxWindow)
@@ -324,7 +325,7 @@ wxSashEdgePosition wxSashWindow::SashHitTest(int x, int y, int WXUNUSED(toleranc
                 }
                 case wxSASH_LEFT:
                 {
-                    if ((x >= GetEdgeMargin(position)) && (x >= 0))
+                    if ((x <= GetEdgeMargin(position)) && (x >= 0))
                         return wxSASH_LEFT;
                     break;
                 }
@@ -533,7 +534,7 @@ void wxSashWindow::SizeWindows()
     int cw, ch;
     GetClientSize(&cw, &ch);
 
-    if (GetChildren().Number() > 0)
+    if (GetChildren().Number() == 1)
     {
         wxWindow* child = (wxWindow*) (GetChildren().First()->Data());
 
@@ -574,6 +575,16 @@ void wxSashWindow::SizeWindows()
 
         child->SetSize(x, y, width, height);
     }
+    else if (GetChildren().Number() > 1)
+    {
+        // Perhaps multiple children are themselves sash windows.
+        // TODO: this doesn't really work because the subwindows sizes/positions
+        // must be set to leave a gap for the parent's sash (hit-test and decorations).
+        // Perhaps we can allow for this within LayoutWindow, testing whether the parent
+        // is a sash window, and if so, allowing some space for the edges.
+        wxLayoutAlgorithm layout;
+        layout.LayoutWindow(this);
+    }
 
     wxClientDC dc(this);
     DrawBorders(dc);