]> git.lyx.org Git - features.git/blob - src/frontends/qt3/GuiWorkArea.h
This is the merging of the GUI API cleanup branch that was developed in svn+ssh:...
[features.git] / src / frontends / qt3 / GuiWorkArea.h
1 // -*- C++ -*-
2 /**
3  * \file qt3/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 Abdelrazak Younes
8  *
9  * Full author contact details are available in file CREDITS.
10  */
11
12 #ifndef WORKAREA_H
13 #define WORKAREA_H
14
15 #include "frontends/WorkArea.h"
16
17 #include "qscreen.h"
18 #include "QWorkArea.h"
19
20 namespace lyx {
21 namespace frontend {
22
23 typedef QScreen FScreen;
24 typedef QWorkArea FWorkArea;
25
26 /**
27  * Temporary wrapper around QWorkArea and QScreen.
28  * Please refer to the Qt4 implementation for a proper cleanup of the API.
29  */
30 class GuiWorkArea: public lyx::frontend::WorkArea {
31 public:
32         GuiWorkArea(LyXView & owner, int w, int h,
33                 FScreen * screen, FWorkArea * work_area)
34                 : lyx::frontend::WorkArea(owner, w, h),
35                 old_screen_(screen), old_work_area_(work_area)
36         {
37         }
38
39         ~GuiWorkArea() {}
40
41         /// return the painter object for this work area
42         virtual lyx::frontend::Painter & getPainter()
43         {
44                 return old_work_area_->getPainter();
45         }
46
47         /// return the width of the work area in pixels
48         virtual int width() const
49         {
50                 return old_work_area_->workWidth();
51         }
52
53         /// return the height of the work area in pixels
54         virtual int height() const
55         {
56                 return old_work_area_->workHeight();
57         }
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)
66         {
67                 old_work_area_->setScrollbarParams(height, pos, line_height);
68         }
69
70
71         /// paint the cursor and store the background
72         virtual void showCursor(int x, int y, int h, Cursor_Shape shape)
73         {
74                 old_screen_->showCursor(x, y, h, shape);
75         }
76
77         /// hide the cursor
78         virtual void removeCursor()
79         {
80                 old_screen_->removeCursor();
81         }
82
83 protected:
84         /// cause the display of the given area of the work area
85         virtual void expose(int x, int y, int w, int h)
86         {
87                 old_screen_->expose(x, y, w, h);
88         }
89
90 private:
91         FScreen * old_screen_;
92         FWorkArea * old_work_area_;
93 };
94
95 } // namespace frontend
96 } // namespace lyx
97
98 #endif // WORKAREA_H