1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: generic/caret.h
3 // Purpose: generic wxCaret class
4 // Author: Vadim Zeitlin (original code by Robert Roebling)
8 // Copyright: (c) wxWidgets team
9 // Licence: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
17 #include "wx/overlay.h"
19 #ifdef wxHAS_NATIVE_OVERLAY
20 #define wxHAS_CARET_USING_OVERLAYS
23 class WXDLLIMPEXP_FWD_CORE wxCaret
;
25 class WXDLLIMPEXP_CORE wxCaretTimer
: public wxTimer
28 wxCaretTimer(wxCaret
*caret
);
29 virtual void Notify();
35 class WXDLLIMPEXP_CORE wxCaret
: public wxCaretBase
40 // default - use Create()
41 wxCaret() : m_timer(this) { InitGeneric(); }
42 // creates a block caret associated with the given window
43 wxCaret(wxWindowBase
*window
, int width
, int height
)
44 : wxCaretBase(window
, width
, height
), m_timer(this) { InitGeneric(); }
45 wxCaret(wxWindowBase
*window
, const wxSize
& size
)
46 : wxCaretBase(window
, size
), m_timer(this) { InitGeneric(); }
53 // called by wxWindow (not using the event tables)
54 virtual void OnSetFocus();
55 virtual void OnKillFocus();
57 // called by wxCaretTimer
61 virtual void DoShow();
62 virtual void DoHide();
63 virtual void DoMove();
64 virtual void DoSize();
66 // blink the caret once
72 // draw the caret on the given DC
73 void DoDraw(wxDC
*dc
, wxWindow
* win
);
76 // GTK specific initialization
79 #ifdef wxHAS_CARET_USING_OVERLAYS
80 // the overlay for displaying the caret
83 // the bitmap holding the part of window hidden by the caret when it was
84 // at (m_xOld, m_yOld)
85 wxBitmap m_bmpUnderCaret
;
91 bool m_blinkedOut
, // true => caret hidden right now
92 m_hasFocus
; // true => our window has focus
95 #endif // _WX_CARET_H_