virtual void DrawSplitterSash(wxWindow *win,
wxDC& dc,
const wxSize& size,
- wxCoord position) = 0;
+ wxCoord position,
+ wxOrientation orient) = 0;
// geometry functions
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)
#include "wx/settings.h"
#include "wx/splitter.h"
+#include "wx/dcmirror.h"
+
#include "wx/renderer.h"
// ----------------------------------------------------------------------------
virtual void DrawSplitterSash(wxWindow *win,
wxDC& dc,
const wxSize& size,
- wxCoord position);
+ wxCoord position,
+ wxOrientation orient);
virtual wxPoint GetSplitterSashAndBorder(const 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
#include "wx/settings.h"
#endif
-#include "wx/dcmirror.h"
#include "wx/renderer.h"
#include "wx/splitter.h"
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
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
);
}
virtual void DrawSplitterSash(wxWindow *win,
wxDC& dc,
const wxSize& size,
- wxCoord position);
+ wxCoord position,
+ wxOrientation orient);
private:
// the tree buttons
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);
}
virtual void DrawSplitterSash(wxWindow *win,
wxDC& dc,
const wxSize& size,
- wxCoord position);
+ wxCoord position,
+ wxOrientation orient);
private:
// the tree buttons
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);
}