]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QWorkArea.h
better selection and scrolling behaviour
[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 #ifdef __GNUG__
17 #pragma interface
18 #endif
19
20 #include "WorkArea.h"
21 #include "QLPainter.h"
22 #include "QContentPane.h"
23
24 #include <qwidget.h>
25 #include <qscrollbar.h>
26 #include <qpixmap.h>
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 WorkArea, public QWidget {
37 public:
38         friend class QContentPane;
39
40         QWorkArea(int x, int y, int w, int h);
41
42         virtual ~QWorkArea();
43         /// return this widget's painter
44         virtual 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) const;
54         ///
55         virtual string const getClipboard() const;
56         ///
57         virtual void putClipboard(string const &) const;
58
59         /// get the pixmap we paint on to
60         QPixmap * getPixmap() const { return content_->pixmap(); }
61
62         /// get the content pane widget
63         QWidget * getContent() const { return content_; }
64 private:
65         /// scroll bar
66         QScrollBar * scrollbar_;
67         /// content
68         QContentPane * content_;
69
70         /// our painter
71         QLPainter painter_;
72 };
73
74 #endif // QWORKAREA_H