]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/caret.h
Add functor-taking overload of CallAfter().
[wxWidgets.git] / include / wx / generic / caret.h
CommitLineData
0290598f 1///////////////////////////////////////////////////////////////////////////////
80fdcdb9 2// Name: wx/generic/caret.h
0290598f
VZ
3// Purpose: generic wxCaret class
4// Author: Vadim Zeitlin (original code by Robert Roebling)
5// Modified by:
6// Created: 25.05.99
7// RCS-ID: $Id$
77ffb593 8// Copyright: (c) wxWidgets team
65571936 9// Licence: wxWindows licence
0290598f
VZ
10///////////////////////////////////////////////////////////////////////////////
11
0290598f
VZ
12#ifndef _WX_CARET_H_
13#define _WX_CARET_H_
14
15#include "wx/timer.h"
30c841c8
VS
16#include "wx/dc.h"
17#include "wx/overlay.h"
18
69a5bc23
VS
19#ifdef wxHAS_NATIVE_OVERLAY
20 #define wxHAS_CARET_USING_OVERLAYS
30c841c8 21#endif
0290598f 22
b5dbe15d 23class WXDLLIMPEXP_FWD_CORE wxCaret;
e4628635 24
53a2db12 25class WXDLLIMPEXP_CORE wxCaretTimer : public wxTimer
e4628635
RR
26{
27public:
28 wxCaretTimer(wxCaret *caret);
29 virtual void Notify();
30
31private:
32 wxCaret *m_caret;
33};
34
968eb2ef 35class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase
0290598f
VZ
36{
37public:
38 // ctors
39 // -----
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(); }
47
48 virtual ~wxCaret();
49
50 // implementation
51 // --------------
52
f6bcfd97
BP
53 // called by wxWindow (not using the event tables)
54 virtual void OnSetFocus();
55 virtual void OnKillFocus();
56
57 // called by wxCaretTimer
58 void OnTimer();
0290598f
VZ
59
60protected:
61 virtual void DoShow();
62 virtual void DoHide();
63 virtual void DoMove();
c328d0ad 64 virtual void DoSize();
0290598f 65
f6bcfd97
BP
66 // blink the caret once
67 void Blink();
68
69 // refresh the caret
70 void Refresh();
71
0290598f 72 // draw the caret on the given DC
44bcee11 73 void DoDraw(wxDC *dc, wxWindow* win);
ca65c044 74
0290598f
VZ
75private:
76 // GTK specific initialization
77 void InitGeneric();
78
69a5bc23 79#ifdef wxHAS_CARET_USING_OVERLAYS
86141022
SC
80 // the overlay for displaying the caret
81 wxOverlay m_overlay;
82#else
f4b8bf2f
VZ
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;
86 int m_xOld,
87 m_yOld;
86141022 88#endif
f4b8bf2f 89
e4628635 90 wxCaretTimer m_timer;
ca65c044
WS
91 bool m_blinkedOut, // true => caret hidden right now
92 m_hasFocus; // true => our window has focus
0290598f
VZ
93};
94
95#endif // _WX_CARET_H_