QGIS API Documentation  2.99.0-Master (f867b65)
qgisplugin.h
Go to the documentation of this file.
1 /***************************************************************************
2  qgisplugin.h
3  --------------------------------------
4  Date : Sun Sep 16 12:12:31 AKDT 2007
5  Copyright : (C) 2007 by Gary E. Sherman
6  Email : sherman at mrcc dot com
7  ***************************************************************************
8  * *
9  * This program is free software; you can redistribute it and/or modify *
10  * it under the terms of the GNU General Public License as published by *
11  * the Free Software Foundation; either version 2 of the License, or *
12  * (at your option) any later version. *
13  * *
14  ***************************************************************************/
15 
34 #ifndef QGISPLUGIN_H
35 #define QGISPLUGIN_H
36 
37 #define SIP_NO_FILE
38 
39 
40 #include <QString>
41 
42 class QgisInterface;
43 
44 //#include "qgisplugingui.h"
45 
52 {
53  public:
54 
56  //virtual QgisPluginGui *gui()=0;
58 #if 0
59  enum Elements
60  {
61  MENU,
62  MENU_ITEM,
63  TOOLBAR,
64  TOOLBAR_BUTTON,
65  };
66 
67  @todo XXX this may be a hint that there should be subclasses
68 #endif
69 
71  {
72  UI = 1,
75  };
76 
77 
81  QgisPlugin( QString const &name = "",
82  QString const &description = "",
83  QString const &category = "",
84  QString const &version = "",
86  : mName( name )
87  , mDescription( description )
88  , mCategory( category )
89  , mVersion( version )
90  , mType( type )
91  {}
92 
93  virtual ~QgisPlugin()
94  {}
95 
97  QString const &name() const
98  {
99  return mName;
100  }
101 
102  QString &name()
103  {
104  return mName;
105  }
106 
108  QString const &version() const
109  {
110  return mVersion;
111  }
112 
114  QString &version()
115  {
116  return mVersion;
117  }
118 
120  QString const &description() const
121  {
122  return mDescription;
123  }
124 
126  QString &description()
127  {
128  return mDescription;
129  }
130 
132  QString const &category() const
133  {
134  return mCategory;
135  }
136 
138  QString &category()
139  {
140  return mCategory;
141  }
142 
145  {
146  return mType;
147  }
148 
149 
152  {
153  return mType;
154  }
155 
157  virtual void initGui() = 0;
158 
160  virtual void unload() = 0;
161 
162  private:
163 
165  QString mName;
166 
168  QString mDescription;
169 
171  QString mCategory;
172 
174  QString mVersion;
175 
177 
182  PluginType mType;
183 
184 }; // class QgisPlugin
185 
186 
187 // Typedefs used by qgis main app
188 
191 
193 typedef void unload_t( QgisPlugin * );
194 
196 typedef QString name_t();
197 
199 typedef QString description_t();
200 
202 typedef QString category_t();
203 
205 typedef int type_t();
206 
208 typedef QString version_t();
209 
211 typedef QString icon_t();
212 
214 typedef QString experimental_t();
215 
216 #endif // QGISPLUGIN_H
A plugin for a new renderer class.
Definition: qgisplugin.h:74
QString const & description() const
A brief description of the plugin.
Definition: qgisplugin.h:120
User interface plug-in.
Definition: qgisplugin.h:72
QString const & category() const
Plugin category.
Definition: qgisplugin.h:132
QString icon_t()
Typedef for getting the plugin icon file name without instantiating the plugin.
Definition: qgisplugin.h:211
QgisPlugin * create_t(QgisInterface *)
Typedef for the function that returns a generic pointer to a plugin object.
Definition: qgisplugin.h:190
virtual ~QgisPlugin()
Definition: qgisplugin.h:93
QgisPlugin::PluginType const & type() const
Plugin type, either UI or map layer.
Definition: qgisplugin.h:144
QgisPlugin::PluginType & type()
Plugin type, either UI or map layer.
Definition: qgisplugin.h:151
void unload_t(QgisPlugin *)
Typedef for the function to unload a plugin and free its resources.
Definition: qgisplugin.h:193
Map layer plug-in.
Definition: qgisplugin.h:73
QString name_t()
Typedef for getting the name of the plugin without instantiating it.
Definition: qgisplugin.h:196
PluginType
Interface to gui element collection object.
Definition: qgisplugin.h:70
QgisPlugin(QString const &name="", QString const &description="", QString const &category="", QString const &version="", PluginType type=MapLayer)
Constructor for QgisPlugin.
Definition: qgisplugin.h:81
virtual void unload()=0
Unload the plugin and cleanup the GUI.
QString description_t()
Typedef for getting the description without instantiating the plugin.
Definition: qgisplugin.h:199
int type_t()
Typedef for getting the plugin type without instantiating the plugin.
Definition: qgisplugin.h:205
QString & category()
Plugin category.
Definition: qgisplugin.h:138
QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugin...
Definition: qgisinterface.h:73
QString const & version() const
Version of the plugin.
Definition: qgisplugin.h:108
QString version_t()
Typedef for getting the plugin version without instantiating the plugin.
Definition: qgisplugin.h:208
virtual void initGui()=0
function to initialize connection to GUI
QString category_t()
Typedef for getting the category without instantiating the plugin.
Definition: qgisplugin.h:202
QString const & name() const
Get the name of the plugin.
Definition: qgisplugin.h:97
QString & version()
Version of the plugin.
Definition: qgisplugin.h:114
Abstract base class from which all plugins must inherit.
Definition: qgisplugin.h:51
QString & name()
Definition: qgisplugin.h:102
QString & description()
A brief description of the plugin.
Definition: qgisplugin.h:126
QString experimental_t()
Typedef for getting the experimental status without instantiating the plugin.
Definition: qgisplugin.h:214