]> git.lyx.org Git - features.git/blob - src/frontends/qt3/QWorkArea.h
This is the merging of the GUI API cleanup branch that was developed in svn+ssh:...
[features.git] / src / frontends / qt3 / QWorkArea.h
1 // -*- C++ -*-
2 /**
3  * \file QWorkArea.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 QWORKAREA_H
14 #define QWORKAREA_H
15
16 #include "QLPainter.h"
17 #include "QContentPane.h"
18
19 #include <qscrollbar.h>
20
21 class LyXView;
22 class QPixmap;
23 class QWidget;
24
25 namespace lyx {
26 namespace frontend {
27
28
29 /**
30  * Qt-specific implementation of the work area
31  * (buffer view GUI)
32  *
33  * It consists of a content pane widget, and a scrollbar.
34  * Hopefully soon we can just use QScrollView ...
35  */
36 class QWorkArea : public QWidget {
37 public:
38         friend class QContentPane;
39
40         QWorkArea(LyXView & owner, int w, int h);
41
42         virtual ~QWorkArea();
43         /// return this widget's painter
44         virtual lyx::frontend::Painter & getPainter() { return painter_; }
45         /// return the width of the content pane
46         virtual int workWidth() const { return content_->width(); }
47         /// return the height of the content pane
48         virtual int workHeight() const { return content_->height(); }
49         ///
50         virtual void setScrollbarParams(int height, int pos, int line_height);
51
52         /// a selection exists
53         virtual void haveSelection(bool);
54         ///
55         virtual std::string const getClipboard() const;
56         ///
57         virtual void putClipboard(std::string const &);
58         ///
59         virtual void dragEnterEvent(QDragEnterEvent * event);
60         ///
61         virtual void dropEvent(QDropEvent* event);
62
63         /// get the pixmap we paint on to
64         QPixmap * getPixmap() const { return content_->pixmap(); }
65
66         /// get the content pane widget
67         QWidget * getContent() const { return content_; }
68         ///
69         LyXView & view()
70         {
71                 return owner_;
72         }
73 private:
74         /// The owning LyXView
75         LyXView & owner_;
76         
77         /// scroll bar
78         QScrollBar * scrollbar_;
79         /// content
80         QContentPane * content_;
81
82         /// our painter
83         QLPainter painter_;
84 };
85
86
87 } // namespace frontend
88 } // namespace lyx
89
90 #endif // QWORKAREA_H