]> git.lyx.org Git - lyx.git/blob - src/lyxscreen.h
fix typo that put too many include paths for most people
[lyx.git] / src / lyxscreen.h
1 // -*- C++ -*-
2 /* This file is part of
3  * ======================================================
4  *
5  *           LyX, The Document Processor
6  *
7  *           Copyright 1995 Matthias Ettrich
8  *           Copyright 1995-2001 The LyX Team
9  *
10  * ====================================================== */
11
12 #ifndef LYXSCREEN_H
13 #define LYXSCREEN_H
14
15 #ifdef __GNUG__
16 #pragma interface
17 #endif
18
19 #include <X11/Xlib.h>
20
21 class LyXText;
22 class WorkArea;
23 class Buffer;
24 class BufferView;
25
26 struct Row;
27
28 /** The class LyXScreen is used for the main Textbody.
29     Concretely, the screen is held in a pixmap.  This pixmap is kept up to
30     date and used to optimize drawing on the screen.
31     This class also handles the drawing of the cursor and partly the selection.
32  */
33 class LyXScreen {
34 public:
35         ///
36         enum Cursor_Shape {
37                 ///
38                 BAR_SHAPE,
39                 ///
40                 L_SHAPE,
41                 ///
42                 REVERSED_L_SHAPE
43         };
44
45         ///
46         LyXScreen(WorkArea &);
47
48         ///
49         ~LyXScreen();
50
51         /// Sets the cursor color to LColor::cursor.
52         void setCursorColor();
53
54         /** Draws the screen form textposition y. Uses as much of
55             the already printed pixmap as possible */
56         void draw(LyXText *, BufferView *, unsigned int y);
57
58         /// Redraws the screen, without using existing pixmap
59         void redraw(LyXText *, BufferView *);
60
61         /// Returns a new top so that the cursor is visible
62         unsigned int topCursorVisible(LyXText const *);
63         /// Redraws the screen such that the cursor is visible
64         bool fitCursor(LyXText *, BufferView *);
65         ///
66         void showCursor(LyXText const *, BufferView const *);
67         ///
68         void hideCursor();
69         ///
70         void cursorToggle(BufferView *) const;
71         ///
72         void showManualCursor(LyXText const *, int x, int y,
73                               int asc, int desc,
74                               Cursor_Shape shape);
75         /// returns 1 if first has changed, otherwise 0
76         bool fitManualCursor(LyXText *, BufferView *, int, int, int, int);
77         ///
78         void toggleSelection(LyXText *, BufferView *, bool = true,
79                              int y_offset = 0, int x_offset = 0);
80         ///
81         void toggleToggle(LyXText *, BufferView *,
82                           int y_offset = 0, int x_offset = 0);
83
84         /** Updates part of the screen. If text->status is
85             LyXText::NEED_MORE_REFRESH, we update from the
86             point of change and to the end of the screen.
87             If text->status is LyXText::NEED_VERY_LITTLE_REFRESH,
88             we only update the current row. */
89         void update(LyXText *, BufferView *, int y_offset=0, int x_offset=0);
90         ///
91         bool forceClear() const { return force_clear; }
92
93         ///
94         bool cursor_visible;
95 private:
96         /// Copies specified area of pixmap to screen
97         void expose(int x, int y, int exp_width, int exp_height);
98
99         /// y1 and y2 are coordinates of the screen
100         void drawFromTo(LyXText *, BufferView *, int y1, int y2,
101                         int y_offset = 0, int x_offset = 0, bool internal=false);
102
103         /// y is a coordinate of the text
104         void drawOneRow(LyXText *, BufferView *, Row * row,
105                         int y_text, int y_offset = 0, int x_offset = 0);
106
107         ///
108         WorkArea & owner;
109
110         ///
111         Pixmap cursor_pixmap;
112         ///
113         int cursor_pixmap_x;
114         ///
115         int cursor_pixmap_y;
116         ///
117         int cursor_pixmap_w;
118         ///
119         int cursor_pixmap_h;
120         ///
121         GC gc_copy;
122         ///
123         bool force_clear;
124 };
125
126 #endif