QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
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 
50 {
51  public:
52 
54  //virtual QgisPluginGui *gui()=0;
56 #if 0
57  enum ELEMENTS
58  {
59  MENU,
60  MENU_ITEM,
61  TOOLBAR,
62  TOOLBAR_BUTTON,
63  };
64 
65  @todo XXX this may be a hint that there should be subclasses
66 #endif
67 
69  {
70  UI = 1, /* user interface plug-in */
71  MAPLAYER, /* map layer plug-in */
72  RENDERER, /*a plugin for a new renderer class*/
73  };
74 
75 
76  QgisPlugin( QString const & name = "",
77  QString const & description = "",
78  QString const & category = "",
79  QString const & version = "",
80  PLUGINTYPE const & type = MAPLAYER )
81  : mName( name )
82  , mDescription( description )
83  , mCategory( category )
84  , mVersion( version )
85  , mType( type )
86  {}
87 
88  virtual ~QgisPlugin()
89  {}
90 
92  QString const & name() const
93  {
94  return mName;
95  }
96 
98  {
99  return mName;
100  }
101 
103  QString const & version() const
104  {
105  return mVersion;
106  }
107 
110  {
111  return mVersion;
112  }
113 
115  QString const & description() const
116  {
117  return mDescription;
118  }
119 
122  {
123  return mDescription;
124  }
125 
127  QString const & category() const
128  {
129  return mCategory;
130  }
131 
134  {
135  return mCategory;
136  }
137 
139  QgisPlugin::PLUGINTYPE const & type() const
140  {
141  return mType;
142  }
143 
144 
147  {
148  return mType;
149  }
150 
152  virtual void initGui() = 0;
153 
155  virtual void unload() = 0;
156 
157  private:
158 
160  QString mName;
161 
163  QString mDescription;
164 
166  QString mCategory;
167 
169  QString mVersion;
170 
172 
176  PLUGINTYPE mType;
177 
178 }; // class QgisPlugin
179 
180 
181 // Typedefs used by qgis main app
182 
185 
187 typedef void unload_t( QgisPlugin * );
188 
190 typedef QString name_t();
191 
194 
196 typedef QString category_t();
197 
199 typedef int type_t();
200 
202 typedef QString version_t();
203 
205 typedef QString icon_t();
206 
209 
210 #endif // QGISPLUGIN_H
QString const & description() const
A brief description of the plugin.
Definition: qgisplugin.h:115
PLUGINTYPE
Interface to gui element collection object.
Definition: qgisplugin.h:68
QgisPlugin::PLUGINTYPE & type()
Plugin type, either UI or map layer.
Definition: qgisplugin.h:146
QString const & category() const
Plugin category.
Definition: qgisplugin.h:127
QgisPlugin(QString const &name="", QString const &description="", QString const &category="", QString const &version="", PLUGINTYPE const &type=MAPLAYER)
Definition: qgisplugin.h:76
QString icon_t()
Typedef for getting the plugin icon file name without instantiating the plugin.
Definition: qgisplugin.h:205
QgisPlugin * create_t(QgisInterface *)
Typedef for the function that returns a generic pointer to a plugin object.
Definition: qgisplugin.h:184
virtual ~QgisPlugin()
Definition: qgisplugin.h:88
QgisPlugin::PLUGINTYPE const & type() const
Plugin type, either UI or map layer.
Definition: qgisplugin.h:139
void unload_t(QgisPlugin *)
Typedef for the function to unload a plugin and free its resources.
Definition: qgisplugin.h:187
QString name_t()
Typedef for getting the name of the plugin without instantiating it.
Definition: qgisplugin.h:190
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:193
int type_t()
Typedef for getting the plugin type without instantiating the plugin.
Definition: qgisplugin.h:199
QString & category()
Plugin category.
Definition: qgisplugin.h:133
QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugin...
Definition: qgisinterface.h:65
QString const & version() const
Version of the plugin.
Definition: qgisplugin.h:103
QString version_t()
Typedef for getting the plugin version without instantiating the plugin.
Definition: qgisplugin.h:202
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:196
QString const & name() const
Get the name of the plugin.
Definition: qgisplugin.h:92
QString & version()
Version of the plugin.
Definition: qgisplugin.h:109
Abstract base class from which all plugins must inherit.
Definition: qgisplugin.h:49
QString & name()
Definition: qgisplugin.h:97
QString & description()
A brief description of the plugin.
Definition: qgisplugin.h:121
QString experimental_t()
Typedef for getting the experimental status without instantiating the plugin.
Definition: qgisplugin.h:208