Salome HOME
436548415c7a426fac96018281fdfb79e5f85380
[modules/gui.git] / src / SalomeApp / SalomeApp_Module.h
1 // File:      SalomeApp_Module.h
2 // Created:   10/25/2004 11:33:06 AM
3 // Author:    Sergey LITONIN
4 // Copyright (C) CEA 2004
5
6 #ifndef SALOMEAPP_MODULE_H
7 #define SALOMEAPP_MODULE_H
8
9 #include "SalomeApp.h"
10
11 #include <LightApp_Module.h>
12
13 #include <string>
14
15 class CAM_DataModel;
16 class SUIT_DataObject;
17 class SUIT_Operation;
18 class SalomeApp_Application;
19
20 class SalomeApp_Operation;
21 class SalomeApp_SwitchOp;
22
23 /*!
24  * \brief Base class for all salome modules
25 */
26 class SALOMEAPP_EXPORT SalomeApp_Module : public LightApp_Module
27 {
28   Q_OBJECT
29
30 public:
31   SalomeApp_Module( const QString& );
32   virtual ~SalomeApp_Module();
33
34   /*! engineIOR() should be a pure virtual method, to avoid logical errors!\n
35    * Implementation in derived classes can return the following values:\n
36    * module`s engine IOR - means that this is a standard SALOME module with a CORBA engine
37    * \li "" (empty string)   - means that this is a light module, default engine should be used for interaction with SALOMEDS persistence
38    * \li "-1"                - means that this is a light module, SALOMEDS persistence is not used at all\n
39    */
40   virtual QString                     engineIOR() const = 0;
41   
42   /*! Convenient shortcuts*/
43  
44   SalomeApp_Application*              getApp() const;
45
46   virtual void                        update( const int );
47   // Update viewer or/and object browser etc. in accordance with update flags
48   // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
49   // for their own purposes
50     
51 public slots:
52   virtual bool                        activateModule( SUIT_Study* );
53   virtual bool                        deactivateModule( SUIT_Study* );
54
55 protected slots:
56   virtual void                        onOperationStopped( SUIT_Operation* );
57   virtual void                        onOperationDestroyed();
58
59  protected:
60   virtual CAM_DataModel*              createDataModel();
61
62   virtual void                        updateControls();
63
64   /*! Module stores operations in map. This method starts operation by id.
65    *  If operation isn't in map, then it will be created by createOperation method
66    *  and will be inserted to map
67    */
68   void                                startOperation( const int );
69
70   /*! Create operation by its id. You must not call this method, it will be called automatically
71    *  by startOperation. Please redefine this method in current module
72    */
73   virtual SalomeApp_Operation*        createOperation( const int ) const;
74
75 private:
76   typedef QMap<int,SalomeApp_Operation*> MapOfOperation;
77   
78 private:
79   MapOfOperation        myOperations;
80   SalomeApp_SwitchOp*    mySwitchOp;
81 };
82
83 #endif