]> git.lyx.org Git - lyx.git/blob - src/frontends/qt2/QWorkArea.h
The initial merge of the Qt frontend, and the necessary compile fixes.
[lyx.git] / src / frontends / qt2 / QWorkArea.h
1 // -*- C++ -*-
2 /**
3  * \file QWorkArea.h
4  * Copyright 1995-2002 the LyX Team
5  * Read the file COPYING
6  *
7  * \author unknown
8  * \author John Levon <moz@compsoc.man.ac.uk>
9  */
10
11 #ifndef QWORKAREA_H
12 #define QWORKAREA_H
13
14 #ifdef __GNUG__
15 #pragma interface
16 #endif
17
18 #include <utility>
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  
38         friend class QContentPane;
39  
40 public:
41
42         QWorkArea(int x, int y, int w, int h);
43
44         // FIXME:
45         virtual int xpos() const { return 0; }
46         virtual int ypos() const { return 0; }
47         virtual bool visible() const { return true; }
48         virtual void greyOut() const { }
49
50         virtual ~QWorkArea();
51         /// return this widget's painter
52         virtual Painter & getPainter() { return painter_; }
53         /// return the width of the content pane
54         virtual int workWidth() const { return content_->width(); }
55         /// return the height of the content pane
56         virtual int workHeight() const { return content_->height(); }
57         /// resize this widget
58         virtual void resize(int xpos, int ypos, int width, int height);
59         /// FIXME: makes no sense ?
60         virtual void redraw() const { }
61         /// set focus to this widget
62         virtual void setFocus() const { /* FIXME */ }
63         /// does this widget have the focus ?
64         virtual bool hasFocus() const { /* FIXME */ return true; }
65         /// 
66         virtual void setScrollbarParams(int height, int pos, int line_height);
67  
68         /// a selection exists
69         virtual void haveSelection(bool) const;
70         ///
71         virtual string const getClipboard() const;
72         ///
73         virtual void putClipboard(string const &) const;
74
75         /// get the pixmap we paint on to
76         QPixmap * getPixmap() const { return content_->pixmap(); }
77
78         /// get the content pane widget
79         QWidget * getContent() const { return content_; }
80
81 private:
82         /// scroll bar
83         QScrollBar * scrollbar_;
84         /// content
85         QContentPane * content_;
86  
87         /// our painter
88         QLPainter painter_;
89 };
90  
91 #endif // QWORKAREA_H