Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure

core/StelAppGraphicsWidget.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2009 Fabien Chereau
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
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 

Generated on Mon Mar 22 09:55:37 2010 for Stellarium by  doxygen 1.5.5