Updraft  1.0
Open source glider flight visualisation tool.
pluginbase.h
Go to the documentation of this file.
00001 #ifndef UPDRAFT_SRC_PLUGINBASE_H_
00002 #define UPDRAFT_SRC_PLUGINBASE_H_
00003 
00004 #include <QtGui>
00005 #include <QStringList>
00006 
00007 #include "coreinterface.h"
00008 #include "tabinterface.h"
00009 #include "menuinterface.h"
00010 
00011 #define PLUGIN_API_VERSION 0
00012 
00013 namespace Updraft {
00014 
00015 #ifndef UPDRAFT_CORE
00016 // Pointer to coreinterface, defined in each plugin.
00017 // To access this pointer from any file of plugin, include pluginbase.h.
00018 extern CoreInterface *g_core;
00019 #endif
00020 
00021 class EventInfo;
00022 
00025 class PluginBase {
00026  public:
00027   PluginBase() {}
00028   virtual ~PluginBase() {}
00029 
00032   virtual QString getName() = 0;
00033 
00035   virtual unsigned getPluginApiVersion() { return PLUGIN_API_VERSION; }
00037 
00041   virtual void initialize(CoreInterface *coreInterface) = 0;
00042 
00044   virtual void deinitialize() = 0;
00045 
00047   virtual void fillContextMenu(MapObject* obj, MenuInterface* menu) {}
00048 
00050   virtual bool wantsToHandleClick(MapObject* obj) { return false; }
00051 
00053   virtual void handleClick(MapObject* obj, const EventInfo* evt) {}
00054 
00059   virtual bool fileOpen(const QString &filename, int roleId) {
00060     return false; }
00061 
00062  private:
00064   PluginBase(const PluginBase& other) {}
00065 };
00066 
00067 }  // namespace Updraft
00068 
00069 Q_DECLARE_INTERFACE(Updraft::PluginBase, "Updraft_PluginBase")
00070 
00071 #endif  // UPDRAFT_SRC_PLUGINBASE_H_
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines