00001 00020 #ifndef QGISPLUGIN_H 00021 #define QGISPLUGIN_H 00022 00023 00024 #include <QString> 00025 00026 class QgisInterface; 00027 00028 //#include "qgisplugingui.h" 00029 00034 class QgisPlugin 00035 { 00036 public: 00037 00039 //virtual QgisPluginGui *gui()=0; 00041 /* enum ELEMENTS { 00042 MENU, 00043 MENU_ITEM, 00044 TOOLBAR, 00045 TOOLBAR_BUTTON, 00046 }; 00047 00048 @todo XXX this may be a hint that there should be subclasses 00049 */ 00050 typedef enum PLUGINTYPE 00051 { 00052 UI = 1, /* user interface plug-in */ 00053 MAPLAYER, /* map layer plug-in */ 00054 RENDERER /*a plugin for a new renderer class*/ 00055 }; 00056 00057 00058 QgisPlugin ( QString const & name = "", 00059 QString const & description = "", 00060 QString const & version = "", 00061 PLUGINTYPE const & type = MAPLAYER ) 00062 : mName(name), 00063 mDescription(description), 00064 mVersion(version), 00065 mType(type) 00066 {} 00067 00068 virtual ~QgisPlugin() 00069 {} 00070 00072 QString const & name() const 00073 { 00074 return mName; 00075 } 00076 00077 QString & name() 00078 { 00079 return mName; 00080 } 00081 00083 QString const & version() const 00084 { 00085 return mVersion; 00086 } 00087 00089 QString & version() 00090 { 00091 return mVersion; 00092 } 00093 00095 QString const & description() const 00096 { 00097 return mDescription; 00098 } 00099 00101 QString & description() 00102 { 00103 return mDescription; 00104 } 00105 00107 QgisPlugin::PLUGINTYPE const & type() const 00108 { 00109 return mType; 00110 } 00111 00112 00114 QgisPlugin::PLUGINTYPE & type() 00115 { 00116 return mType; 00117 } 00118 00120 virtual void initGui() = 0; 00121 00123 virtual void unload() = 0; 00124 00125 private: 00126 00128 QString mName; 00129 00131 QString mDescription; 00132 00134 QString mVersion; 00135 00137 00141 PLUGINTYPE mType; 00142 00143 }; // class QgisPlugin 00144 00145 00146 // Typedefs used by qgis main app 00147 00149 typedef QgisPlugin *create_t(QgisInterface *); 00150 00152 typedef void unload_t(QgisPlugin *); 00153 00155 typedef QString name_t(); 00156 00158 typedef QString description_t(); 00159 00161 typedef int type_t(); 00162 00164 typedef QString version_t(); 00165 00166 00167 #endif //qgisplugin_h