4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
8 * \author John Levon <moz@compsoc.man.ac.uk>
25 * LyXScreen - document rendering management
27 * This class is used to manage the on-screen rendering inside the
28 * work area; it is responsible for deciding which LyXText rows
31 * This class will arrange for LyXText to paint onto a pixmap
32 * provided by the WorkArea widget.
34 * The blinking cursor is also handled here.
38 /// types of cursor in work area
42 /// L-shape for locked insets of a different language
44 /// reverse L-shape for RTL text
53 * draw the screen from a given position
54 * @param y the text position to draw from
56 * Uses as much of the already printed pixmap as possible
58 virtual void draw(LyXText *, BufferView *, unsigned int y) = 0;
61 * showManualCursor - display the cursor on the work area
62 * @param text the lyx text containing the cursor
63 * @param x the x position of the cursor
64 * @param y the y position of the row's baseline
65 * @param asc ascent of the row
66 * @param desc descent of the row
67 * @param shape the current shape
69 virtual void showManualCursor(LyXText const *, int x, int y,
71 Cursor_Shape shape) = 0;
73 /// unpaint the cursor painted by showManualCursor()
74 virtual void hideCursor() = 0;
77 * fit the cursor onto the visible work area, scrolling if necessary
78 * @param bv the buffer view
79 * @param vheight the height of the visible region
80 * @param base_y the top of the lyxtext to look at
81 * @param x the new x position
82 * @param y the new y position
83 * @param a ascent of the cursor's row
84 * @param d descent of the cursor's row
85 * @return true if the work area needs scrolling as a result
87 bool fitManualCursor(BufferView * bv, LyXText * text,
88 int x, int y, int a, int d);
90 /// redraw the screen, without using existing pixmap
91 virtual void redraw(LyXText *, BufferView *);
93 /// draw the cursor if it's not already shown
94 virtual void showCursor(LyXText const *, BufferView const *);
97 * topCursorVisible - get a new "top" to make the cursor visible
99 * @param top_y the current y location of the containing region
101 * This helper function calculates a new y co-ordinate for
102 * the top of the containing region such that the cursor contained
103 * within the LyXText is "nicely" visible.
105 virtual unsigned int topCursorVisible(LyXCursor const & c, int top_y);
108 * fitCursor - fit the cursor onto the work area
109 * @param text the text containing the cursor
110 * @param bv the bufferview
111 * @return true if a change was necessary
113 * Scrolls the screen so that the cursor is visible
115 virtual bool fitCursor(LyXText *, BufferView *);
117 /// show the cursor if it's not, and vice versa
118 virtual void cursorToggle(BufferView *) const;
121 * update - update part of the screen rendering
122 * @param text the containing text region
123 * @param bv the bufferview
124 * @param xo the x offset into the text
125 * @param yo the x offset into the text
127 * Updates part of the screen. If text->status is
128 * LyXText::NEED_MORE_REFRESH, we update from the
129 * point of change and to the end of the screen.
130 * If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
131 * we only update the current row.
133 virtual void update(LyXText * text, BufferView * bv, int yo = 0, int xo = 0);
136 virtual void toggleSelection(LyXText *, BufferView *, bool = true,
137 int y_offset = 0, int x_offset = 0);
139 /// FIXME - at least change the name !!
140 virtual void toggleToggle(LyXText *, BufferView *,
141 int y_offset = 0, int x_offset = 0);
144 virtual bool forceClear() const { return force_clear_; }
147 /// cause the display of the given area of the work area
148 virtual void expose(int x, int y, int w, int h) = 0;
150 /// get the work area
151 virtual WorkArea & workarea() const = 0;
153 /// y1 and y2 are coordinates of the screen
154 virtual void drawFromTo(LyXText *, BufferView *, int y1, int y2,
155 int y_offset = 0, int x_offset = 0, bool internal = false);
157 /// y is a coordinate of the text
158 virtual void drawOneRow(LyXText *, BufferView *, Row * row,
159 int y_text, int y_offset = 0, int x_offset = 0);
161 /// grey out (no buffer)
167 /// is the blinking cursor currently drawn
168 bool cursor_visible_;