X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfb76a19a4aeb25f245196ff5d4cae8a33fa6802..844f90fba68fc9fbd3e839825d406839ee9fb9fb:/include/wx/caret.h?ds=inline diff --git a/include/wx/caret.h b/include/wx/caret.h index 9e0f3d3ea8..07e06afeea 100644 --- a/include/wx/caret.h +++ b/include/wx/caret.h @@ -196,5 +196,31 @@ private: #include "wx/generic/caret.h" #endif // platform +// ---------------------------------------------------------------------------- +// 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 +// ---------------------------------------------------------------------------- + +class WXDLLEXPORT wxCaretSuspend +{ +public: + wxCaretSuspend(wxWindow *win) + { + m_caret = win->GetCaret(); + if ( m_caret ) + m_caret->Hide(); + } + + ~wxCaretSuspend() + { + if ( m_caret ) + m_caret->Show(); + } + +private: + wxCaret *m_caret; +}; + #endif // _WX_CARET_H_BASE_