1 // Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 // File: LightApp_Module.h
23 // Created: 6/20/2005 16:25:06 AM
26 #ifndef LIGHTAPP_MODULE_H
27 #define LIGHTAPP_MODULE_H
30 #include "LightApp_Preferences.h"
31 #include <CAM_Module.h>
33 class LightApp_Application;
34 class LightApp_Selection;
35 class LightApp_Operation;
36 class LightApp_SwitchOp;
37 class LightApp_Displayer;
38 class LightApp_SelectionMgr;
41 class SUIT_DataObject;
43 class SUIT_ViewManager;
44 class CAM_Application;
52 #pragma warning ( disable:4251 )
56 \class LightApp_Module
57 Base class for all light modules
60 class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
65 LightApp_Module( const QString& );
66 virtual ~LightApp_Module();
68 virtual void initialize( CAM_Application* );
69 virtual void windows( QMap<int, int>& ) const;
70 virtual void viewManagers( QStringList& ) const;
72 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
74 virtual void createPreferences();
76 LightApp_Application* getApp() const;
78 virtual void update( const int );
79 // Update viewer or/and object browser etc. in accordance with update flags
80 // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
81 // for their own purposes
83 virtual void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
84 // Update object bropwser ( for updating model or whole object browser use update() method
87 virtual void selectionChanged();
88 virtual void preferencesChanged( const QString&, const QString& );
90 virtual void studyActivated() {};
92 virtual LightApp_Displayer* displayer();
93 virtual LightApp_Selection* createSelection() const;
96 virtual bool activateModule( SUIT_Study* );
97 virtual bool deactivateModule( SUIT_Study* );
102 virtual void onModelSaved();
103 virtual void onModelOpened();
104 virtual void onModelClosed();
106 virtual void onOperationStopped( SUIT_Operation* );
107 virtual void onOperationDestroyed();
108 virtual void onShowHide();
109 virtual void onViewManagerAdded( SUIT_ViewManager* );
110 virtual void onViewManagerRemoved( SUIT_ViewManager* );
113 virtual QtxPopupMgr* popupMgr();
114 LightApp_Preferences* preferences() const;
116 virtual CAM_DataModel* createDataModel();
118 int addPreference( const QString& label );
119 int addPreference( const QString& label, const int pId, const int = LightApp_Preferences::Auto,
120 const QString& section = QString(),
121 const QString& param = QString() );
122 QVariant preferenceProperty( const int, const QString& ) const;
123 void setPreferenceProperty( const int, const QString&, const QVariant& );
125 /*! Module stores operations in map. This method starts operation by id.
126 * If operation isn't in map, then it will be created by createOperation method
127 * and will be inserted to map
129 void startOperation( const int );
130 /*! Create operation by its id. You must not call this method, it will be called automatically
131 * by startOperation. Please redefine this method in current module
133 virtual LightApp_Operation* createOperation( const int ) const;
135 virtual void updateControls();
137 virtual bool isSelectionCompatible();
139 LightApp_Operation* operation( const int ) const;
142 typedef QMap<int,LightApp_Operation*> MapOfOperation;
145 QtxPopupMgr* myPopupMgr;
146 MapOfOperation myOperations;
147 LightApp_SwitchOp* mySwitchOp;
150 int myDisplay, myErase, myDisplayOnly, myEraseAll;
154 #pragma warning ( default:4251 )