]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QWorkArea.h
6e9c8e728cfbf4e3034cd7caeafc45d8d4af4f1c
[lyx.git] / src / frontends / qt2 / 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 "WorkArea.h"
17 #include "QLPainter.h"
18 #include "QContentPane.h"
19
20 #include <qscrollbar.h>
21
22 class QPixmap;
23 class QWidget;
24
25
26 /**
27  * Qt-specific implementation of the work area
28  * (buffer view GUI)
29  *
30  * It consists of a content pane widget, and a scrollbar.
31  * Hopefully soon we can just use QScrollView ...
32  */
33 class QWorkArea : public WorkArea, public QWidget {
34 public:
35         friend class QContentPane;
36
37         QWorkArea(int x, int y, int w, int h);
38
39         virtual ~QWorkArea();
40         /// return this widget's painter
41         virtual Painter & getPainter() { return painter_; }
42         /// return the width of the content pane
43         virtual int workWidth() const { return content_->width(); }
44         /// return the height of the content pane
45         virtual int workHeight() const { return content_->height(); }
46         ///
47         virtual void setScrollbarParams(int height, int pos, int line_height);
48
49         /// a selection exists
50         virtual void haveSelection(bool) const;
51         ///
52         virtual string const getClipboard() const;
53         ///
54         virtual void putClipboard(string const &) const;
55         ///
56         virtual void dragEnterEvent(QDragEnterEvent * event);
57         ///
58         virtual void dropEvent(QDropEvent* event);
59
60         /// get the pixmap we paint on to
61         QPixmap * getPixmap() const { return content_->pixmap(); }
62
63         /// get the content pane widget
64         QWidget * getContent() const { return content_; }
65 private:
66         /// scroll bar
67         QScrollBar * scrollbar_;
68         /// content
69         QContentPane * content_;
70
71         /// our painter
72         QLPainter painter_;
73 };
74
75 #endif // QWORKAREA_H