BaseInterface.hh 6.35 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
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.
15
//
Jan Möbius's avatar
 
Jan Möbius committed
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.
20
//
Jan Möbius's avatar
 
Jan Möbius committed
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 <http://www.gnu.org/licenses/>.
//
//-----------------------------------------------------------------------------
//
//   $Revision$
//   $Author$
//   $Date$
//
//=============================================================================




//
// C++ Interface: BasePlugin
//
38
// Description:
Jan Möbius's avatar
 
Jan Möbius committed
39
40
41
42
43
//
//
// Author: Jan Moebius <jan_moebius@web.de>, (C) 2007
//

44
45
#ifndef BASEINTERFACE_HH
#define BASEINTERFACE_HH
Jan Möbius's avatar
 
Jan Möbius committed
46
47
48
49
50

 #include <QtGui>
 #include <QMenuBar>
 #include <ACG/QtWidgets/QtExaminerViewer.hh>
 #include <OpenFlipper/common/Types.hh>
51

Jan Möbius's avatar
 
Jan Möbius committed
52
 /** \brief Interface class from which all plugins have to be created.
53
  *
Jan Möbius's avatar
 
Jan Möbius committed
54
  * You have to implement at least name and description for your plugin.
55
  * All other functions and signals are optional. If you want to implement or use
Jan Möbius's avatar
 
Jan Möbius committed
56
57
58
59
60
  * them just add them to your plugin header.
 */
class BaseInterface {
   signals :
      /** \brief Update current view in Main Application
61
       *
Jan Möbius's avatar
 
Jan Möbius committed
62
63
64
65
66
       *  Emit this Signal if the examiner widget in the Main Application should update the current view.
       *  This should be done for example if you changed a scenegraph node or a mesh and have
       *  to redraw it.
      */
      virtual void update_view() {};
67

Jan Möbius's avatar
 
Jan Möbius committed
68
      /** \brief The object list has been changed by this plugin
69
       *
Jan Möbius's avatar
 
Jan Möbius committed
70
71
72
73
74
75
       *  Emit this Signal, if the object list has changed (e.g. Source or Target changed).\n
       *  If you changed the element itself (geometry, topology,..) You should also 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.
       */
      virtual void updated_objects(int) {};
76

Jan Möbius's avatar
 
Jan Möbius committed
77
      /**  \brief The active object has been switched by this plugin
78
       *
Jan Möbius's avatar
 
Jan Möbius committed
79
80
81
82
       *   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() {};
83

Jan Möbius's avatar
 
Jan Möbius committed
84
   private slots :
85

Jan Möbius's avatar
 
Jan Möbius committed
86
      /**  \brief An object has been updated by an other plugin
87
88
       *
       *   This slot is called by the Main aplication if the number or status of existing objects changed or if
Jan Möbius's avatar
 
Jan Möbius committed
89
90
91
92
93
94
95
       *   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::updated_objects(int) in this slot as this causes an endless Loop!!
       *  @param _identifier Identifier of the updated/new object or -1 if one is deleted
      */
      virtual void slotObjectUpdated( int _identifier ) {};
96

Jan Möbius's avatar
Jan Möbius committed
97
      /**  \brief Called if the whole scene is cleared
98
       *
Jan Möbius's avatar
Jan Möbius committed
99
100
       */
      virtual void slotAllCleared( ) {};
101

Jan Möbius's avatar
 
Jan Möbius committed
102
       /**  \brief The active object has changed
103
       *
Jan Möbius's avatar
 
Jan Möbius committed
104
105
106
107
       *   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() {};
108
109


Jan Möbius's avatar
 
Jan Möbius committed
110
       /**  \brief Initialize Plugin
111
       *
Jan Möbius's avatar
 
Jan Möbius committed
112
113
114
115
       *   This slot is called if the plugin is loaded and has to be initialized. All initialization stuff
       *   in this slot has to stay inside the plugin, no external singals are allowed here.
       *   Dont create any objects via pluginfunctions here. Use the pluginsInitialized() slot for external
       *   Initialization. After execution of this slot your plugin should be fully functional.
116
       *   Only gui elements may be uninitialized and should be created in pluginsInitialized().
Jan Möbius's avatar
 
Jan Möbius committed
117
118
      */
      virtual void initializePlugin() {};
119

Jan Möbius's avatar
 
Jan Möbius committed
120
      /**  \brief Initialize Plugin step 2
121
       *
Jan Möbius's avatar
 
Jan Möbius committed
122
123
124
125
       *   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() {};
126

Jan Möbius's avatar
 
Jan Möbius committed
127
128
129
130
      /** 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(){};
131

Jan Möbius's avatar
 
Jan Möbius committed
132
133
134
135
136
      /** 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( ) {} ;
137
138
139
140
141
142
143
144
145
146
147

  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"); };

   public :

Jan Möbius's avatar
 
Jan Möbius committed
148
149
      /// Destructor
      virtual ~BaseInterface() {};
150
151
152

      /** \brief Return a Name for the plugin
       *
Jan Möbius's avatar
 
Jan Möbius committed
153
154
155
       * This Function has to return the name of the plugin.
      */
      virtual QString name() = 0;
156

Jan Möbius's avatar
 
Jan Möbius committed
157
      /** \brief Return a description of what the plugin is doing
158
       *
Jan Möbius's avatar
 
Jan Möbius committed
159
160
161
       * This function has to return a basic description of the plugin
       */
      virtual QString description() = 0;
162

Jan Möbius's avatar
 
Jan Möbius committed
163
164
165
};

Q_DECLARE_INTERFACE(BaseInterface,"OpenFlipper.BaseInterface/0.3")
166

Jan Möbius's avatar
 
Jan Möbius committed
167
#endif // BASEINTERFACE_HH