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