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