]> git.saurik.com Git - wxWidgets.git/blame_incremental - include/wx/generic/caret.h
fixing 'id' objc.h collisions, listbox rewrite
[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
17class WXDLLIMPEXP_CORE wxCaret;
18
19class WXDLLEXPORT wxCaretTimer : public wxTimer
20{
21public:
22 wxCaretTimer(wxCaret *caret);
23 virtual void Notify();
24
25private:
26 wxCaret *m_caret;
27};
28
29class WXDLLIMPEXP_CORE wxCaret : public wxCaretBase
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
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();
53
54protected:
55 virtual void DoShow();
56 virtual void DoHide();
57 virtual void DoMove();
58 virtual void DoSize();
59
60 // blink the caret once
61 void Blink();
62
63 // refresh the caret
64 void Refresh();
65
66 // draw the caret on the given DC
67 void DoDraw(wxDC *dc);
68
69private:
70 // GTK specific initialization
71 void InitGeneric();
72
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
79 wxCaretTimer m_timer;
80 bool m_blinkedOut, // true => caret hidden right now
81 m_hasFocus; // true => our window has focus
82};
83
84#endif // _WX_CARET_H_