]> git.lyx.org Git - lyx.git/blob - src/frontends/gtk/GuiWorkArea.h
Extracted from r14281
[lyx.git] / src / frontends / gtk / GuiWorkArea.h
1 // -*- C++ -*-
2 /**
3  * \file gtk/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 "GScreen.h"
18 #include "GWorkArea.h"
19
20 namespace lyx {
21 namespace frontend {
22
23 /**
24  * Temporary wrapper around GWorkArea and GScreen.
25  * Please refer to the Qt4 implementation for a proper cleanup of the API.
26  */
27 class GuiWorkArea: public lyx::frontend::WorkArea {
28 public:
29         GuiWorkArea(GScreen * screen, GWorkArea * work_area)
30                 : old_screen_(screen), old_work_area_(work_area)
31         {
32         }
33
34         ~GuiWorkArea() {}
35
36         /// return the painter object for this work area
37         virtual lyx::frontend::Painter & getPainter()
38         {
39                 return old_work_area_->getPainter();
40         }
41
42         /// return the width of the work area in pixels
43         virtual int width() const
44         {
45                 return old_work_area_->workWidth();
46         }
47
48         /// return the height of the work area in pixels
49         virtual int height() const
50         {
51                 return old_work_area_->workHeight();
52         }
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)
61         {
62                 old_work_area_->setScrollbarParams(height, pos, line_height);
63         }
64
65
66         /// paint the cursor and store the background
67         virtual void showCursor(int x, int y, int h, CursorShape shape)
68         {
69                 old_screen_->showCursor(x, y, h, shape);
70         }
71
72         /// hide the cursor
73         virtual void removeCursor()
74         {
75                 old_screen_->removeCursor();
76         }
77
78 protected:
79         /// cause the display of the given area of the work area
80         virtual void expose(int x, int y, int w, int h)
81         {
82                 old_screen_->expose(x, y, w, h);
83         }
84
85 private:
86         GScreen * old_screen_;
87         GWorkArea * old_work_area_;
88 };
89
90 } // namespace frontend
91 } // namespace lyx
92
93 #endif // WORKAREA_H