Ejemplo n.º 1
0
Archivo: caret.cpp Proyecto: EdgarTx/wx
void wxCaret::Refresh()
{
    wxClientDC dcWin(GetWindow());
// this is the new code, switch to 0 if this gives problems
#ifdef wxHAS_CARET_USING_OVERLAYS
    wxDCOverlay dcOverlay( m_overlay, &dcWin, m_x, m_y, m_width , m_height );
    if ( m_blinkedOut )
    {
        dcOverlay.Clear();
    }
    else
    {
        DoDraw( &dcWin );
    }
#else
    wxMemoryDC dcMem;
    dcMem.SelectObject(m_bmpUnderCaret);
    if ( m_blinkedOut )
    {
        // restore the old image
        dcWin.Blit(m_xOld, m_yOld, m_width, m_height,
                   &dcMem, 0, 0);
        m_xOld =
        m_yOld = -1;
    }
    else
    {
        if ( m_xOld == -1 && m_yOld == -1 )
        {
            // save the part we're going to overdraw

            int x = m_x,
                y = m_y;
#if defined(__WXGTK__) && !defined(__WX_DC_BLIT_FIXED__)
            wxPoint pt = dcWin.GetDeviceOrigin();
            x += pt.x;
            y += pt.y;
#endif // broken wxGTK wxDC::Blit
            dcMem.Blit(0, 0, m_width, m_height,
                       &dcWin, x, y);

            m_xOld = m_x;
            m_yOld = m_y;
        }
        //else: we already saved the image below the caret, don't do it any
        //      more

        // and draw the caret there
        DoDraw(&dcWin);
    }
#endif
}
Ejemplo n.º 2
0
void wxCaret::Refresh()
{
    wxClientDC dcWin(GetWindow());
// this is the new code, switch to 0 if this gives problems
#ifdef wxHAS_CARET_USING_OVERLAYS
    wxDCOverlay dcOverlay( m_overlay, &dcWin, m_x, m_y, m_width , m_height );
    if ( m_blinkedOut )
    {
        dcOverlay.Clear();
    }
    else
    {
        DoDraw( &dcWin, GetWindow() );
    }
#else
    wxMemoryDC dcMem;
    dcMem.SelectObject(m_bmpUnderCaret);
    if ( m_blinkedOut )
    {
        // restore the old image
        dcWin.Blit(m_xOld, m_yOld, m_width, m_height,
                   &dcMem, 0, 0);
        m_xOld =
        m_yOld = -1;
    }
    else
    {
        if ( m_xOld == -1 && m_yOld == -1 )
        {
            // save the part we're going to overdraw
            dcMem.Blit(0, 0, m_width, m_height,
                       &dcWin, m_x, m_y);

            m_xOld = m_x;
            m_yOld = m_y;
        }
        //else: we already saved the image below the caret, don't do it any
        //      more

        // and draw the caret there
        DoDraw(&dcWin, GetWindow());
    }
#endif
}