1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
19 // File: LightApp_Module.h
20 // Created: 6/20/2005 16:25:06 AM
22 // Copyright (C) CEA 2005
24 #ifndef LIGHTAPP_MODULE_H
25 #define LIGHTAPP_MODULE_H
28 #include <CAM_Module.h>
30 class LightApp_Application;
31 class LightApp_Preferences;
32 class LightApp_Selection;
33 class LightApp_Operation;
34 class LightApp_SwitchOp;
35 class LightApp_ShowHideOp;
36 class LightApp_Displayer;
39 class SUIT_DataObject;
41 class SUIT_ViewManager;
42 class CAM_Application;
50 \class LightApp_Module
51 Base class for all light modules
54 class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
59 LightApp_Module( const QString& );
60 virtual ~LightApp_Module();
62 virtual void initialize( CAM_Application* );
63 virtual void windows( QMap<int, int>& ) const;
64 virtual void viewManagers( QStringList& ) const;
66 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
68 virtual void createPreferences();
70 LightApp_Application* getApp() const;
72 virtual void update( const int );
73 // Update viewer or/and object browser etc. in accordance with update flags
74 // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
75 // for their own purposes
77 virtual void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
78 // Update object bropwser ( for updating model or whole object browser use update() method
81 virtual void selectionChanged();
82 virtual void preferencesChanged( const QString&, const QString& );
84 virtual void studyActivated() {};
86 virtual LightApp_Displayer* displayer();
89 virtual bool activateModule( SUIT_Study* );
90 virtual bool deactivateModule( SUIT_Study* );
95 virtual void onModelSaved();
96 virtual void onModelOpened();
97 virtual void onModelClosed();
99 virtual void onOperationStopped( SUIT_Operation* );
100 virtual void onOperationDestroyed();
101 virtual void onShowHide();
102 virtual void onViewManagerAdded( SUIT_ViewManager* );
103 virtual void onViewManagerRemoved( SUIT_ViewManager* );
106 virtual QtxPopupMgr* popupMgr();
107 LightApp_Preferences* preferences() const;
109 virtual CAM_DataModel* createDataModel();
110 virtual LightApp_Selection* createSelection() const;
112 int addPreference( const QString& label );
113 int addPreference( const QString& label, const int pId, const int = -1,
114 const QString& section = QString::null,
115 const QString& param = QString::null );
116 QVariant preferenceProperty( const int, const QString& ) const;
117 void setPreferenceProperty( const int, const QString&, const QVariant& );
119 /*! Module stores operations in map. This method starts operation by id.
120 * If operation isn't in map, then it will be created by createOperation method
121 * and will be inserted to map
123 void startOperation( const int );
124 /*! Create operation by its id. You must not call this method, it will be called automatically
125 * by startOperation. Please redefine this method in current module
127 virtual LightApp_Operation* createOperation( const int ) const;
129 virtual void updateControls();
132 typedef QMap<int,LightApp_Operation*> MapOfOperation;
135 QtxPopupMgr* myPopupMgr;
136 MapOfOperation myOperations;
137 LightApp_SwitchOp* mySwitchOp;
140 int myDisplay, myErase, myDisplayOnly, myEraseAll;