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;
33 class SalomeApp_Displayer;
36 * \brief Base class for all salome modules
38 class SALOMEAPP_EXPORT SalomeApp_Module : public CAM_Module
43 SalomeApp_Module( const QString& );
44 virtual ~SalomeApp_Module();
46 virtual void initialize( CAM_Application* );
47 virtual void windows( QMap<int, int>& ) const;
48 virtual void viewManagers( QStringList& ) const;
49 virtual SalomeApp_Displayer* displayer();
51 /*! engineIOR() should be a pure virtual method, to avoid logical errors!\n
52 * Implementation in derived classes can return the following values:\n
53 * module`s engine IOR - means that this is a standard SALOME module with a CORBA engine
54 * \li "" (empty string) - means that this is a light module, default engine should be used for interaction with SALOMEDS persistence
55 * \li "-1" - means that this is a light module, SALOMEDS persistence is not used at all\n
57 virtual QString engineIOR() const = 0;
59 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
61 virtual void createPreferences();
63 /*! Convenient shortcuts*/
65 SalomeApp_Application* getApp() const;
67 virtual void update( const int );
68 // Update viewer or/and object browser etc. in accordance with update flags
69 // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
70 // for their own purposes
72 void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
73 // Update object bropwser ( for updating model or whole object browser use update() method
76 virtual void selectionChanged();
77 virtual void preferencesChanged( const QString&, const QString& );
79 virtual void studyActivated() {};
82 virtual bool activateModule( SUIT_Study* );
83 virtual bool deactivateModule( SUIT_Study* );
88 virtual void onModelSaved();
89 virtual void onModelOpened();
90 virtual void onModelClosed();
91 virtual void onOperationStopped( SUIT_Operation* );
92 virtual void onOperationDestroyed();
93 virtual void onShowHide();
96 QtxPopupMgr* popupMgr();
97 SalomeApp_Preferences* preferences() const;
99 virtual CAM_DataModel* createDataModel();
100 virtual SalomeApp_Selection* createSelection() const;
101 virtual void updateControls();
103 /*! Module stores operations in map. This method starts operation by id.
104 * If operation isn't in map, then it will be created by createOperation method
105 * and will be inserted to map
107 void startOperation( const int );
109 /*! Create operation by its id. You must not call this method, it will be called automatically
110 * by startOperation. Please redefine this method in current module
112 virtual SalomeApp_Operation* createOperation( const int ) const;
114 int addPreference( const QString& label );
115 int addPreference( const QString& label, const int pId, const int = -1,
116 const QString& section = QString::null,
117 const QString& param = QString::null );
118 QVariant preferenceProperty( const int, const QString& ) const;
119 void setPreferenceProperty( const int, const QString&, const QVariant& );
122 typedef QMap<int,SalomeApp_Operation*> MapOfOperation;
125 QtxPopupMgr* myPopupMgr;
126 MapOfOperation myOperations;
127 SalomeApp_SwitchOp* mySwitchOp;
128 int myDisplay, myErase, myDisplayOnly;