X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/b412f9be504e07559a98ae234f30bb1bd0b2aa1f..57c0af52bffc66b12b7e7b49b3a2dfdcf2d2e352:/src/generic/sashwin.cpp diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 831085a907..bcc734ffd9 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -8,7 +8,7 @@ // Created: 01/02/97 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows license +// Licence: wxWindows license ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -26,12 +26,17 @@ #include "wx/wx.h" #endif +#if !wxUSE_SASH + #error "Thisfile requires wxUSE_SASH to be defined." +#endif // wxUSE_SASH + #include #include #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) @@ -96,10 +101,8 @@ void wxSashWindow::OnPaint(wxPaintEvent& WXUNUSED(event)) { wxPaintDC dc(this); -#if 0 - if ( m_borderSize > 0 ) - DrawBorders(dc); -#endif + // if ( m_borderSize > 0 ) + DrawBorders(dc); DrawSashes(dc); } @@ -111,6 +114,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 ) @@ -147,8 +158,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) { @@ -240,10 +249,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)) @@ -326,7 +331,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; } @@ -515,7 +520,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); @@ -535,7 +540,7 @@ void wxSashWindow::SizeWindows() int cw, ch; GetClientSize(&cw, &ch); - if (GetChildren().Number() > 0) + if (GetChildren().Number() == 1) { wxWindow* child = (wxWindow*) (GetChildren().First()->Data()); @@ -576,6 +581,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);