]> git.saurik.com Git - wxWidgets.git/blobdiff - src/generic/sashwin.cpp
* wxThread fixes
[wxWidgets.git] / src / generic / sashwin.cpp
index 35dc510806908fef76d6dee9074cff4cd633e2d0..bb03e9004425af72d1c83127d7744df16e8878ea 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)
@@ -109,6 +110,14 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
 
     wxSashEdgePosition sashHit = SashHitTest(x, y);
 
+    // reset the cursor
+#ifdef __WXMOTIF__
+    SetCursor(* wxSTANDARD_CURSOR);
+#endif
+#ifdef __WXMSW__
+    SetCursor(wxCursor());
+#endif
+
        if (event.LeftDown())
        {
         if ( sashHit != wxSASH_NONE )
@@ -145,8 +154,6 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
         wxScreenDC::EndDrawingOnTop();
         m_dragMode = wxSASH_DRAG_NONE;
         m_draggingEdge = wxSASH_NONE;
-
-        SetCursor(*wxSTANDARD_CURSOR);
     }
        else if (event.LeftUp() && m_dragMode == wxSASH_DRAG_DRAGGING)
        {
@@ -238,10 +245,6 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event)
                        SetCursor(*m_sashCursorNS);
                 }
         }
-        else
-        {
-           SetCursor(*wxSTANDARD_CURSOR);
-        }
        }
        else if ( event.Dragging() &&
               ((m_dragMode == wxSASH_DRAG_DRAGGING) || (m_dragMode == wxSASH_DRAG_LEFT_DOWN))
@@ -513,7 +516,7 @@ void wxSashWindow::DrawSashTracker(wxSashEdgePosition edge, int x, int y)
 
     wxPen sashTrackerPen(*wxBLACK, 2, wxSOLID);
 
-    screenDC.SetLogicalFunction(wxXOR);
+    screenDC.SetLogicalFunction(wxINVERT);
     screenDC.SetPen(sashTrackerPen);
     screenDC.SetBrush(*wxTRANSPARENT_BRUSH);
 
@@ -533,7 +536,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 +577,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);