The following codes(just 2 lines) can invert the color depends on the background color.
Code: Select all
// in ./wxWidgets/src/generic/caret.cpp
void wxCaret::DoDraw(wxDC *dc)
{
/*** jsut commented out the original codes
dc->SetPen( *wxBLACK_PEN );
dc->SetBrush(*(m_hasFocus ? wxBLACK_BRUSH : wxTRANSPARENT_BRUSH));
dc->SetPen(*wxBLACK_PEN);
// VZ: unfortunately, the rectangle comes out a pixel smaller when this is
// done under wxGTK - no idea why
//dc->SetLogicalFunction(wxINVERT);
dc->DrawRectangle(m_x, m_y, m_width, m_height);
***/
// add the 2 lines
if(m_hasFocus)
dc->Blit(m_x, m_y, m_width, m_height, dc, 0, 0, wxINVERT);
}