Quantum GIS API Documentation  1.8
src/plugins/qgisplugin.h
Go to the documentation of this file.
00001 /***************************************************************************
00002      qgisplugin.h
00003      --------------------------------------
00004     Date                 : Sun Sep 16 12:12:31 AKDT 2007
00005     Copyright            : (C) 2007 by Gary E. Sherman
00006     Email                : sherman at mrcc dot com
00007  ***************************************************************************
00008  *                                                                         *
00009  *   This program is free software; you can redistribute it and/or modify  *
00010  *   it under the terms of the GNU General Public License as published by  *
00011  *   the Free Software Foundation; either version 2 of the License, or     *
00012  *   (at your option) any later version.                                   *
00013  *                                                                         *
00014  ***************************************************************************/
00034 #ifndef QGISPLUGIN_H
00035 #define QGISPLUGIN_H
00036 
00037 
00038 #include <QString>
00039 
00040 class QgisInterface;
00041 
00042 //#include "qgisplugingui.h"
00043 
00048 class QgisPlugin
00049 {
00050   public:
00051 
00053     //virtual QgisPluginGui *gui()=0;
00055     /* enum ELEMENTS {
00056        MENU,
00057        MENU_ITEM,
00058        TOOLBAR,
00059        TOOLBAR_BUTTON,
00060        };
00061 
00062        @todo XXX this may be a hint that there should be subclasses
00063        */
00064     enum PLUGINTYPE
00065     {
00066       UI = 1,                     /* user interface plug-in */
00067       MAPLAYER,                    /* map layer plug-in */
00068       RENDERER,                     /*a plugin for a new renderer class*/
00069       VECTOR_OVERLAY                /*an overlay plugin. Added in version 1.1*/
00070     };
00071 
00072 
00073     QgisPlugin( QString const & name = "",
00074                 QString const & description = "",
00075                 QString const & category = "",
00076                 QString const & version = "",
00077                 PLUGINTYPE const & type = MAPLAYER )
00078         : mName( name ),
00079         mDescription( description ),
00080         mCategory( category ),
00081         mVersion( version ),
00082         mType( type )
00083     {}
00084 
00085     virtual ~QgisPlugin()
00086     {}
00087 
00089     QString const & name() const
00090     {
00091       return mName;
00092     }
00093 
00094     QString       & name()
00095     {
00096       return mName;
00097     }
00098 
00100     QString const & version() const
00101     {
00102       return mVersion;
00103     }
00104 
00106     QString & version()
00107     {
00108       return mVersion;
00109     }
00110 
00112     QString const & description() const
00113     {
00114       return mDescription;
00115     }
00116 
00118     QString       & description()
00119     {
00120       return mDescription;
00121     }
00122 
00124     QString const & category() const
00125     {
00126       return mCategory;
00127     }
00128 
00130     QString       & category()
00131     {
00132       return mCategory;
00133     }
00134 
00136     QgisPlugin::PLUGINTYPE const & type() const
00137     {
00138       return mType;
00139     }
00140 
00141 
00143     QgisPlugin::PLUGINTYPE       & type()
00144     {
00145       return mType;
00146     }
00147 
00149     virtual void initGui() = 0;
00150 
00152     virtual void unload() = 0;
00153 
00154   private:
00155 
00157     QString mName;
00158 
00160     QString mDescription;
00161 
00163     QString mCategory;
00164 
00166     QString mVersion;
00167 
00169 
00173     PLUGINTYPE mType;
00174 
00175 }; // class QgisPlugin
00176 
00177 
00178 // Typedefs used by qgis main app
00179 
00181 typedef QgisPlugin *create_t( QgisInterface * );
00182 
00184 typedef void unload_t( QgisPlugin * );
00185 
00187 typedef QString name_t();
00188 
00190 typedef QString description_t();
00191 
00193 typedef QString category_t();
00194 
00196 typedef int type_t();
00197 
00199 typedef QString version_t();
00200 
00202 typedef QString icon_t();
00203 
00204 
00205 #endif //qgisplugin_h
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines