]> git.lyx.org Git - lyx.git/blob - src/frontends/qt3/GuiWorkArea.h
Extracted from r14281
[lyx.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(FScreen * screen, FWorkArea * work_area)
33                 : old_screen_(screen), old_work_area_(work_area)
34         {
35         }
36
37         ~GuiWorkArea() {}
38
39         /// return the painter object for this work area
40         virtual lyx::frontend::Painter & getPainter()
41         {
42                 return old_work_area_->getPainter();
43         }
44
45         /// return the width of the work area in pixels
46         virtual int width() const
47         {
48                 return old_work_area_->workWidth();
49         }
50
51         /// return the height of the work area in pixels
52         virtual int height() const
53         {
54                 return old_work_area_->workHeight();
55         }
56
57         /**
58          * Update the scrollbar.
59          * @param height the total document height in pixels
60          * @param pos the current position in the document, in pixels
61          * @param line_height the line-scroll amount, in pixels
62          */
63         virtual void setScrollbarParams(int height, int pos, int line_height)
64         {
65                 old_work_area_->setScrollbarParams(height, pos, line_height);
66         }
67
68
69         /// paint the cursor and store the background
70         virtual void showCursor(int x, int y, int h, CursorShape shape)
71         {
72                 old_screen_->showCursor(x, y, h, shape);
73         }
74
75         /// hide the cursor
76         virtual void removeCursor()
77         {
78                 old_screen_->removeCursor();
79         }
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)
84         {
85                 old_screen_->expose(x, y, w, h);
86         }
87
88 private:
89         FScreen * old_screen_;
90         FWorkArea * old_work_area_;
91 };
92
93 } // namespace frontend
94 } // namespace lyx
95
96 #endif // WORKAREA_H