]> git.saurik.com Git - wxWidgets.git/commitdiff
added orient parameter to DrawSplitterSash instead of using wxMirrorDC in the splitte...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 Jul 2003 02:00:55 +0000 (02:00 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 27 Jul 2003 02:00:55 +0000 (02:00 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22310 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/renderer.h
src/generic/renderg.cpp
src/generic/splitter.cpp
src/mac/carbon/renderer.cpp
src/mac/renderer.cpp

index 76e7a80090af809bc803aa874535b57b3c5131f6..adb2076bc5abaa3e5ab0cd8b964b04fabb00504e 100644 (file)
@@ -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)
index 7f121bef42192b19871942dd2675cfda9d1542c5..252bfccc145c9836d03f92a78282dda218c4fc38 100644 (file)
@@ -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
index 588657f137e9fc1155c22bfa416e3b271fb7f6fc..70fbed666eb3c190e05c50513a34f47839e0b1d1 100644 (file)
@@ -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
                             );
 }
 
index cfa3a8138591898f7c8fae01f33d359e301f3828..734a26e74da34960f6ce182091e888c845738374 100644 (file)
@@ -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);
 }
 
index cfa3a8138591898f7c8fae01f33d359e301f3828..734a26e74da34960f6ce182091e888c845738374 100644 (file)
@@ -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);
 }