]>
Commit | Line | Data |
---|---|---|
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$ | |
8 | // Copyright: (c) wxWindows team | |
9 | // Licence: wxWindows licence | |
10 | /////////////////////////////////////////////////////////////////////////////// | |
11 | ||
12 | #if 0 //def __GNUG__ | |
13 | #pragma implementation "caret.h" | |
14 | #endif | |
15 | ||
16 | #ifndef _WX_CARET_H_ | |
17 | #define _WX_CARET_H_ | |
18 | ||
19 | #include "wx/timer.h" | |
20 | ||
21 | class wxCaret : public wxCaretBase | |
22 | { | |
23 | public: | |
24 | // ctors | |
25 | // ----- | |
26 | // default - use Create() | |
27 | wxCaret() : m_timer(this) { InitGeneric(); } | |
28 | // creates a block caret associated with the given window | |
29 | wxCaret(wxWindowBase *window, int width, int height) | |
30 | : wxCaretBase(window, width, height), m_timer(this) { InitGeneric(); } | |
31 | wxCaret(wxWindowBase *window, const wxSize& size) | |
32 | : wxCaretBase(window, size), m_timer(this) { InitGeneric(); } | |
33 | ||
34 | virtual ~wxCaret(); | |
35 | ||
36 | // implementation | |
37 | // -------------- | |
38 | ||
39 | // blink the caret once | |
40 | void Blink(); | |
41 | ||
42 | protected: | |
43 | virtual void DoShow(); | |
44 | virtual void DoHide(); | |
45 | virtual void DoMove(); | |
46 | ||
47 | // draw the caret on the given DC | |
48 | void DoDraw(wxDC *dc); | |
49 | ||
50 | private: | |
51 | // GTK specific initialization | |
52 | void InitGeneric(); | |
53 | ||
54 | class CaretTimer : public wxTimer | |
55 | { | |
56 | public: | |
57 | CaretTimer(wxCaret *caret) { m_caret = caret; } | |
58 | ||
59 | virtual void Notify() { m_caret->Blink(); } | |
60 | ||
61 | private: | |
62 | wxCaret *m_caret; | |
63 | } m_timer; | |
64 | ||
65 | bool m_blinkedOut; // TRUE => caret hidden right now | |
66 | }; | |
67 | ||
68 | #endif // _WX_CARET_H_ |