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

core/StelModule.hpp

00001 /*
00002  * Stellarium
00003  * Copyright (C) 2006 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 _STELMODULE_HPP_
00021 #define _STELMODULE_HPP_
00022 
00023 #include <QString>
00024 #include <QObject>
00025 
00026 // Predeclaration
00027 class StelCore;
00028 class QSettings;
00029 
00039 class StelModule : public QObject
00040 {
00041     // Do not add Q_OBJECT here!!
00042     // This make this class compiled by the Qt moc compiler and for some unknown reasons makes it impossible to dynamically
00043     // load plugins on windows.
00044 public:
00045     StelModule() {;}
00046 
00047     virtual ~StelModule() {;}
00048 
00051     virtual void init() = 0;
00052 
00055     virtual void deinit() {;}
00056 
00059     virtual void draw(StelCore* core) {Q_UNUSED(core);}
00060 
00065     virtual bool drawPartial(StelCore* core);
00066 
00069     virtual void update(double deltaTime) = 0;
00070 
00074     virtual void updateI18n() {;}
00075 
00078     virtual void updateSkyCulture(const QString& skyCultureDir) {Q_UNUSED(skyCultureDir);}
00079 
00081     virtual QString getModuleVersion() const;
00082 
00084     virtual QString getAuthorName() const {return "Stellarium's Team";}
00085 
00087     virtual QString getAuthorEmail() const {return "http://www.stellarium.org";}
00088 
00091     virtual void handleMouseClicks(class QMouseEvent*) {;}
00092 
00095     virtual void handleMouseWheel(class QWheelEvent*) {;}
00096 
00099     virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b) {Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(b); return false;}
00100 
00104     virtual void handleKeys(class QKeyEvent* e) {Q_UNUSED(e);}
00105 
00107     enum StelModuleSelectAction
00108     {
00109         AddToSelection,     
00110         ReplaceSelection,   
00111         RemoveFromSelection 
00112     };
00113 
00117     virtual void selectedObjectChangeCallBack(StelModuleSelectAction action=ReplaceSelection) {Q_UNUSED(action);}
00118 
00121     virtual void setStelStyle(const QString& section) {Q_UNUSED(section);}
00122 
00124     enum StelModuleActionName
00125     {
00126         ActionDraw,              
00127         ActionUpdate,            
00128         ActionHandleMouseClicks, 
00129         ActionHandleMouseMoves,  
00130         ActionHandleKeys         
00131     };
00132 
00138     virtual double getCallOrder(StelModuleActionName actionName) const {Q_UNUSED(actionName); return 0;}
00139 
00144     virtual bool configureGui(bool show=true) {Q_UNUSED(show); return false;}
00145 
00146 };
00147 
00148 #endif // _STELMODULE_HPP_