4 * Copyright 1995-2002 the LyX Team
5 * Read the file COPYING
7 * \author John Levon <moz@compsoc.man.ac.uk>
10 #ifndef QCONTENTPANE_H
11 #define QCONTENTPANE_H
19 #include <boost/smart_ptr.hpp>
22 #include <qscrollbar.h>
28 /// for emulating triple click
32 Qt::ButtonState state;
35 bool operator==(QMouseEvent const & e) {
36 return x == e.x() && y == e.y()
37 && state == e.button();
41 : x(0), y(0), state(Qt::NoButton), active(false) {}
43 double_click(QMouseEvent * e)
44 : x(e->x()), y(e->y()),
45 state(e->button()), active(true) {}
49 * Widget for actually drawing the document on
51 class QContentPane : public QWidget {
55 QContentPane(QWorkArea * parent);
57 /// return the backing pixmap
58 QPixmap * pixmap() const { return pixmap_.get(); }
61 /// repaint part of the widget
62 void paintEvent(QPaintEvent * e);
63 /// widget has been resized
64 void resizeEvent(QResizeEvent * e);
66 /// mouse button press
67 void mousePressEvent(QMouseEvent * e);
68 /// mouse button release
69 void mouseReleaseEvent(QMouseEvent * e);
70 /// mouse double click of button
71 void mouseDoubleClickEvent(QMouseEvent * e);
73 void mouseMoveEvent(QMouseEvent * e);
76 void keyPressEvent(QKeyEvent * e);
79 void doubleClickTimeout();
81 void scrollBarChanged(int);
87 /// the double buffered pixmap
88 boost::scoped_ptr<QPixmap> pixmap_;
90 double_click dc_event_;
93 #endif // QCONTENTPANE_H