Make wxRenderer::DrawItemSelectionRect() draw a focus outline of wxCONTROL_CURRENT and wxCONTROL_FOCUSED is given, blind patch for wxMac
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49204 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2351,7 +2351,6 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
x, item_last * m_lineHeight);
|
x, item_last * m_lineHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool has_focus = (FindFocus() == this);
|
|
||||||
// redraw the background for the items which are selected/current
|
// redraw the background for the items which are selected/current
|
||||||
for (unsigned int item = item_start; item < item_last; item++)
|
for (unsigned int item = item_start; item < item_last; item++)
|
||||||
{
|
{
|
||||||
@@ -2359,7 +2358,7 @@ void wxDataViewMainWindow::OnPaint( wxPaintEvent &WXUNUSED(event) )
|
|||||||
if (selected || item == m_currentRow)
|
if (selected || item == m_currentRow)
|
||||||
{
|
{
|
||||||
int flags = selected ? (int)wxCONTROL_SELECTED : 0;
|
int flags = selected ? (int)wxCONTROL_SELECTED : 0;
|
||||||
if ((item == m_currentRow) && has_focus)
|
if (item == m_currentRow)
|
||||||
flags |= wxCONTROL_CURRENT;
|
flags |= wxCONTROL_CURRENT;
|
||||||
if (m_hasFocus)
|
if (m_hasFocus)
|
||||||
flags |= wxCONTROL_FOCUSED;
|
flags |= wxCONTROL_FOCUSED;
|
||||||
|
@@ -1541,11 +1541,7 @@ void wxListLineData::DrawInReportMode( wxDC *dc,
|
|||||||
if (highlighted)
|
if (highlighted)
|
||||||
{
|
{
|
||||||
int flags = wxCONTROL_SELECTED;
|
int flags = wxCONTROL_SELECTED;
|
||||||
if (m_owner->HasFocus()
|
if (m_owner->HasFocus())
|
||||||
#ifdef __WXMAC__
|
|
||||||
&& IsControlActive( (ControlRef)m_owner->GetHandle() )
|
|
||||||
#endif
|
|
||||||
)
|
|
||||||
flags |= wxCONTROL_FOCUSED;
|
flags |= wxCONTROL_FOCUSED;
|
||||||
wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags );
|
wxRendererNative::Get().DrawItemSelectionRect( m_owner, *dc, rectHL, flags );
|
||||||
}
|
}
|
||||||
|
@@ -37,6 +37,10 @@
|
|||||||
#include "wx/splitter.h"
|
#include "wx/splitter.h"
|
||||||
#include "wx/dcmirror.h"
|
#include "wx/dcmirror.h"
|
||||||
|
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
#include "wx/mac/private.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// wxRendererGeneric: our wxRendererNative implementation
|
// wxRendererGeneric: our wxRendererNative implementation
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -635,10 +639,17 @@ wxRendererGeneric::DrawPushButton(wxWindow *win,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
wxRendererGeneric::DrawItemSelectionRect(wxWindow * win,
|
||||||
|
wxDC& dc,
|
||||||
|
const wxRect& rect,
|
||||||
|
int flags)
|
||||||
|
#else
|
||||||
wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
|
wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags)
|
int flags)
|
||||||
|
#endif
|
||||||
{
|
{
|
||||||
wxBrush brush;
|
wxBrush brush;
|
||||||
if ( flags & wxCONTROL_SELECTED )
|
if ( flags & wxCONTROL_SELECTED )
|
||||||
@@ -658,7 +669,14 @@ wxRendererGeneric::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
|
|||||||
}
|
}
|
||||||
|
|
||||||
dc.SetBrush(brush);
|
dc.SetBrush(brush);
|
||||||
dc.SetPen(flags & wxCONTROL_CURRENT ? *wxBLACK_PEN : *wxTRANSPARENT_PEN);
|
if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED)
|
||||||
|
#ifdef __WXMAC__
|
||||||
|
&& IsControlActive( (ControlRef)win->GetHandle() )
|
||||||
|
#endif
|
||||||
|
)
|
||||||
|
dc.SetPen( *wxBLACK_PEN );
|
||||||
|
else
|
||||||
|
dc.SetPen( *wxTRANSPARENT_PEN );
|
||||||
|
|
||||||
dc.DrawRectangle( rect );
|
dc.DrawRectangle( rect );
|
||||||
}
|
}
|
||||||
|
@@ -619,7 +619,7 @@ wxRendererGTK::DrawItemSelectionRect(wxWindow *win,
|
|||||||
state = GTK_STATE_NORMAL;
|
state = GTK_STATE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & wxCONTROL_CURRENT)
|
if ((flags & wxCONTROL_CURRENT) && (flags & wxCONTROL_FOCUSED))
|
||||||
{
|
{
|
||||||
gtk_paint_focus( win->m_widget->style,
|
gtk_paint_focus( win->m_widget->style,
|
||||||
gdk_window,
|
gdk_window,
|
||||||
|
@@ -375,6 +375,12 @@ wxRendererMac::DrawItemSelectionRect(wxWindow *win,
|
|||||||
if ( !(flags & wxCONTROL_SELECTED) )
|
if ( !(flags & wxCONTROL_SELECTED) )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (flags & wxCONTROL_FOCUSED)
|
||||||
|
{
|
||||||
|
if (!IsControlActive( (ControlRef)win->GetHandle() ))
|
||||||
|
flags = wxCONTROL_SELECTED;
|
||||||
|
}
|
||||||
|
|
||||||
RGBColor selColor;
|
RGBColor selColor;
|
||||||
GetThemeBrushAsColor(flags & wxCONTROL_FOCUSED
|
GetThemeBrushAsColor(flags & wxCONTROL_FOCUSED
|
||||||
? kThemeBrushAlternatePrimaryHighlightColor
|
? kThemeBrushAlternatePrimaryHighlightColor
|
||||||
|
@@ -534,7 +534,7 @@ wxRendererXP::DrawPushButton(wxWindow * win,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
|
wxRendererXP::DrawItemSelectionRect(wxWindow *win,
|
||||||
wxDC& dc,
|
wxDC& dc,
|
||||||
const wxRect& rect,
|
const wxRect& rect,
|
||||||
int flags)
|
int flags)
|
||||||
@@ -557,12 +557,11 @@ wxRendererXP::DrawItemSelectionRect(wxWindow * WXUNUSED(win),
|
|||||||
}
|
}
|
||||||
|
|
||||||
dc.SetBrush(brush);
|
dc.SetBrush(brush);
|
||||||
|
|
||||||
// unlike for wxRendererGeneric, on windows we _never_ want to draw
|
|
||||||
// the outline of the rectangle:
|
|
||||||
dc.SetPen(*wxTRANSPARENT_PEN);
|
dc.SetPen(*wxTRANSPARENT_PEN);
|
||||||
|
|
||||||
dc.DrawRectangle( rect );
|
dc.DrawRectangle( rect );
|
||||||
|
|
||||||
|
if ((flags & wxCONTROL_FOCUSED) && (flags & wxCONTROL_CURRENT))
|
||||||
|
DrawFocusRect( win, dc, rect, flags );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user