]> git.lyx.org Git - lyx.git/blob - src/frontends/WorkArea.h
Minipage is no more (long live the box inset)
[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
23
24 class Painter;
25 class FuncRequest;
26 class LyXKeySym;
27
28 /**
29  * The work area class represents the widget that provides the
30  * view onto a document. It is owned by the BufferView, and
31  * is responsible for handing events back to its owning BufferView.
32  * It works in concert with the LyXScreen class to update the
33  * widget view of a document.
34  */
35 class WorkArea {
36 public:
37         typedef boost::shared_ptr<LyXKeySym> LyXKeySymPtr;
38
39         WorkArea() {}
40
41         virtual ~WorkArea() {}
42
43         /// return the painter object for this work area
44         virtual Painter & getPainter() = 0;
45
46         /// return the width of the work area in pixels
47         virtual int workWidth() const = 0;
48         /// return the height of the work area in pixels
49         virtual int workHeight() const = 0;
50
51         /**
52          * Update the scrollbar.
53          * @param height the total document height in pixels
54          * @param pos the current position in the document, in pixels
55          * @param line_height the line-scroll amount, in pixels
56          */
57         virtual void setScrollbarParams(int height, int pos, int line_height) = 0;
58
59         // FIXME: this is an odd place to have it, but xforms needs it here ...
60         /// a selection exists
61         virtual void haveSelection(bool) const = 0;
62         /// get the X clipboard contents
63         virtual std::string const getClipboard() const = 0;
64         /// fill the clipboard
65         virtual void putClipboard(std::string const &) const = 0;
66
67         /// work area dimensions have changed
68         boost::signal0<void> workAreaResize;
69         /// the scrollbar has changed
70         boost::signal1<void, int> scrollDocView;
71         /// a key combination has been pressed
72         boost::signal2<void, LyXKeySymPtr, key_modifier::state> workAreaKeyPress;
73         /// some mouse event
74         boost::signal1<void, FuncRequest> dispatch;
75         /// emitted when an X client has requested our selection
76         boost::signal0<void> selectionRequested;
77         /// emitted when another X client has stolen our selection
78         boost::signal0<void> selectionLost;
79 };
80
81 #endif // WORKAREA_H