]> git.lyx.org Git - lyx.git/blob - src/frontends/GuiCursor.h
* MSVC Compilation fix: #warning is not supported.
[lyx.git] / src / frontends / GuiCursor.h
1 // -*- C++ -*-
2 /**
3  * \file GuiCursor.h
4  * This file is part of LyX, the document processor.
5  * Licence details can be found in the file COPYING.
6  *
7  * \author unknown
8  * \author John Levon
9  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 // X11 use a define called CursorShape, and we really want to use
15 // that name our selves. Therefore we do something similar to what is done
16 // in kde/fixx11h.h:
17 namespace X {
18 #ifdef CursorShape
19 #ifndef FIXX11H_CursorShape
20 #define FIXX11H_CursorShape
21 int const XCursorShape = CursorShape;
22 #undef CursorShape
23 int const CursorShape = CursorShape;
24 #endif
25 #undef CursorShape
26 #endif
27
28 } // namespace X
29
30 #ifndef GUI_CURSOR_H
31 #define GUI_CURSOR_H
32
33
34 class LyXText;
35 class CursorSlice;
36 class BufferView;
37 class ViewMetricsInfo;
38
39 namespace lyx {
40 namespace frontend {
41
42 class WorkArea;
43
44 /// types of cursor in work area
45 enum CursorShape {
46         /// normal I-beam
47         BAR_SHAPE,
48         /// L-shape for locked insets of a different language
49         L_SHAPE,
50         /// reverse L-shape for RTL text
51         REVERSED_L_SHAPE
52 };
53
54 /**
55  * GuiCursor - document rendering management
56  *
57  * The blinking cursor is handled here.
58  */
59 class GuiCursor {
60 public:
61         GuiCursor();
62
63         virtual ~GuiCursor();
64
65         void connect(WorkArea * work_area);
66
67         /// hide the visible cursor, if it is visible
68         void hide();
69
70         /// show the cursor if it is not visible
71         void show(BufferView & bv);
72
73         /// toggle the cursor's visibility
74         void toggle(BufferView & bv);
75
76         /// set cursor_visible_ to false in prep for re-display
77         void prepare();
78
79 private:
80         /// is the cursor currently displayed
81         bool cursor_visible_;
82
83         WorkArea * work_area_;
84 };
85
86 } // namespace frontend
87 } // namespace lyx
88
89 #endif // GUI_CURSOR_H