diff --git a/include/wx/caret.h b/include/wx/caret.h index 07e06afeea..817f32b73e 100644 --- a/include/wx/caret.h +++ b/include/wx/caret.h @@ -12,6 +12,10 @@ #ifndef _WX_CARET_H_BASE_ #define _WX_CARET_H_BASE_ +#include "wx/defs.h" + +#if wxUSE_CARET + #ifdef __GNUG__ #pragma interface "caret.h" #endif @@ -222,5 +226,7 @@ private: wxCaret *m_caret; }; +#endif // wxUSE_CARET + #endif // _WX_CARET_H_BASE_ diff --git a/src/univ/winuniv.cpp b/src/univ/winuniv.cpp index c0a191be54..14fb882f2d 100644 --- a/src/univ/winuniv.cpp +++ b/src/univ/winuniv.cpp @@ -41,6 +41,10 @@ #include "wx/univ/renderer.h" #include "wx/univ/theme.h" +#if wxUSE_CARET + #include "wx/caret.h" +#endif // wxUSE_CARET + // turn Refresh() debugging on/off #define WXDEBUG_REFRESH @@ -756,6 +760,14 @@ wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal) ptDest.y += dy; } +#if wxUSE_CARET + // we need to hide the caret before moving or it will erase itself at + // the wrong (old) location + wxCaret *caret = GetCaret(); + if ( caret ) + caret->Hide(); +#endif // wxUSE_CARET + // do move wxClientDC dc(this); wxBitmap bmp(size.x, size.y); @@ -826,6 +838,11 @@ wxRect wxWindow::ScrollNoRefresh(int dx, int dy, const wxRect *rectTotal) rect.x, rect.y, rect.GetRight() + 1, rect.GetBottom() + 1); } + +#if wxUSE_CARET + if ( caret ) + caret->Show(); +#endif // wxUSE_CARET } return rect;