4 * This file is part of LyX, the document processor.
5 * Licence details can be found in the file COPYING.
10 * Full author contact details are available in file CREDITS
24 * LyXScreen - document rendering management
26 * This class is used to manage the on-screen rendering inside the
27 * work area; it is responsible for deciding which LyXText rows
30 * This class will arrange for LyXText to paint onto a pixmap
31 * provided by the WorkArea widget.
33 * The blinking cursor is also handled here.
42 * draw the screen from a given position
43 * @param y the text position to draw from
45 * Uses as much of the already printed pixmap as possible
47 virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
50 * fit the cursor onto the visible work area, scrolling if necessary
51 * @param bv the buffer view
52 * @param vheight the height of the visible region
53 * @param base_y the top of the lyxtext to look at
54 * @param x the new x position
55 * @param y the new y position
56 * @param a ascent of the cursor's row
57 * @param d descent of the cursor's row
58 * @return true if the work area needs scrolling as a result
60 bool fitManualCursor(BufferView * bv, LyXText * text,
61 int x, int y, int a, int d);
63 /// redraw the screen, without using existing pixmap
64 virtual void redraw(BufferView * bv, LyXText * text);
67 * topCursorVisible - get a new "top" to make the cursor visible
70 * This helper function calculates a new y co-ordinate for
71 * the top of the containing region such that the cursor contained
72 * within the LyXText is "nicely" visible.
74 virtual unsigned int topCursorVisible(LyXText *);
77 * fitCursor - fit the cursor onto the work area
78 * @param text the text containing the cursor
79 * @param bv the bufferview
80 * @return true if a change was necessary
82 * Scrolls the screen so that the cursor is visible
84 virtual bool fitCursor(LyXText *, BufferView *);
87 * update - update part of the screen rendering
88 * @param bv the bufferview
89 * @param xo the x offset into the text
90 * @param yo the x offset into the text
92 * Updates part of the screen. If bv->text->needRefresh is
93 * true, we update from the
94 * point of change to the end of the screen.
96 virtual void update(BufferView & bv, int yo = 0, int xo = 0);
98 /// hide the visible cursor, if it is visible
101 /// show the cursor if it is not visible
102 void showCursor(BufferView & bv);
104 /// toggle the cursor's visibility
105 void toggleCursor(BufferView & bv);
108 virtual void toggleSelection(LyXText *, BufferView *, bool = true,
109 int y_offset = 0, int x_offset = 0);
112 /// cause the display of the given area of the work area
113 virtual void expose(int x, int y, int w, int h) = 0;
115 /// get the work area
116 virtual WorkArea & workarea() const = 0;
118 /// types of cursor in work area
122 /// L-shape for locked insets of a different language
124 /// reverse L-shape for RTL text
128 /// paint the cursor and store the background
129 virtual void showCursor(int x, int y, int h, Cursor_Shape shape) = 0;
132 virtual void removeCursor() = 0;
134 /// y1 and y2 are coordinates of the screen
135 void drawFromTo(LyXText *, BufferView *, int y1, int y2,
136 int y_offset = 0, int x_offset = 0);
139 /// grey out (no buffer)
142 /// is the cursor currently displayed
143 bool cursor_visible_;
145 /// is the screen displaying text or the splash screen?