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
00052 void setDoPaint(bool b) {doPaint=b;}
00053
00054 protected:
00055 virtual void keyPressEvent(QKeyEvent* event);
00056 virtual void keyReleaseEvent(QKeyEvent* event);
00057 virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
00058 virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
00059 virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event);
00060 virtual void wheelEvent(QGraphicsSceneWheelEvent * wheelEvent);
00061 virtual void resizeEvent(QGraphicsSceneResizeEvent* event);
00062
00063 private:
00064 double previousPaintTime;
00068 double previousPaintFrameTime;
00070 class StelApp* stelApp;
00072 int paintState;
00073
00075 bool useBuffers;
00077 class QGLFramebufferObject* backgroundBuffer;
00079 class QGLFramebufferObject* foregroundBuffer;
00080
00082 void initBuffers();
00085 void swapBuffers();
00087 bool paintPartial();
00088
00089 StelViewportEffect* viewportEffect;
00090 void distortPos(QPointF* pos);
00091
00092 bool doPaint;
00093 };
00094
00095 #endif // _STELAPPGRAPHICSWIDGET_HPP_
00096