Stellarium 0.11.4
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., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, 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 
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 
Generated on Sat Aug 25 22:13:29 2012 for Stellarium by  doxygen 1.6.3