]> git.lyx.org Git - lyx.git/blob - src/frontends/WorkArea.h
GUI API Cleanup step 2: merge of the "younes" branch. What's missing
[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         /// return the painter object for this work area
46         virtual Painter & getPainter() = 0;
47
48         /// return the width of the work area in pixels
49         virtual int width() const = 0;
50
51         /// return the height of the work area in pixels
52         virtual int height() const = 0;
53
54         /**
55          * Update the scrollbar.
56          * @param height the total document height in pixels
57          * @param pos the current position in the document, in pixels
58          * @param line_height the line-scroll amount, in pixels
59          */
60         virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
61
62         /// redraw the screen, without using existing pixmap
63         virtual void redraw(BufferView & bv, ViewMetricsInfo const & vi);
64
65         /// grey out (no buffer)
66         void greyOut();
67
68         /// paint the cursor and store the background
69         virtual void showCursor(int x, int y, int h, CursorShape shape) = 0;
70
71         /// hide the cursor
72         virtual void removeCursor() = 0;
73
74 protected:
75         /// cause the display of the given area of the work area
76         virtual void expose(int x, int y, int w, int h) = 0;
77
78         ///
79         BufferView * buffer_view_;
80
81 private:
82         ///
83         void checkAndGreyOut();
84
85         ///
86         bool greyed_out_;
87 };
88
89 } // namespace frontend
90 } // namespace lyx
91
92 #endif // BASE_WORKAREA_H