]> git.lyx.org Git - lyx.git/blob - src/frontends/screen.h
Fix bug 2195: Slowness in rendering inside insets, especially on the Mac
[lyx.git] / src / frontends / screen.h
1 // -*- C++ -*-
2 /**
3  * \file screen.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  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef SCREEN_H
14 #define SCREEN_H
15
16
17 class LyXText;
18 class CursorSlice;
19 class WorkArea;
20 class BufferView;
21 class ViewMetricsInfo;
22
23
24 /**
25  * LyXScreen - document rendering management
26  *
27  * This class is used to manage the on-screen rendering inside the
28  * work area; it is responsible for deciding which LyXText rows
29  * need re-drawing.
30  *
31  * This class will arrange for LyXText to paint onto a pixmap
32  * provided by the WorkArea widget.
33  *
34  * The blinking cursor is also handled here.
35  */
36 class LyXScreen {
37 public:
38         LyXScreen();
39
40         virtual ~LyXScreen();
41
42         /// redraw the screen, without using existing pixmap
43         virtual void redraw(BufferView & bv, ViewMetricsInfo const & vi);
44
45         /// grey out (no buffer)
46         void greyOut();
47
48         /// hide the visible cursor, if it is visible
49         void hideCursor();
50
51         /// show the cursor if it is not visible
52         void showCursor(BufferView & bv);
53
54         /// toggle the cursor's visibility
55         void toggleCursor(BufferView & bv);
56
57         /// set cursor_visible_ to false in prep for re-display
58         void prepareCursor();
59
60
61 protected:
62         /// cause the display of the given area of the work area
63         virtual void expose(int x, int y, int w, int h) = 0;
64
65         /// get the work area
66         virtual WorkArea & workarea() const = 0;
67
68         /// types of cursor in work area
69         enum Cursor_Shape {
70                 /// normal I-beam
71                 BAR_SHAPE,
72                 /// L-shape for locked insets of a different language
73                 L_SHAPE,
74                 /// reverse L-shape for RTL text
75                 REVERSED_L_SHAPE
76         };
77
78         /// paint the cursor and store the background
79         virtual void showCursor(int x, int y, int h, Cursor_Shape shape) = 0;
80
81         /// hide the cursor
82         virtual void removeCursor() = 0;
83
84 private:
85         ///
86         void checkAndGreyOut();
87
88         ///
89         bool greyed_out_;
90
91         /// is the cursor currently displayed
92         bool cursor_visible_;
93
94 };
95
96 #endif // SCREEN_H