+// ----------------------------------------------------------------------------
+// wxCaretSuspend: a simple class which hides the caret in its ctor and
+// restores it in the dtor, this should be used when drawing on the screen to
+// avoid overdrawing the caret
+// ----------------------------------------------------------------------------
+
+#ifdef wxHAS_CARET_USING_OVERLAYS
+
+// we don't need to hide the caret if it's rendered using overlays
+class WXDLLIMPEXP_CORE wxCaretSuspend
+{
+public:
+ wxCaretSuspend(wxWindow *WXUNUSED(win)) {}
+
+ wxDECLARE_NO_COPY_CLASS(wxCaretSuspend);
+};
+
+#else // !wxHAS_CARET_USING_OVERLAYS
+
+class WXDLLIMPEXP_CORE wxCaretSuspend
+{
+public:
+ wxCaretSuspend(wxWindow *win)
+ {
+ m_caret = win->GetCaret();
+ m_show = false;
+ if ( m_caret && m_caret->IsVisible() )
+ {
+ m_caret->Hide();
+ m_show = true;
+ }
+ }