]> git.lyx.org Git - lyx.git/blob - src/frontends/WorkArea.h
6248af5d01fff08a2e720923791f478186c02442
[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  *
10  * Full author contact details are available in file CREDITS.
11  */
12
13 #ifndef WORKAREA_H
14 #define WORKAREA_H
15
16 #include "frontends/key_state.h"
17
18 #include <boost/shared_ptr.hpp>
19 #include <boost/signals/signal0.hpp>
20 #include <boost/signals/signal1.hpp>
21 #include <boost/signals/signal2.hpp>
22 #include <boost/signals/signal3.hpp>
23
24 #include "support/std_string.h"
25 #include <utility>
26
27 class Painter;
28 class FuncRequest;
29 class LyXKeySym;
30
31 /**
32  * The work area class represents the widget that provides the
33  * view onto a document. It is owned by the BufferView, and
34  * is responsible for handing events back to its owning BufferView.
35  * It works in concert with the LyXScreen class to update the
36  * widget view of a document.
37  */
38 class WorkArea {
39 public:
40         typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
41
42         WorkArea() {}
43
44         virtual ~WorkArea() {}
45
46         /// return the painter object for this work area
47         virtual Painter & getPainter() = 0;
48
49         /// return the width of the work area in pixels
50         virtual int workWidth() const = 0;
51         /// return the height of the work area in pixels
52         virtual int workHeight() 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         // FIXME: this is an odd place to have it, but xforms needs it here ...
63         /// a selection exists
64         virtual void haveSelection(bool) const = 0;
65         /// get the X clipboard contents
66         virtual string const getClipboard() const = 0;
67         /// fill the clipboard
68         virtual void putClipboard(string const &) const = 0;
69
70         /// work area dimensions have changed
71         boost::signal0<void> workAreaResize;
72         /// the scrollbar has changed
73         boost::signal1<void, int> scrollDocView;
74         /// a key combination has been pressed
75         boost::signal2<void, LyXKeySymPtr, key_modifier::state> workAreaKeyPress;
76         /// some mouse event
77         boost::signal1<void, FuncRequest> dispatch;
78         /// emitted when an X client has requested our selection
79         boost::signal0<void> selectionRequested;
80         /// emitted when another X client has stolen our selection
81         boost::signal0<void> selectionLost;
82 };
83
84 #endif // WORKAREA_H