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
27 * LyXScreen - document rendering management
29 * This class is used to manage the on-screen rendering inside the
30 * work area; it is responsible for deciding which LyXText rows
33 * This class will arrange for LyXText to paint onto a pixmap
34 * provided by the WorkArea widget.
36 * The blinking cursor is also handled here.
40 /// types of cursor in work area
44 /// L-shape for locked insets of a different language
46 /// reverse L-shape for RTL text
55 * draw the screen from a given position
56 * @param y the text position to draw from
58 * Uses as much of the already printed pixmap as possible
60 virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
63 * showManualCursor - display the cursor on the work area
64 * @param text the lyx text containing the cursor
65 * @param x the x position of the cursor
66 * @param y the y position of the row's baseline
67 * @param asc ascent of the row
68 * @param desc descent of the row
69 * @param shape the current shape
71 virtual void showManualCursor(LyXText const *, int x, int y,
73 Cursor_Shape shape) = 0;
75 /// unpaint the cursor painted by showManualCursor()
76 virtual void hideCursor() = 0;
79 * fit the cursor onto the visible work area, scrolling if necessary
80 * @param bv the buffer view
81 * @param vheight the height of the visible region
82 * @param base_y the top of the lyxtext to look at
83 * @param x the new x position
84 * @param y the new y position
85 * @param a ascent of the cursor's row
86 * @param d descent of the cursor's row
87 * @return true if the work area needs scrolling as a result
89 bool fitManualCursor(BufferView * bv, LyXText * text,
90 int x, int y, int a, int d);
92 /// redraw the screen, without using existing pixmap
93 virtual void redraw(LyXText *, BufferView *);
95 /// draw the cursor if it's not already shown
96 virtual void showCursor(LyXText const *, BufferView const *);
99 * topCursorVisible - get a new "top" to make the cursor visible
100 * @param c the cursor
101 * @param top_y the current y location of the containing region
103 * This helper function calculates a new y co-ordinate for
104 * the top of the containing region such that the cursor contained
105 * within the LyXText is "nicely" visible.
107 virtual unsigned int topCursorVisible(LyXCursor const & c, int top_y);
110 * fitCursor - fit the cursor onto the work area
111 * @param text the text containing the cursor
112 * @param bv the bufferview
113 * @return true if a change was necessary
115 * Scrolls the screen so that the cursor is visible
117 virtual bool fitCursor(LyXText *, BufferView *);
119 /// show the cursor if it's not, and vice versa
120 virtual void cursorToggle(BufferView *) const;
123 * update - update part of the screen rendering
124 * @param text the containing text region
125 * @param bv the bufferview
126 * @param xo the x offset into the text
127 * @param yo the x offset into the text
129 * Updates part of the screen. If text->status is
130 * LyXText::NEED_MORE_REFRESH, we update from the
131 * point of change and to the end of the screen.
132 * If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
133 * we only update the current row.
135 virtual void update(LyXText * text, BufferView * bv, int yo = 0, int xo = 0);
138 virtual void toggleSelection(LyXText *, BufferView *, bool = true,
139 int y_offset = 0, int x_offset = 0);
141 /// FIXME - at least change the name !!
142 virtual void toggleToggle(LyXText *, BufferView *,
143 int y_offset = 0, int x_offset = 0);
146 virtual bool forceClear() const { return force_clear_; }
149 /// cause the display of the given area of the work area
150 virtual void expose(int x, int y, int w, int h) = 0;
152 /// get the work area
153 virtual WorkArea & workarea() const = 0;
155 /// y1 and y2 are coordinates of the screen
156 virtual void drawFromTo(LyXText *, BufferView *, int y1, int y2,
157 int y_offset = 0, int x_offset = 0, bool internal = false);
159 /// y is a coordinate of the text
160 virtual void drawOneRow(LyXText *, BufferView *, Row * row,
161 int y_text, int y_offset = 0, int x_offset = 0);
163 /// grey out (no buffer)
169 /// is the blinking cursor currently drawn
170 bool cursor_visible_;