BaseInterface.hh 7.98 KB
 Jan Möbius committed Aug 29, 2008 1 2 3 4 5 6 7 8 9 10 11 12 13 14 //============================================================================= // // OpenFlipper // Copyright (C) 2008 by Computer Graphics Group, RWTH Aachen // www.openflipper.org // //----------------------------------------------------------------------------- // // License // // OpenFlipper is free software: you can redistribute it and/or modify // it under the terms of the GNU Lesser General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version.  Jan Möbius committed Sep 19, 2008 15 //  Jan Möbius committed Aug 29, 2008 16 17 18 19 // OpenFlipper is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU Lesser General Public License for more details.  Jan Möbius committed Sep 19, 2008 20 //  Jan Möbius committed Aug 29, 2008 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 // You should have received a copy of the GNU Lesser General Public License // along with OpenFlipper. If not, see . // //----------------------------------------------------------------------------- // // $Revision$ // $Author$ // $Date$ // //============================================================================= // // C++ Interface: BasePlugin //  Jan Möbius committed Sep 19, 2008 38 // Description:  Jan Möbius committed Aug 29, 2008 39 40 41 42 43 // // // Author: Jan Moebius , (C) 2007 //  Jan Möbius committed Sep 19, 2008 44 45 #ifndef BASEINTERFACE_HH #define BASEINTERFACE_HH  Jan Möbius committed Aug 29, 2008 46 47 48 49  #include #include #include  Jan Möbius committed Sep 19, 2008 50   Jan Möbius committed Aug 29, 2008 51  /** \brief Interface class from which all plugins have to be created.  Jan Möbius committed Sep 19, 2008 52  *  Jan Möbius committed Aug 29, 2008 53  * You have to implement at least name and description for your plugin.  Jan Möbius committed Sep 19, 2008 54  * All other functions and signals are optional. If you want to implement or use  Jan Möbius committed Aug 29, 2008 55  * them just add them to your plugin header.  Mike Kremer committed Feb 04, 2009 56 57 58 59 60  * * See \ref pluginProgramming for a tutorial on plugin programming. * * Also see \ref dataFlow diagrams for a detailed overview of * OpenFlipper's data flow and interface function calls.  Jan Möbius committed Aug 29, 2008 61 62  */ class BaseInterface {  Jan Möbius committed Sep 19, 2008 63   Jan Möbius committed Feb 03, 2009 64 65 66 67  //=========================================================================== /** @name Initialization * @{ */ //===========================================================================  Jan Möbius committed Sep 19, 2008 68   Jan Möbius committed Feb 03, 2009 69 70  private slots: /** \brief Initialize Plugin  Jan Möbius committed Sep 19, 2008 71  *  Jan Möbius committed Aug 29, 2008 72  * This slot is called if the plugin is loaded and has to be initialized. All initialization stuff  Jan Möbius committed Feb 03, 2009 73  * in this slot has to stay inside the plugin, no external signals are allowed here.  Jan Möbius committed Aug 29, 2008 74  * Dont create any objects via pluginfunctions here. Use the pluginsInitialized() slot for external  Jan Möbius committed Feb 03, 2009 75  * initialization. After execution of this slot your plugin should be fully functional.  Jan Möbius committed Sep 19, 2008 76  * Only gui elements may be uninitialized and should be created in pluginsInitialized().  Jan Möbius committed Aug 29, 2008 77 78  */ virtual void initializePlugin() {};  Jan Möbius committed Sep 19, 2008 79   Jan Möbius committed Aug 29, 2008 80  /** \brief Initialize Plugin step 2  Jan Möbius committed Sep 19, 2008 81  *  Jan Möbius committed Aug 29, 2008 82 83 84 85  * This slot is called if all plugins are loaded and the core is ready. Here you can create objects, * set Textures and everything which will involve signals to the core. */ virtual void pluginsInitialized() {};  Jan Möbius committed Sep 19, 2008 86 87   Jan Möbius committed Feb 03, 2009 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165  /** @} */ //=========================================================================== /** @name Object/View updates * @{ */ //=========================================================================== signals : /** \brief Update current view in Main Application * * Emit this Signal if the examiner widget in the Main Application should update the current view. * If you do an updatedObject the core will trigger an update itself */ virtual void updateView() {}; /** \brief The object list has been changed by this plugin * * Emit this Signal, if you updated an object (e.g. Source or Target changed).\n * If you changed the element itself (geometry, topology,..) You also have to emit this signal.\n * Dont emit this Signal in BaseInterface::slotObjectUpdated() as this causes an endless Loop!! * Give the id of the new object as parameter or -1 if you deleted an object. * * The parameter has to be the id of the object or -1 if refering to all objects. */ virtual void updatedObject(int ) {}; /** \brief The active object has been switched by this plugin * * This Signal is used to tell the other plugins that the active object has been changed.\n * You should only do this if you are writing a plugin that manages the objects(e.g. DatacontrolPlugin).\n */ virtual void activeObjectChanged() {}; private slots: /** \brief An object has been updated by an other plugin * * This slot is called by the Main aplication if the number or status of existing objects changed or if * an existing object has been changed. This could mean, that objects are added or deleted * or that for an existing object with the given id has been modified. * If you store local information about one of these Objects, you should check if its still valid!\n * Dont emit BaseInterface::updatedObject(int) in this slot as this causes an endless Loop!! * You dont need to call updateView as the core triggers a redraw itself. * @param _identifier Identifier of the updated/new object or -1 if one is deleted */ virtual void slotObjectUpdated( int /*_identifier*/ ) {}; /** \brief Called if the whole scene is cleared * */ virtual void slotAllCleared( ) {}; /** \brief The active object has changed * * This slot is called by the Main aplication if the currently active object has changed.\n * This means that the selection of target objects has changed. */ virtual void slotActiveObjectChanged() {}; /** @} */ //=========================================================================== /** @name Plugin identification * @{ */ //=========================================================================== public : /** \brief Return a Name for the plugin * * This Function has to return the name of the plugin. */ virtual QString name() = 0; /** \brief Return a description of what the plugin is doing * * This function has to return a basic description of the plugin */ virtual QString description() = 0;  Jan Möbius committed Sep 19, 2008 166 167 168 169 170 171 172 173 174  public slots: /** \brief Return a version string for your plugin * * This function will be used to determin the current version of your plugin. * Should have the form x.x.x ( you do not need to give that many subversions ) */ virtual QString version() { return QString("-1"); };  Jan Möbius committed Feb 03, 2009 175  signals:  Jan Möbius committed Sep 19, 2008 176   Jan Möbius committed Feb 03, 2009 177  /** \brief Set a description for a public slot  Jan Möbius committed Sep 19, 2008 178  *  Jan Möbius committed Feb 03, 2009 179 180 181 182 183 184 185  * public slots of each plugin are automaticly available for scripting. \n * Use this Signal to add a description for your slot so that everyone knows what it is used for. \n * * @param _slotName the name of the slot * @param _slotDescription a description for the slot * @param _parameters list of parameters * @param _descriptions list of descriptions for the parameters (_descriptions[i] corresponds to _parameters[i])  Jan Möbius committed Aug 29, 2008 186  */  Jan Möbius committed Feb 03, 2009 187 188  virtual void setSlotDescription(QString /*_slotName*/, QString /*_slotDescription*/, QStringList /*_parameters*/, QStringList /*_descriptions*/) {};  Jan Möbius committed Sep 19, 2008 189   Jan Möbius committed Feb 03, 2009 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208  /** @} */ private slots : /** This function is called when the application exits or when your plugin is about to be unloaded. * Here you can clean up your plugin, delete local variables... */ virtual void exit(){}; /** Using this function you can inform the core that your plugin can run without creating a widget. * If your plugin does not implement this function, it will not be loaded in scripting mode. * You dont have to do anything in this function. */ virtual void noguiSupported( ) {} ; public : /// Destructor virtual ~BaseInterface() {};  Jan Möbius committed Sep 19, 2008 209   Jan Möbius committed Aug 29, 2008 210 211 };  Jan Möbius committed Oct 16, 2008 212 Q_DECLARE_INTERFACE(BaseInterface,"OpenFlipper.BaseInterface/1.0")  Jan Möbius committed Sep 19, 2008 213   Jan Möbius committed Aug 29, 2008 214 #endif // BASEINTERFACE_HH