]> git.lyx.org Git - lyx.git/blob - src/frontends/screen.h
fitCursor work
[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 class LyXText;
17 class LyXCursor;
18 class WorkArea;
19 class BufferView;
20
21 /**
22  * LyXScreen - document rendering management
23  *
24  * This class is used to manage the on-screen rendering inside the
25  * work area; it is responsible for deciding which LyXText rows
26  * need re-drawing.
27  *
28  * This class will arrange for LyXText to paint onto a pixmap
29  * provided by the WorkArea widget.
30  *
31  * The blinking cursor is also handled here.
32  */
33 class LyXScreen {
34 public:
35         LyXScreen();
36
37         virtual ~LyXScreen();
38
39         /// redraw the screen, without using existing pixmap
40         virtual void redraw(BufferView & bv);
41
42         /**
43          * fitCursor - fit the cursor onto the work area
44          * @param bv the bufferview
45          * @return true if a change was necessary
46          *
47          * Scrolls the screen so that the cursor is visible
48          */
49         virtual bool fitCursor(BufferView *);
50
51         /// hide the visible cursor, if it is visible
52         void hideCursor();
53
54         /// show the cursor if it is not visible
55         void showCursor(BufferView & bv);
56
57         /// toggle the cursor's visibility
58         void toggleCursor(BufferView & bv);
59
60 protected:
61         /// cause the display of the given area of the work area
62         virtual void expose(int x, int y, int w, int h) = 0;
63
64         /// get the work area
65         virtual WorkArea & workarea() const = 0;
66
67         /// types of cursor in work area
68         enum Cursor_Shape {
69                 /// normal I-beam
70                 BAR_SHAPE,
71                 /// L-shape for locked insets of a different language
72                 L_SHAPE,
73                 /// reverse L-shape for RTL text
74                 REVERSED_L_SHAPE
75         };
76
77         /// paint the cursor and store the background
78         virtual void showCursor(int x, int y, int h, Cursor_Shape shape) = 0;
79
80         /// hide the cursor
81         virtual void removeCursor() = 0;
82
83 private:
84         /// grey out (no buffer)
85         void greyOut();
86
87         /// is the cursor currently displayed
88         bool cursor_visible_;
89
90         /// is the screen displaying text or the splash screen?
91         bool greyed_out_;
92 };
93
94 #endif // SCREEN_H