Quantum GIS API Documentation  1.7.4
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 & version = "",
00076                 PLUGINTYPE const & type = MAPLAYER )
00077         : mName( name ),
00078         mDescription( description ),
00079         mVersion( version ),
00080         mType( type )
00081     {}
00082 
00083     virtual ~QgisPlugin()
00084     {}
00085 
00087     QString const & name() const
00088     {
00089       return mName;
00090     }
00091 
00092     QString       & name()
00093     {
00094       return mName;
00095     }
00096 
00098     QString const & version() const
00099     {
00100       return mVersion;
00101     }
00102 
00104     QString & version()
00105     {
00106       return mVersion;
00107     }
00108 
00110     QString const & description() const
00111     {
00112       return mDescription;
00113     }
00114 
00116     QString       & description()
00117     {
00118       return mDescription;
00119     }
00120 
00122     QgisPlugin::PLUGINTYPE const & type() const
00123     {
00124       return mType;
00125     }
00126 
00127 
00129     QgisPlugin::PLUGINTYPE       & type()
00130     {
00131       return mType;
00132     }
00133 
00135     virtual void initGui() = 0;
00136 
00138     virtual void unload() = 0;
00139 
00140   private:
00141 
00143     QString mName;
00144 
00146     QString mDescription;
00147 
00149     QString mVersion;
00150 
00152 
00156     PLUGINTYPE mType;
00157 
00158 }; // class QgisPlugin
00159 
00160 
00161 // Typedefs used by qgis main app
00162 
00164 typedef QgisPlugin *create_t( QgisInterface * );
00165 
00167 typedef void unload_t( QgisPlugin * );
00168 
00170 typedef QString name_t();
00171 
00173 typedef QString description_t();
00174 
00176 typedef int type_t();
00177 
00179 typedef QString version_t();
00180 
00182 typedef QString icon_t();
00183 
00184 
00185 #endif //qgisplugin_h
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines