QGIS API Documentation 4.1.0-Master (5bf3c20f3c9)
Loading...
Searching...
No Matches
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
36#ifndef QGISPLUGIN_H
37#define QGISPLUGIN_H
38
39
40#include <QString>
41
42#define SIP_NO_FILE
43
44class QgisInterface;
45
46//#include "qgisplugingui.h"
47
55{
56 public:
58 //virtual QgisPluginGui *gui()=0;
60#if 0
61 enum Elements
62 {
63 MENU,
64 MENU_ITEM,
65 TOOLBAR,
66 TOOLBAR_BUTTON,
67 };
68
69 \todo XXX this may be a hint that there should be subclasses
70#endif
71
73 {
74 UI = 1,
77 };
78
79
83 QgisPlugin( QString const &name = "", QString const &description = "", QString const &category = "", QString const &version = "", PluginType type = MapLayer )
84 : mName( name )
85 , mDescription( description )
86 , mCategory( category )
87 , mVersion( version )
88 , mType( type )
89 {}
90
91 virtual ~QgisPlugin() = default;
92
94 QString const &name() const { return mName; }
95
96 QString &name() { return mName; }
97
99 QString const &version() const { return mVersion; }
100
102 QString &version() { return mVersion; }
103
105 QString const &description() const { return mDescription; }
106
108 QString &description() { return mDescription; }
109
111 QString const &category() const { return mCategory; }
112
114 QString &category() { return mCategory; }
115
117 QgisPlugin::PluginType const &type() const { return mType; }
118
119
121 QgisPlugin::PluginType &type() { return mType; }
122
124 virtual void initGui() = 0;
125
127 virtual void unload() = 0;
128
129 private:
131 QString mName;
132
134 QString mDescription;
135
137 QString mCategory;
138
140 QString mVersion;
141
143
148 PluginType mType;
149
150}; // class QgisPlugin
151
152
153// Typedefs used by qgis main app
154
157
159typedef void unload_t( QgisPlugin * );
160
162typedef const QString *name_t();
163
165typedef const QString *description_t();
166
168typedef const QString *category_t();
169
171typedef int type_t();
172
174typedef const QString *version_t();
175
177typedef const QString *icon_t();
178
180typedef const QString *experimental_t();
181
183typedef const QString *create_date_t();
184
186typedef const QString *update_date_t();
187
188#endif // QGISPLUGIN_H
Abstract base class defining interfaces exposed by QgisApp and made available to plugins.
Abstract base class from which all plugins must inherit.
Definition qgisplugin.h:55
QString & name()
Definition qgisplugin.h:96
virtual ~QgisPlugin()=default
QString const & version() const
Version of the plugin.
Definition qgisplugin.h:99
virtual void initGui()=0
function to initialize connection to GUI
PluginType
Interface to gui element collection object.
Definition qgisplugin.h:73
@ Renderer
A plugin for a new renderer class.
Definition qgisplugin.h:76
@ MapLayer
Map layer plug-in.
Definition qgisplugin.h:75
@ UI
User interface plug-in.
Definition qgisplugin.h:74
QString & category()
Plugin category.
Definition qgisplugin.h:114
QgisPlugin::PluginType const & type() const
Plugin type, either UI or map layer.
Definition qgisplugin.h:117
virtual void unload()=0
Unload the plugin and cleanup the GUI.
QgisPlugin::PluginType & type()
Plugin type, either UI or map layer.
Definition qgisplugin.h:121
QString & version()
Version of the plugin.
Definition qgisplugin.h:102
QString & description()
A brief description of the plugin.
Definition qgisplugin.h:108
QString const & category() const
Plugin category.
Definition qgisplugin.h:111
QgisPlugin(QString const &name="", QString const &description="", QString const &category="", QString const &version="", PluginType type=MapLayer)
Constructor for QgisPlugin.
Definition qgisplugin.h:83
QString const & description() const
A brief description of the plugin.
Definition qgisplugin.h:105
QString const & name() const
Gets the name of the plugin.
Definition qgisplugin.h:94
const QString * name_t()
Typedef for getting the name of the plugin without instantiating it.
Definition qgisplugin.h:162
const QString * icon_t()
Typedef for getting the plugin icon file name without instantiating the plugin.
Definition qgisplugin.h:177
QgisPlugin * create_t(QgisInterface *)
Typedef for the function that returns a generic pointer to a plugin object.
Definition qgisplugin.h:156
void unload_t(QgisPlugin *)
Typedef for the function to unload a plugin and free its resources.
Definition qgisplugin.h:159
int type_t()
Typedef for getting the plugin type without instantiating the plugin.
Definition qgisplugin.h:171
const QString * version_t()
Typedef for getting the plugin version without instantiating the plugin.
Definition qgisplugin.h:174
const QString * update_date_t()
Typedef for getting the update date status without instantiating the plugin.
Definition qgisplugin.h:186
const QString * description_t()
Typedef for getting the description without instantiating the plugin.
Definition qgisplugin.h:165
const QString * category_t()
Typedef for getting the category without instantiating the plugin.
Definition qgisplugin.h:168
const QString * experimental_t()
Typedef for getting the experimental status without instantiating the plugin.
Definition qgisplugin.h:180
const QString * create_date_t()
Typedef for getting the create date without instantiating the plugin.
Definition qgisplugin.h:183