]> git.lyx.org Git - lyx.git/blob - src/frontends/WorkArea.h
33ca042d09d06b8f0b841b20342f159c71467ba5
[lyx.git] / src / frontends / WorkArea.h
1 // -*- C++ -*-
2 /**
3  * \file WorkArea.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  * \author Abdelrazak Younes
10  *
11  * Full author contact details are available in file CREDITS.
12  */
13
14 #ifndef BASE_WORKAREA_H
15 #define BASE_WORKAREA_H
16
17 #include "frontends/GuiCursor.h"
18
19 #include "frontends/key_state.h"
20 #include "frontends/LyXKeySym.h"
21
22 class BufferView;
23 class ViewMetricsInfo;
24
25 namespace lyx {
26 namespace frontend {
27
28 class Painter;
29
30 /**
31  * The work area class represents the widget that provides the
32  * view onto a document. It is owned by the BufferView, and
33  * is responsible for handing events back to its owning BufferView.
34  * It works in concert with the BaseScreen class to update the
35  * widget view of a document.
36  */
37 class WorkArea {
38 public:
39         WorkArea(BufferView * buffer_view = 0);
40
41         virtual ~WorkArea() {}
42
43         void setBufferView(BufferView * buffer_view);
44
45         ///
46         BufferView & bufferView();
47         ///
48         BufferView const & bufferView() const;
49
50         /// return the painter object for this work area
51         virtual Painter & getPainter() = 0;
52
53         /// return the width of the work area in pixels
54         virtual int width() const = 0;
55
56         /// return the height of the work area in pixels
57         virtual int height() const = 0;
58
59         /**
60          * Update the scrollbar.
61          * @param height the total document height in pixels
62          * @param pos the current position in the document, in pixels
63          * @param line_height the line-scroll amount, in pixels
64          */
65         virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
66
67         /// redraw the screen, without using existing pixmap
68         virtual void redraw(BufferView & bv, ViewMetricsInfo const & vi);
69
70         /// grey out (no buffer)
71         void greyOut();
72
73         /// paint the cursor and store the background
74         virtual void showCursor(int x, int y, int h, CursorShape shape) = 0;
75
76         /// hide the cursor
77         virtual void removeCursor() = 0;
78
79 protected:
80         /// cause the display of the given area of the work area
81         virtual void expose(int x, int y, int w, int h) = 0;
82
83         ///
84         BufferView * buffer_view_;
85
86 private:
87         ///
88         void checkAndGreyOut();
89
90         ///
91         bool greyed_out_;
92 };
93
94 } // namespace frontend
95 } // namespace lyx
96
97 #endif // BASE_WORKAREA_H