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