]> git.lyx.org Git - features.git/blob - src/frontends/WorkArea.h
make WorkArea a pure interface, move all implementation to GuiWorkArea
[features.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/KeyModifier.h"
18
19 namespace lyx {
20
21 class BufferView;
22 class KeySymbol;
23
24 namespace frontend {
25
26 class LyXView;
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 {
38 public:
39         ///
40         WorkArea() {}
41
42         virtual ~WorkArea();
43
44         ///
45         virtual void setLyXView(LyXView & lv) = 0;
46
47         ///
48         virtual BufferView & bufferView() = 0;
49         ///
50         virtual BufferView const & bufferView() const = 0;
51
52         /// return true if has the keyboard input focus.
53         virtual bool hasFocus() const = 0;
54
55         /// return true if has this WorkArea is visible.
56         virtual bool isVisible() const = 0;
57
58         /// return the width of the work area in pixels
59         virtual int width() const = 0;
60
61         /// return the height of the work area in pixels
62         virtual int height() const = 0;
63
64         /**
65          * Update the scrollbar.
66          * @param height the total document height in pixels
67          * @param pos the current position in the document, in pixels
68          * @param line_height the line-scroll amount, in pixels
69          */
70         virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
71
72         ///
73         virtual void scheduleRedraw() = 0;
74
75         /// redraw the screen, without using existing pixmap
76         virtual void redraw() = 0;
77         ///
78         virtual void stopBlinkingCursor() = 0;
79         virtual void startBlinkingCursor() = 0;
80
81         /// Process Key pressed event.
82         /// This needs to be public because it is accessed externally by GuiView.
83         virtual void processKeySym(KeySymbol const & key, KeyModifier mod) = 0;
84
85         /// close this work area.
86         /// Slot for Buffer::closing signal.
87         virtual void close() = 0;
88         /// This function is called when the buffer readonly status change.
89         virtual void setReadOnly(bool) = 0;
90
91         /// Update window titles of all users.
92         virtual void updateWindowTitle() = 0;
93 };
94
95 } // namespace frontend
96 } // namespace lyx
97
98 #endif // BASE_WORKAREA_H