]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/caret.h
Compilation fix for old GCC versions.
[wxWidgets.git] / include / wx / generic / caret.h
... / ...
CommitLineData
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$
8// Copyright: (c) wxWidgets team
9// Licence: wxWindows licence
10///////////////////////////////////////////////////////////////////////////////
11
12#ifndef _WX_CARET_H_
13#define _WX_CARET_H_
14
15#include "wx/timer.h"
16#include "wx/dc.h"
17#include "wx/overlay.h"
18
19#ifdef wxHAS_NATIVE_OVERLAY
20 #define wxHAS_CARET_USING_OVERLAYS
21#endif
22
23class WXDLLIMPEXP_CORE wxCaret;
24
25class WXDLLEXPORT wxCaretTimer : public wxTimer
26{
27public:
28 wxCaretTimer(wxCaret *caret);
29 virtual void Notify();
30
31private:
32 wxCaret *m_caret;
33};
34
35class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase
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
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();
59
60protected:
61 virtual void DoShow();
62 virtual void DoHide();
63 virtual void DoMove();
64 virtual void DoSize();
65
66 // blink the caret once
67 void Blink();
68
69 // refresh the caret
70 void Refresh();
71
72 // draw the caret on the given DC
73 void DoDraw(wxDC *dc);
74
75private:
76 // GTK specific initialization
77 void InitGeneric();
78
79#ifdef wxHAS_CARET_USING_OVERLAYS
80 // the overlay for displaying the caret
81 wxOverlay m_overlay;
82#else
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;
88#endif
89
90 wxCaretTimer m_timer;
91 bool m_blinkedOut, // true => caret hidden right now
92 m_hasFocus; // true => our window has focus
93};
94
95#endif // _WX_CARET_H_