X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/c0ed460c2e7802793d591c84f3cfdbff159c5549..41895a05eae22da85e8c659f9492d2312a63af13:/src/generic/sashwin.cpp diff --git a/src/generic/sashwin.cpp b/src/generic/sashwin.cpp index 9bac85b92d..b079f5c250 100644 --- a/src/generic/sashwin.cpp +++ b/src/generic/sashwin.cpp @@ -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) @@ -96,10 +97,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); } @@ -115,13 +114,21 @@ void wxSashWindow::OnMouseEvent(wxMouseEvent& event) { if ( sashHit != wxSASH_NONE ) { - CaptureMouse(); + CaptureMouse(); // Required for X to specify that - // that we wish to draw on top of all windows - // - and we optimise by specifying the area - // for creating the overlap window. - wxScreenDC::StartDrawingOnTop(this); + // that we wish to draw on top of all windows + // - and we optimise by specifying the area + // for creating the overlap window. + // Find the first frame or dialog and use this to specify + // the area to draw on. + wxWindow* parent = this; + + while (parent && !parent->IsKindOf(CLASSINFO(wxDialog)) && + !parent->IsKindOf(CLASSINFO(wxFrame))) + parent = parent->GetParent(); + + wxScreenDC::StartDrawingOnTop(parent); // We don't say we're dragging yet; we leave that // decision for the Dragging() branch, to ensure @@ -318,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; } @@ -527,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()); @@ -568,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);