diff --git a/include/wx/renderer.h b/include/wx/renderer.h index 76e7a80090..adb2076bc5 100644 --- a/include/wx/renderer.h +++ b/include/wx/renderer.h @@ -89,7 +89,8 @@ public: virtual void DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, - wxCoord position) = 0; + wxCoord position, + wxOrientation orient) = 0; // geometry functions @@ -144,8 +145,9 @@ public: virtual void DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, - wxCoord position) - { m_rendererNative.DrawSplitterSash(win, dc, size, position); } + wxCoord position, + wxOrientation orient) + { m_rendererNative.DrawSplitterSash(win, dc, size, position, orient); } virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win) diff --git a/src/generic/renderg.cpp b/src/generic/renderg.cpp index 7f121bef42..252bfccc14 100644 --- a/src/generic/renderg.cpp +++ b/src/generic/renderg.cpp @@ -34,6 +34,8 @@ #include "wx/settings.h" #include "wx/splitter.h" +#include "wx/dcmirror.h" + #include "wx/renderer.h" // ---------------------------------------------------------------------------- @@ -62,7 +64,8 @@ public: virtual void DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, - wxCoord position); + wxCoord position, + wxOrientation orient); virtual wxPoint GetSplitterSashAndBorder(const wxWindow *win); @@ -227,10 +230,17 @@ wxRendererGeneric::DrawSplitterBorder(wxWindow *win, void wxRendererGeneric::DrawSplitterSash(wxWindow *win, - wxDC& dc, - const wxSize& size, - wxCoord position) + wxDC& dcReal, + const wxSize& sizeReal, + wxCoord position, + wxOrientation orient) { + // to avoid duplicating the same code for horizontal and vertical sashes, + // simply mirror the DC instead if needed (i.e. if horz splitter) + wxMirrorDC dc(dcReal, orient != wxVERTICAL); + wxSize size = dc.Reflect(sizeReal); + + // we draw a Win32-like grey sash with possible 3D border here: // // ---- this is position diff --git a/src/generic/splitter.cpp b/src/generic/splitter.cpp index 588657f137..70fbed666e 100644 --- a/src/generic/splitter.cpp +++ b/src/generic/splitter.cpp @@ -36,7 +36,6 @@ #include "wx/settings.h" #endif -#include "wx/dcmirror.h" #include "wx/renderer.h" #include "wx/splitter.h" @@ -382,7 +381,8 @@ bool wxSplitterWindow::SashHitTest(int x, int y, int tolerance) int z = m_splitMode == wxSPLIT_VERTICAL ? x : y; - return z >= m_sashPosition - tolerance && z <= m_sashPosition + tolerance; + return z >= m_sashPosition - tolerance && + z <= m_sashPosition + GetSashSize() + tolerance; } int wxSplitterWindow::GetSashSize() const @@ -413,13 +413,15 @@ void wxSplitterWindow::DrawSash(wxDC& dc) if ( HasFlag(wxSP_NOSASH) ) return; - wxMirrorDC dcMirror(dc, m_splitMode != wxSPLIT_VERTICAL); wxRendererNative::Get().DrawSplitterSash ( this, - dcMirror, - dcMirror.Reflect(GetClientSize()), - m_sashPosition + dc, + GetClientSize(), + m_sashPosition, + m_splitMode == wxSPLIT_VERTICAL + ? wxVERTICAL + : wxHORIZONTAL ); } diff --git a/src/mac/carbon/renderer.cpp b/src/mac/carbon/renderer.cpp index cfa3a81385..734a26e74d 100644 --- a/src/mac/carbon/renderer.cpp +++ b/src/mac/carbon/renderer.cpp @@ -56,7 +56,8 @@ public: virtual void DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, - wxCoord position); + wxCoord position, + wxOrientation orient); private: // the tree buttons @@ -198,16 +199,18 @@ void wxRendererMac::DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, - wxCoord position) + wxCoord position, + wxOrientation orient) { // VZ: we have to somehow determine if we're drawing a normal sash or // a brushed metal one as they look quite differently... this is // completely bogus anyhow, of course (TODO) - const wxCoord h = size.y; - dc.SetPen(*wxLIGHT_GREY_PEN); dc.SetBrush(*wxWHITE_BRUSH); - dc.DrawRectangle(position, 0, 7, h); + if ( orient == wxVERTICAL ) + dc.DrawRectangle(position, 0, 7, size.y); + else + dc.DrawRectangle(0, position, size.x, 7); } diff --git a/src/mac/renderer.cpp b/src/mac/renderer.cpp index cfa3a81385..734a26e74d 100644 --- a/src/mac/renderer.cpp +++ b/src/mac/renderer.cpp @@ -56,7 +56,8 @@ public: virtual void DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, - wxCoord position); + wxCoord position, + wxOrientation orient); private: // the tree buttons @@ -198,16 +199,18 @@ void wxRendererMac::DrawSplitterSash(wxWindow *win, wxDC& dc, const wxSize& size, - wxCoord position) + wxCoord position, + wxOrientation orient) { // VZ: we have to somehow determine if we're drawing a normal sash or // a brushed metal one as they look quite differently... this is // completely bogus anyhow, of course (TODO) - const wxCoord h = size.y; - dc.SetPen(*wxLIGHT_GREY_PEN); dc.SetBrush(*wxWHITE_BRUSH); - dc.DrawRectangle(position, 0, 7, h); + if ( orient == wxVERTICAL ) + dc.DrawRectangle(position, 0, 7, size.y); + else + dc.DrawRectangle(0, position, size.x, 7); }