added orient parameter to DrawSplitterSash instead of using wxMirrorDC in the splitter (it is now used in generic renderer only)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@22310 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2003-07-27 02:00:55 +00:00
parent 003b8322f3
commit 62dc9cb4f1
5 changed files with 43 additions and 23 deletions

View 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)

View 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

View 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
);
}

View 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);
}

View 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);
}