![]() |
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure |
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 class StelStyle; 00030 00040 class StelModule : public QObject 00041 { 00042 // Do not add Q_OBJECT here!! 00043 // This make this class compiled by the Qt moc compiler and for some unknown reasons makes it impossible to dynamically 00044 // load plugins on windows. 00045 public: 00046 StelModule() {;} 00047 00048 virtual ~StelModule() {;} 00049 00052 virtual void init() = 0; 00053 00056 virtual void deinit() {;} 00057 00060 virtual void draw(StelCore* core) {}; 00061 00066 virtual bool drawPartial(StelCore* core); 00067 00070 virtual void update(double deltaTime) = 0; 00071 00075 virtual void updateI18n() {;} 00076 00079 virtual void updateSkyCulture(const QString& skyCultureDir) {;} 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* e) {;} 00093 00096 virtual void handleMouseWheel(class QWheelEvent* e) {;} 00097 00100 virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b) {return false;} 00101 00105 virtual void handleKeys(class QKeyEvent* e) {;} 00106 00108 enum StelModuleSelectAction 00109 { 00110 AddToSelection, 00111 ReplaceSelection, 00112 RemoveFromSelection 00113 }; 00114 00118 virtual void selectedObjectChangeCallBack(StelModuleSelectAction action=ReplaceSelection) {;} 00119 00122 virtual void setStelStyle(const StelStyle& style) {;} 00123 00125 enum StelModuleActionName 00126 { 00127 ActionDraw, 00128 ActionUpdate, 00129 ActionHandleMouseClicks, 00130 ActionHandleMouseMoves, 00131 ActionHandleKeys 00132 }; 00133 00139 virtual double getCallOrder(StelModuleActionName actionName) const {return 0;} 00140 00145 virtual bool configureGui(bool show=true) {return false;} 00146 00147 }; 00148 00149 #endif // _STELMODULE_HPP_