QGIS API Documentation  2.4.0-Chugiak
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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  /* enum ELEMENTS {
56  MENU,
57  MENU_ITEM,
58  TOOLBAR,
59  TOOLBAR_BUTTON,
60  };
61 
62  @todo XXX this may be a hint that there should be subclasses
63  */
65  {
66  UI = 1, /* user interface plug-in */
67  MAPLAYER, /* map layer plug-in */
68  RENDERER, /*a plugin for a new renderer class*/
69  };
70 
71 
72  QgisPlugin( QString const & name = "",
73  QString const & description = "",
74  QString const & category = "",
75  QString const & version = "",
76  PLUGINTYPE const & type = MAPLAYER )
77  : mName( name ),
80  mVersion( version ),
81  mType( type )
82  {}
83 
84  virtual ~QgisPlugin()
85  {}
86 
88  QString const & name() const
89  {
90  return mName;
91  }
92 
93  QString & name()
94  {
95  return mName;
96  }
97 
99  QString const & version() const
100  {
101  return mVersion;
102  }
103 
105  QString & version()
106  {
107  return mVersion;
108  }
109 
111  QString const & description() const
112  {
113  return mDescription;
114  }
115 
117  QString & description()
118  {
119  return mDescription;
120  }
121 
123  QString const & category() const
124  {
125  return mCategory;
126  }
127 
129  QString & category()
130  {
131  return mCategory;
132  }
133 
135  QgisPlugin::PLUGINTYPE const & type() const
136  {
137  return mType;
138  }
139 
140 
143  {
144  return mType;
145  }
146 
148  virtual void initGui() = 0;
149 
151  virtual void unload() = 0;
152 
153  private:
154 
156  QString mName;
157 
159  QString mDescription;
160 
162  QString mCategory;
163 
165  QString mVersion;
166 
168 
173 
174 }; // class QgisPlugin
175 
176 
177 // Typedefs used by qgis main app
178 
181 
183 typedef void unload_t( QgisPlugin * );
184 
186 typedef QString name_t();
187 
189 typedef QString description_t();
190 
192 typedef QString category_t();
193 
195 typedef int type_t();
196 
198 typedef QString version_t();
199 
201 typedef QString icon_t();
202 
204 typedef QString experimental_t();
205 
206 #endif //qgisplugin_h
PLUGINTYPE
Interface to gui element collection object.
Definition: qgisplugin.h:64
QgisPlugin::PLUGINTYPE & type()
Plugin type, either UI or map layer.
Definition: qgisplugin.h:142
QString const & name() const
Get the name of the plugin.
Definition: qgisplugin.h:88
QgisPlugin(QString const &name="", QString const &description="", QString const &category="", QString const &version="", PLUGINTYPE const &type=MAPLAYER)
Definition: qgisplugin.h:72
QString icon_t()
Typedef for getting the plugin icon file name without instantiating the plugin.
Definition: qgisplugin.h:201
QgisPlugin * create_t(QgisInterface *)
Typedef for the function that returns a generic pointer to a plugin object.
Definition: qgisplugin.h:180
virtual ~QgisPlugin()
Definition: qgisplugin.h:84
QString mCategory
category
Definition: qgisplugin.h:162
QString const & description() const
A brief description of the plugin.
Definition: qgisplugin.h:111
void unload_t(QgisPlugin *)
Typedef for the function to unload a plugin and free its resources.
Definition: qgisplugin.h:183
QString const & category() const
Plugin category.
Definition: qgisplugin.h:123
QString name_t()
Typedef for getting the name of the plugin without instantiating it.
Definition: qgisplugin.h:186
QString mDescription
description
Definition: qgisplugin.h:159
QString const & version() const
Version of the plugin.
Definition: qgisplugin.h:99
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:189
int type_t()
Typedef for getting the plugin type without instantiating the plugin.
Definition: qgisplugin.h:195
QString & category()
Plugin category.
Definition: qgisplugin.h:129
QgisInterface Abstract base class defining interfaces exposed by QgisApp and made available to plugin...
Definition: qgisinterface.h:60
QString version_t()
Typedef for getting the plugin version without instantiating the plugin.
Definition: qgisplugin.h:198
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:192
QString & version()
Version of the plugin.
Definition: qgisplugin.h:105
QString mVersion
version
Definition: qgisplugin.h:165
QgisPlugin::PLUGINTYPE const & type() const
Plugin type, either UI or map layer.
Definition: qgisplugin.h:135
Abstract base class from which all plugins must inherit.
Definition: qgisplugin.h:48
QString & name()
Definition: qgisplugin.h:93
QString & description()
A brief description of the plugin.
Definition: qgisplugin.h:117
QString mName
plug-in name
Definition: qgisplugin.h:156
QString experimental_t()
Typedef for getting the experimental status without instantiating the plugin.
Definition: qgisplugin.h:204
PLUGINTYPE mType
UI or MAPLAYER plug-in.
Definition: qgisplugin.h:172