draw solid focus rectangle in mono theme and don't do it at all for selected items (this required adding flags parameter to DrawFocusRect())

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@41535 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-09-30 18:30:00 +00:00
parent a798c64c4f
commit b19d4eb9bf
5 changed files with 26 additions and 8 deletions

View File

@@ -93,7 +93,9 @@ public:
// draw the focus rectangle around the label contained in the given rect // draw the focus rectangle around the label contained in the given rect
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect) = 0; //
// only wxCONTROL_SELECTED makes sense in flags here
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0) = 0;
// draw the label inside the given rectangle with the specified alignment // draw the label inside the given rectangle with the specified alignment
// and optionally emphasize the character with the given index // and optionally emphasize the character with the given index
@@ -536,8 +538,8 @@ public:
const wxRect& rect, const wxRect& rect,
int flags) int flags)
{ m_renderer->DrawButtonSurface(dc, col, rect, flags); } { m_renderer->DrawButtonSurface(dc, col, rect, flags); }
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect) virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0)
{ m_renderer->DrawFocusRect(dc, rect); } { m_renderer->DrawFocusRect(dc, rect, flags); }
virtual void DrawLabel(wxDC& dc, virtual void DrawLabel(wxDC& dc,
const wxString& label, const wxString& label,
const wxRect& rect, const wxRect& rect,

View File

@@ -38,7 +38,7 @@ public:
int flags); int flags);
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect); virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
virtual void DrawLabel(wxDC& dc, virtual void DrawLabel(wxDC& dc,
const wxString& label, const wxString& label,
const wxRect& rect, const wxRect& rect,

View File

@@ -184,7 +184,8 @@ void wxStdRenderer::DrawButtonSurface(wxDC& dc,
// text // text
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
void wxStdRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect) void
wxStdRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
{ {
// draw the pixels manually because the "dots" in wxPen with wxDOT style // draw the pixels manually because the "dots" in wxPen with wxDOT style
// may be short traits and not really dots // may be short traits and not really dots
@@ -615,7 +616,7 @@ void wxStdRenderer::DrawItem(wxDC& dc,
if ( flags & wxCONTROL_FOCUSED ) if ( flags & wxCONTROL_FOCUSED )
{ {
DrawFocusRect(dc, rect); DrawFocusRect(dc, rect, flags);
} }
} }

View File

@@ -84,7 +84,7 @@ public:
wxGTKRenderer(const wxColourScheme *scheme); wxGTKRenderer(const wxColourScheme *scheme);
// wxRenderer methods // wxRenderer methods
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect); virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
virtual void DrawTextBorder(wxDC& dc, virtual void DrawTextBorder(wxDC& dc,
wxBorder border, wxBorder border,
const wxRect& rect, const wxRect& rect,
@@ -834,7 +834,8 @@ void wxGTKRenderer::DrawSunkenBorder(wxDC& dc, wxRect *rect)
DrawShadedRect(dc, rect, m_penBlack, m_penLightGrey); DrawShadedRect(dc, rect, m_penBlack, m_penLightGrey);
} }
void wxGTKRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect) void
wxGTKRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int WXUNUSED(flags))
{ {
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
wxRect rectFocus = rect; wxRect rectFocus = rect;

View File

@@ -62,6 +62,8 @@ public:
int indexAccel = -1, int indexAccel = -1,
wxRect *rectBounds = NULL); wxRect *rectBounds = NULL);
virtual void DrawFocusRect(wxDC& dc, const wxRect& rect, int flags = 0);
virtual void DrawButtonBorder(wxDC& dc, virtual void DrawButtonBorder(wxDC& dc,
const wxRect& rect, const wxRect& rect,
int flags = 0, int flags = 0,
@@ -699,6 +701,18 @@ wxMonoRenderer::DrawVerticalLine(wxDC& dc, wxCoord x, wxCoord y1, wxCoord y2)
dc.DrawLine(x, y1, x, y2 + 1); dc.DrawLine(x, y1, x, y2 + 1);
} }
void wxMonoRenderer::DrawFocusRect(wxDC& dc, const wxRect& rect, int flags)
{
// no need to draw the focus rect for selected items, it would be invisible
// anyhow
if ( !(flags & wxCONTROL_SELECTED) )
{
dc.SetPen(m_penFg);
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.DrawRectangle(rect);
}
}
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// label // label
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------