1 // File: SalomeApp_Module.h
2 // Created: 10/25/2004 11:33:06 AM
3 // Author: Sergey LITONIN
4 // Copyright (C) CEA 2004
6 #ifndef SALOMEAPP_MODULE_H
7 #define SALOMEAPP_MODULE_H
10 #include "SalomeApp_Selection.h"
12 #include <CAM_Module.h>
25 class SUIT_DataObject;
27 class SalomeApp_DataModel;
28 class SalomeApp_Application;
29 class SalomeApp_Preferences;
30 class SalomeApp_SelectionManager;
31 class SalomeApp_Operation;
32 class SalomeApp_SwitchOp;
35 * \brief Base class for all salome modules
37 class SALOMEAPP_EXPORT SalomeApp_Module : public CAM_Module
42 SalomeApp_Module( const QString& );
43 virtual ~SalomeApp_Module();
45 virtual void initialize( CAM_Application* );
46 virtual void windows( QMap<int, int>& ) const;
47 virtual void viewManagers( QStringList& ) const;
49 /*! engineIOR() should be a pure virtual method, to avoid logical errors!\n
50 * Implementation in derived classes can return the following values:\n
51 * module`s engine IOR - means that this is a standard SALOME module with a CORBA engine
52 * \li "" (empty string) - means that this is a light module, default engine should be used for interaction with SALOMEDS persistence
53 * \li "-1" - means that this is a light module, SALOMEDS persistence is not used at all\n
55 virtual QString engineIOR() const = 0;
57 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
59 virtual void createPreferences();
61 /*! Convenient shortcuts*/
63 SalomeApp_Application* getApp() const;
65 virtual void update( const int );
66 // Update viewer or/and object browser etc. in accordance with update flags
67 // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
68 // for their own purposes
70 void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
71 // Update object bropwser ( for updating model or whole object browser use update() method
74 virtual void selectionChanged();
75 virtual void preferencesChanged( const QString&, const QString& );
77 virtual void studyActivated() {};
80 virtual bool activateModule( SUIT_Study* );
81 virtual bool deactivateModule( SUIT_Study* );
86 virtual void onModelSaved();
87 virtual void onModelOpened();
88 virtual void onModelClosed();
89 virtual void onOperationStopped( SUIT_Operation* );
90 virtual void onOperationDestroyed();
93 QtxPopupMgr* popupMgr();
94 SalomeApp_Preferences* preferences() const;
96 virtual CAM_DataModel* createDataModel();
97 virtual SalomeApp_Selection* createSelection() const;
98 virtual void updateControls();
100 /*! Module stores operations in map. This method starts operation by id.
101 * If operation isn't in map, then it will be created by createOperation method
102 * and will be inserted to map
104 void startOperation( const int );
106 /*! Create operation by its id. You must not call this method, it will be called automatically
107 * by startOperation. Please redefine this method in current module
109 virtual SalomeApp_Operation* createOperation( const int ) const;
111 int addPreference( const QString& label );
112 int addPreference( const QString& label, const int pId, const int = -1,
113 const QString& section = QString::null,
114 const QString& param = QString::null );
115 QVariant preferenceProperty( const int, const QString& ) const;
116 void setPreferenceProperty( const int, const QString&, const QVariant& );
119 typedef QMap<int,SalomeApp_Operation*> MapOfOperation;
122 QtxPopupMgr* myPopupMgr;
123 MapOfOperation myOperations;
124 SalomeApp_SwitchOp* mySwitchOp;