00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef _STELAPPGRAPHICSWIDGET_HPP_
00021 #define _STELAPPGRAPHICSWIDGET_HPP_
00022
00023 #include <QGraphicsWidget>
00024
00025 class StelViewportEffect;
00026
00031 class StelAppGraphicsWidget : public QGraphicsWidget
00032 {
00033 Q_OBJECT
00034 public:
00035 StelAppGraphicsWidget();
00036 ~StelAppGraphicsWidget();
00037
00039 void init(class QSettings* conf);
00040
00043 virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget=0);
00044
00047 void setViewportEffect(const QString& effectName);
00049 QString getViewportEffect() const;
00050
00051 protected:
00052 virtual void keyPressEvent(QKeyEvent* event);
00053 virtual void keyReleaseEvent(QKeyEvent* event);
00054 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00055 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00056 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00057 virtual void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);
00058 virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
00059
00060 private:
00061 double previousPaintTime;
00065 double previousPaintFrameTime;
00067 class StelApp* stelApp;
00069 int paintState;
00070
00072 bool useBuffers;
00074 class QGLFramebufferObject* backgroundBuffer;
00076 class QGLFramebufferObject* foregroundBuffer;
00077
00079 void initBuffers();
00082 void swapBuffers();
00084 bool paintPartial();
00085
00086 StelViewportEffect* viewportEffect;
00087 void distortPos(QPointF* pos);
00088 };
00089
00090 #endif // _STELAPPGRAPHICSWIDGET_HPP_
00091