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 #if wxHAS_NATIVE_OVERLAY
20 #define wxHAS_CARET_USING_OVERLAYS 1
22 #define wxHAS_CARET_USING_OVERLAYS 0
25 class WXDLLIMPEXP_CORE wxCaret
;
27 class WXDLLEXPORT wxCaretTimer
: public wxTimer
30 wxCaretTimer(wxCaret
*caret
);
31 virtual void Notify();
37 class WXDLLIMPEXP_CORE wxCaret
: public wxCaretBase
42 // default - use Create()
43 wxCaret() : m_timer(this) { InitGeneric(); }
44 // creates a block caret associated with the given window
45 wxCaret(wxWindowBase
*window
, int width
, int height
)
46 : wxCaretBase(window
, width
, height
), m_timer(this) { InitGeneric(); }
47 wxCaret(wxWindowBase
*window
, const wxSize
& size
)
48 : wxCaretBase(window
, size
), m_timer(this) { InitGeneric(); }
55 // called by wxWindow (not using the event tables)
56 virtual void OnSetFocus();
57 virtual void OnKillFocus();
59 // called by wxCaretTimer
63 virtual void DoShow();
64 virtual void DoHide();
65 virtual void DoMove();
66 virtual void DoSize();
68 // blink the caret once
74 // draw the caret on the given DC
75 void DoDraw(wxDC
*dc
);
78 // GTK specific initialization
81 #if wxHAS_CARET_USING_OVERLAYS
82 // the overlay for displaying the caret
85 // the bitmap holding the part of window hidden by the caret when it was
86 // at (m_xOld, m_yOld)
87 wxBitmap m_bmpUnderCaret
;
93 bool m_blinkedOut
, // true => caret hidden right now
94 m_hasFocus
; // true => our window has focus
97 #endif // _WX_CARET_H_