+// ----------------------------------------------------------------------------
+// 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 WXDLLEXPORT wxCaretSuspend
+{
+public:
+ wxCaretSuspend(wxWindow *WXUNUSED(win)) {}
+
+ DECLARE_NO_COPY_CLASS(wxCaretSuspend)
+};
+
+#else // !wxHAS_CARET_USING_OVERLAYS
+
+class WXDLLEXPORT wxCaretSuspend
+{
+public:
+ wxCaretSuspend(wxWindow *win)
+ {
+ m_caret = win->GetCaret();
+ m_show = false;
+ if ( m_caret && m_caret->IsVisible() )
+ {
+ m_caret->Hide();
+ m_show = true;
+ }
+ }
+
+ ~wxCaretSuspend()
+ {
+ if ( m_caret && m_show )
+ m_caret->Show();
+ }
+
+private:
+ wxCaret *m_caret;
+ bool m_show;
+
+ DECLARE_NO_COPY_CLASS(wxCaretSuspend)
+};
+
+#endif // wxHAS_CARET_USING_OVERLAYS/!wxHAS_CARET_USING_OVERLAYS