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