QGIS API Documentation  2.99.0-Master (37c43df)
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 
35 #ifndef QGISPLUGIN_H
36 #define QGISPLUGIN_H
37 
38 
39 #include <QString>
40 
41 class QgisInterface;
42 
43 //#include "qgisplugingui.h"
44 
51 {
52  public:
53 
55  //virtual QgisPluginGui *gui()=0;
57 #if 0
58  enum ELEMENTS
59  {
60  MENU,
61  MENU_ITEM,
62  TOOLBAR,
63  TOOLBAR_BUTTON,
64  };
65 
66  @todo XXX this may be a hint that there should be subclasses
67 #endif
68 
70  {
71  UI = 1, /* user interface plug-in */
72  MAPLAYER, /* map layer plug-in */
73  RENDERER, /*a plugin for a new renderer class*/
74  };
75 
76 
80  QgisPlugin( QString const & name = "",
81  QString const & description = "",
82  QString const & category = "",
83  QString const & version = "",
85  : mName( name )
86  , mDescription( description )
87  , mCategory( category )
88  , mVersion( version )
89  , mType( type )
90  {}
91 
92  virtual ~QgisPlugin()
93  {}
94 
96  QString const & name() const
97  {
98  return mName;
99  }
100 
101  QString & name()
102  {
103  return mName;
104  }
105 
107  QString const & version() const
108  {
109  return mVersion;
110  }
111 
113  QString & version()
114  {
115  return mVersion;
116  }
117 
119  QString const & description() const
120  {
121  return mDescription;
122  }
123 
125  QString & description()
126  {
127  return mDescription;
128  }
129 
131  QString const & category() const
132  {
133  return mCategory;
134  }
135 
137  QString & category()
138  {
139  return mCategory;
140  }
141 
143  QgisPlugin::PLUGINTYPE const & type() const
144  {
145  return mType;
146  }
147 
148 
151  {
152  return mType;
153  }
154 
156  virtual void initGui() = 0;
157 
159  virtual void unload() = 0;
160 
161  private:
162 
164  QString mName;
165 
167  QString mDescription;
168 
170  QString mCategory;
171 
173  QString mVersion;
174 
176 
181  PLUGINTYPE mType;
182 
183 }; // class QgisPlugin
184 
185 
186 // Typedefs used by qgis main app
187 
190 
192 typedef void unload_t( QgisPlugin * );
193 
195 typedef QString name_t();
196 
198 typedef QString description_t();
199 
201 typedef QString category_t();
202 
204 typedef int type_t();
205 
207 typedef QString version_t();
208 
210 typedef QString icon_t();
211 
213 typedef QString experimental_t();
214 
215 #endif // QGISPLUGIN_H
QString const & description() const
A brief description of the plugin.
Definition: qgisplugin.h:119
PLUGINTYPE
Interface to gui element collection object.
Definition: qgisplugin.h:69
QgisPlugin::PLUGINTYPE & type()
Plugin type, either UI or map layer.
Definition: qgisplugin.h:150
QString const & category() const
Plugin category.
Definition: qgisplugin.h:131
QString icon_t()
Typedef for getting the plugin icon file name without instantiating the plugin.
Definition: qgisplugin.h:210
QgisPlugin * create_t(QgisInterface *)
Typedef for the function that returns a generic pointer to a plugin object.
Definition: qgisplugin.h:189
virtual ~QgisPlugin()
Definition: qgisplugin.h:92
QgisPlugin::PLUGINTYPE const & type() const
Plugin type, either UI or map layer.
Definition: qgisplugin.h:143
void unload_t(QgisPlugin *)
Typedef for the function to unload a plugin and free its resources.
Definition: qgisplugin.h:192
QString name_t()
Typedef for getting the name of the plugin without instantiating it.
Definition: qgisplugin.h:195
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:198
int type_t()
Typedef for getting the plugin type without instantiating the plugin.
Definition: qgisplugin.h:204
QString & category()
Plugin category.
Definition: qgisplugin.h:137
QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugin...
Definition: qgisinterface.h:66
QString const & version() const
Version of the plugin.
Definition: qgisplugin.h:107
QString version_t()
Typedef for getting the plugin version without instantiating the plugin.
Definition: qgisplugin.h:207
virtual void initGui()=0
function to initialize connection to GUI
QgisPlugin(QString const &name="", QString const &description="", QString const &category="", QString const &version="", PLUGINTYPE type=MAPLAYER)
Constructor for QgisPlugin.
Definition: qgisplugin.h:80
QString category_t()
Typedef for getting the category without instantiating the plugin.
Definition: qgisplugin.h:201
QString const & name() const
Get the name of the plugin.
Definition: qgisplugin.h:96
QString & version()
Version of the plugin.
Definition: qgisplugin.h:113
Abstract base class from which all plugins must inherit.
Definition: qgisplugin.h:50
QString & name()
Definition: qgisplugin.h:101
QString & description()
A brief description of the plugin.
Definition: qgisplugin.h:125
QString experimental_t()
Typedef for getting the experimental status without instantiating the plugin.
Definition: qgisplugin.h:213