improve look of wxDataViewCtrl and of its renderer on wxMSW when windows XP themeing is not used (wxRendererXP::DrawItemSelectionRect implementation is ok also for wxRendererMSW; share the code).
Fix a typo in the drawing code for horizontal rules in wxDataViewCtrl. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59327 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -861,14 +861,6 @@ bool wxDataViewToggleRenderer::GetValue( wxVariant &WXUNUSED(value) ) const
|
|||||||
|
|
||||||
bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
|
bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state) )
|
||||||
{
|
{
|
||||||
// User wxRenderer here
|
|
||||||
|
|
||||||
wxRect rect;
|
|
||||||
rect.x = cell.x + cell.width/2 - 10;
|
|
||||||
rect.width = 20;
|
|
||||||
rect.y = cell.y + cell.height/2 - 10;
|
|
||||||
rect.height = 20;
|
|
||||||
|
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
if (m_toggle)
|
if (m_toggle)
|
||||||
flags |= wxCONTROL_CHECKED;
|
flags |= wxCONTROL_CHECKED;
|
||||||
@@ -878,7 +870,7 @@ bool wxDataViewToggleRenderer::Render( wxRect cell, wxDC *dc, int WXUNUSED(state
|
|||||||
wxRendererNative::Get().DrawCheckBox(
|
wxRendererNative::Get().DrawCheckBox(
|
||||||
GetOwner()->GetOwner(),
|
GetOwner()->GetOwner(),
|
||||||
*dc,
|
*dc,
|
||||||
rect,
|
cell,
|
||||||
flags );
|
flags );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -897,7 +889,9 @@ bool wxDataViewToggleRenderer::Activate( wxRect WXUNUSED(cell),
|
|||||||
|
|
||||||
wxSize wxDataViewToggleRenderer::GetSize() const
|
wxSize wxDataViewToggleRenderer::GetSize() const
|
||||||
{
|
{
|
||||||
return wxSize(20,20);
|
// the window parameter is not used by GetCheckBoxSize() so it's
|
||||||
|
// safe to pass NULL
|
||||||
|
return wxRendererNative::Get().GetCheckBoxSize(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------
|
// ---------------------------------------------------------
|
||||||
@@ -1681,7 +1675,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
dc.SetPen(m_penRule);
|
dc.SetPen(m_penRule);
|
||||||
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
dc.SetBrush(*wxTRANSPARENT_BRUSH);
|
||||||
|
|
||||||
for (unsigned int i = item_start; i <= item_last+1; i++)
|
for (unsigned int i = item_start; i <= item_last; i++)
|
||||||
{
|
{
|
||||||
int y = GetLineStart( i );
|
int y = GetLineStart( i );
|
||||||
dc.DrawLine(x_start, y, x_last, y);
|
dc.DrawLine(x_start, y, x_last, y);
|
||||||
|
@@ -162,11 +162,33 @@ private:
|
|||||||
#define DFCS_HOT 0x1000
|
#define DFCS_HOT 0x1000
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// methods common to wxRendererMSW and wxRendererXP
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxRendererMSWBase : public wxDelegateRendererNative
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxRendererMSWBase() { }
|
||||||
|
wxRendererMSWBase(wxRendererNative& rendererNative)
|
||||||
|
: wxDelegateRendererNative(rendererNative) { }
|
||||||
|
|
||||||
|
void DrawFocusRect(wxWindow * win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
|
||||||
|
void DrawItemSelectionRect(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags = 0);
|
||||||
|
};
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxRendererMSW: wxRendererNative implementation for "old" Win32 systems
|
// wxRendererMSW: wxRendererNative implementation for "old" Win32 systems
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
class WXDLLEXPORT wxRendererMSW : public wxDelegateRendererNative
|
class WXDLLEXPORT wxRendererMSW : public wxRendererMSWBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxRendererMSW() { }
|
wxRendererMSW() { }
|
||||||
@@ -188,11 +210,6 @@ public:
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0);
|
int flags = 0);
|
||||||
|
|
||||||
virtual void DrawFocusRect(wxWindow* win,
|
|
||||||
wxDC& dc,
|
|
||||||
const wxRect& rect,
|
|
||||||
int flags = 0);
|
|
||||||
|
|
||||||
virtual void DrawChoice(wxWindow* win,
|
virtual void DrawChoice(wxWindow* win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
@@ -227,10 +244,10 @@ private:
|
|||||||
|
|
||||||
#if wxUSE_UXTHEME
|
#if wxUSE_UXTHEME
|
||||||
|
|
||||||
class WXDLLEXPORT wxRendererXP : public wxDelegateRendererNative
|
class WXDLLEXPORT wxRendererXP : public wxRendererMSWBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxRendererXP() : wxDelegateRendererNative(wxRendererMSW::Get()) { }
|
wxRendererXP() : wxRendererMSWBase(wxRendererMSW::Get()) { }
|
||||||
|
|
||||||
static wxRendererNative& Get();
|
static wxRendererNative& Get();
|
||||||
|
|
||||||
@@ -269,12 +286,6 @@ public:
|
|||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags = 0);
|
int flags = 0);
|
||||||
|
|
||||||
virtual void DrawItemSelectionRect(wxWindow *win,
|
|
||||||
wxDC& dc,
|
|
||||||
const wxRect& rect,
|
|
||||||
int flags = 0 );
|
|
||||||
|
|
||||||
|
|
||||||
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
|
virtual wxSplitterRenderParams GetSplitterParams(const wxWindow *win);
|
||||||
private:
|
private:
|
||||||
wxDECLARE_NO_COPY_CLASS(wxRendererXP);
|
wxDECLARE_NO_COPY_CLASS(wxRendererXP);
|
||||||
@@ -282,6 +293,53 @@ private:
|
|||||||
|
|
||||||
#endif // wxUSE_UXTHEME
|
#endif // wxUSE_UXTHEME
|
||||||
|
|
||||||
|
|
||||||
|
// ============================================================================
|
||||||
|
// wxRendererMSWBase implementation
|
||||||
|
// ============================================================================
|
||||||
|
|
||||||
|
void wxRendererMSWBase::DrawFocusRect(wxWindow * WXUNUSED(win),
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int WXUNUSED(flags))
|
||||||
|
{
|
||||||
|
RECT rc;
|
||||||
|
wxCopyRectToRECT(rect, rc);
|
||||||
|
|
||||||
|
::DrawFocusRect(GraphicsHDC(&dc), &rc);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxRendererMSWBase::DrawItemSelectionRect(wxWindow *win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
{
|
||||||
|
wxBrush brush;
|
||||||
|
if ( flags & wxCONTROL_SELECTED )
|
||||||
|
{
|
||||||
|
if ( flags & wxCONTROL_FOCUSED )
|
||||||
|
{
|
||||||
|
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
||||||
|
}
|
||||||
|
else // !focused
|
||||||
|
{
|
||||||
|
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else // !selected
|
||||||
|
{
|
||||||
|
brush = *wxTRANSPARENT_BRUSH;
|
||||||
|
}
|
||||||
|
|
||||||
|
dc.SetBrush(brush);
|
||||||
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
dc.DrawRectangle( rect );
|
||||||
|
|
||||||
|
if ((flags & wxCONTROL_FOCUSED) && (flags & wxCONTROL_CURRENT))
|
||||||
|
DrawFocusRect( win, dc, rect, flags );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
// wxRendererNative and wxRendererMSW implementation
|
// wxRendererNative and wxRendererMSW implementation
|
||||||
// ============================================================================
|
// ============================================================================
|
||||||
@@ -377,17 +435,6 @@ wxRendererMSW::DrawPushButton(wxWindow * WXUNUSED(win),
|
|||||||
::DrawFrameControl(GraphicsHDC(&dc), &rc, DFC_BUTTON, style);
|
::DrawFrameControl(GraphicsHDC(&dc), &rc, DFC_BUTTON, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRendererMSW::DrawFocusRect(wxWindow * WXUNUSED(win),
|
|
||||||
wxDC& dc,
|
|
||||||
const wxRect& rect,
|
|
||||||
int WXUNUSED(flags))
|
|
||||||
{
|
|
||||||
RECT rc;
|
|
||||||
wxCopyRectToRECT(rect, rc);
|
|
||||||
|
|
||||||
::DrawFocusRect(GraphicsHDC(&dc), &rc);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxSize wxRendererMSW::GetCheckBoxSize(wxWindow * WXUNUSED(win))
|
wxSize wxRendererMSW::GetCheckBoxSize(wxWindow * WXUNUSED(win))
|
||||||
{
|
{
|
||||||
return wxSize(::GetSystemMetrics(SM_CXMENUCHECK),
|
return wxSize(::GetSystemMetrics(SM_CXMENUCHECK),
|
||||||
@@ -740,38 +787,6 @@ wxRendererXP::DrawPushButton(wxWindow * win,
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
wxRendererXP::DrawItemSelectionRect(wxWindow *win,
|
|
||||||
wxDC& dc,
|
|
||||||
const wxRect& rect,
|
|
||||||
int flags)
|
|
||||||
{
|
|
||||||
wxBrush brush;
|
|
||||||
if ( flags & wxCONTROL_SELECTED )
|
|
||||||
{
|
|
||||||
if ( flags & wxCONTROL_FOCUSED )
|
|
||||||
{
|
|
||||||
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT));
|
|
||||||
}
|
|
||||||
else // !focused
|
|
||||||
{
|
|
||||||
brush = wxBrush(wxSystemSettings::GetColour(wxSYS_COLOUR_BTNFACE));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else // !selected
|
|
||||||
{
|
|
||||||
brush = *wxTRANSPARENT_BRUSH;
|
|
||||||
}
|
|
||||||
|
|
||||||
dc.SetBrush(brush);
|
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
|
||||||
dc.DrawRectangle( rect );
|
|
||||||
|
|
||||||
if ((flags & wxCONTROL_FOCUSED) && (flags & wxCONTROL_CURRENT))
|
|
||||||
DrawFocusRect( win, dc, rect, flags );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// splitter drawing
|
// splitter drawing
|
||||||
|
Reference in New Issue
Block a user