Use wxINVERT for drawing generic wxCaret when possible
This now works after recent fixes, although wxINVERT does not work with wxGraphicsContext-based wxDC. So this is mainly for GTK2, only about 20 years late.
This commit is contained in:
@@ -284,6 +284,9 @@ void wxCaret::DoDraw(wxDC *dc, wxWindow* win)
|
|||||||
brush = *wxWHITE_BRUSH;
|
brush = *wxWHITE_BRUSH;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#if wxUSE_GRAPHICS_CONTEXT
|
||||||
|
wxGraphicsContext* gc = dc->GetGraphicsContext();
|
||||||
|
#endif
|
||||||
if (m_hasFocus)
|
if (m_hasFocus)
|
||||||
{
|
{
|
||||||
dc->SetPen(*wxTRANSPARENT_PEN);
|
dc->SetPen(*wxTRANSPARENT_PEN);
|
||||||
@@ -295,7 +298,6 @@ void wxCaret::DoDraw(wxDC *dc, wxWindow* win)
|
|||||||
dc->SetPen(pen);
|
dc->SetPen(pen);
|
||||||
dc->SetBrush(*wxTRANSPARENT_BRUSH);
|
dc->SetBrush(*wxTRANSPARENT_BRUSH);
|
||||||
#if wxUSE_GRAPHICS_CONTEXT
|
#if wxUSE_GRAPHICS_CONTEXT
|
||||||
wxGraphicsContext* gc = dc->GetGraphicsContext();
|
|
||||||
if (gc)
|
if (gc)
|
||||||
{
|
{
|
||||||
// Draw outline rect so that its outside edges correspond with
|
// Draw outline rect so that its outside edges correspond with
|
||||||
@@ -308,9 +310,12 @@ void wxCaret::DoDraw(wxDC *dc, wxWindow* win)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
// VZ: unfortunately, the rectangle comes out a pixel smaller when this is
|
#if wxUSE_GRAPHICS_CONTEXT
|
||||||
// done under wxGTK - no idea why
|
if (gc == NULL)
|
||||||
//dc->SetLogicalFunction(wxINVERT);
|
#endif
|
||||||
|
{
|
||||||
|
dc->SetLogicalFunction(wxINVERT);
|
||||||
|
}
|
||||||
|
|
||||||
dc->DrawRectangle(m_x, m_y, m_width, m_height);
|
dc->DrawRectangle(m_x, m_y, m_width, m_height);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user