Stellarium 0.11.2
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., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, 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 
00049 class StelModule : public QObject
00050 {
00051     // Do not add Q_OBJECT here!!
00052     // This make this class compiled by the Qt moc compiler and for some unknown reasons makes it impossible to dynamically
00053     // load plugins on windows.
00054 public:
00055     StelModule() {;}
00056 
00057     virtual ~StelModule() {;}
00058 
00061     virtual void init() = 0;
00062 
00065     virtual void deinit() {;}
00066 
00069     virtual void draw(StelCore* core) {Q_UNUSED(core);}
00070 
00075     virtual bool drawPartial(StelCore* core);
00076 
00079     virtual void update(double deltaTime) = 0;
00080 
00082     virtual QString getModuleVersion() const;
00083 
00085     virtual QString getAuthorName() const {return "Stellarium's Team";}
00086 
00088     virtual QString getAuthorEmail() const {return "http://www.stellarium.org";}
00089 
00092     virtual void handleMouseClicks(class QMouseEvent*) {;}
00093 
00096     virtual void handleMouseWheel(class QWheelEvent*) {;}
00097 
00100     virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b) {Q_UNUSED(x); Q_UNUSED(y); Q_UNUSED(b); return false;}
00101 
00105     virtual void handleKeys(class QKeyEvent* e) {Q_UNUSED(e);}
00106 
00108     enum StelModuleSelectAction
00109     {
00110         AddToSelection,     
00111         ReplaceSelection,   
00112         RemoveFromSelection 
00113     };
00114 
00116     enum StelModuleActionName
00117     {
00118         ActionDraw,              
00119         ActionUpdate,            
00120         ActionHandleMouseClicks, 
00121         ActionHandleMouseMoves,  
00122         ActionHandleKeys         
00123     };
00124 
00130     virtual double getCallOrder(StelModuleActionName actionName) const {Q_UNUSED(actionName); return 0;}
00131 
00136     virtual bool configureGui(bool show=true) {Q_UNUSED(show); return false;}
00137 };
00138 
00139 #endif // _STELMODULE_HPP_