]> git.saurik.com Git - wxWidgets.git/blame - include/wx/generic/caret.h
wxAnimationCtrl cleanup
[wxWidgets.git] / include / wx / generic / caret.h
CommitLineData
0290598f
VZ
1///////////////////////////////////////////////////////////////////////////////
2// Name: generic/caret.h
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"
16
968eb2ef 17class WXDLLIMPEXP_CORE wxCaret;
e4628635 18
0887f88e 19class WXDLLEXPORT wxCaretTimer : public wxTimer
e4628635
RR
20{
21public:
22 wxCaretTimer(wxCaret *caret);
23 virtual void Notify();
24
25private:
26 wxCaret *m_caret;
27};
28
968eb2ef 29class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase
0290598f
VZ
30{
31public:
32 // ctors
33 // -----
34 // default - use Create()
35 wxCaret() : m_timer(this) { InitGeneric(); }
36 // creates a block caret associated with the given window
37 wxCaret(wxWindowBase *window, int width, int height)
38 : wxCaretBase(window, width, height), m_timer(this) { InitGeneric(); }
39 wxCaret(wxWindowBase *window, const wxSize& size)
40 : wxCaretBase(window, size), m_timer(this) { InitGeneric(); }
41
42 virtual ~wxCaret();
43
44 // implementation
45 // --------------
46
f6bcfd97
BP
47 // called by wxWindow (not using the event tables)
48 virtual void OnSetFocus();
49 virtual void OnKillFocus();
50
51 // called by wxCaretTimer
52 void OnTimer();
0290598f
VZ
53
54protected:
55 virtual void DoShow();
56 virtual void DoHide();
57 virtual void DoMove();
c328d0ad 58 virtual void DoSize();
0290598f 59
f6bcfd97
BP
60 // blink the caret once
61 void Blink();
62
63 // refresh the caret
64 void Refresh();
65
0290598f
VZ
66 // draw the caret on the given DC
67 void DoDraw(wxDC *dc);
ca65c044 68
0290598f
VZ
69private:
70 // GTK specific initialization
71 void InitGeneric();
72
f4b8bf2f
VZ
73 // the bitmap holding the part of window hidden by the caret when it was
74 // at (m_xOld, m_yOld)
75 wxBitmap m_bmpUnderCaret;
76 int m_xOld,
77 m_yOld;
78
e4628635 79 wxCaretTimer m_timer;
ca65c044
WS
80 bool m_blinkedOut, // true => caret hidden right now
81 m_hasFocus; // true => our window has focus
0290598f
VZ
82};
83
84#endif // _WX_CARET_H_