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 #pragma warning ( disable:4251 )
54 \class LightApp_Module
55 Base class for all light modules
58 class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
63 LightApp_Module( const QString& );
64 virtual ~LightApp_Module();
66 virtual void initialize( CAM_Application* );
67 virtual void windows( QMap<int, int>& ) const;
68 virtual void viewManagers( QStringList& ) const;
70 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
72 virtual void createPreferences();
74 LightApp_Application* getApp() const;
76 virtual void update( const int );
77 // Update viewer or/and object browser etc. in accordance with update flags
78 // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
79 // for their own purposes
81 virtual void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
82 // Update object bropwser ( for updating model or whole object browser use update() method
85 virtual void selectionChanged();
86 virtual void preferencesChanged( const QString&, const QString& );
88 virtual void studyActivated() {};
90 virtual LightApp_Displayer* displayer();
91 virtual LightApp_Selection* createSelection() const;
94 virtual bool activateModule( SUIT_Study* );
95 virtual bool deactivateModule( SUIT_Study* );
100 virtual void onModelSaved();
101 virtual void onModelOpened();
102 virtual void onModelClosed();
104 virtual void onOperationStopped( SUIT_Operation* );
105 virtual void onOperationDestroyed();
106 virtual void onShowHide();
107 virtual void onViewManagerAdded( SUIT_ViewManager* );
108 virtual void onViewManagerRemoved( SUIT_ViewManager* );
111 virtual QtxPopupMgr* popupMgr();
112 LightApp_Preferences* preferences() const;
114 virtual CAM_DataModel* createDataModel();
116 int addPreference( const QString& label );
117 int addPreference( const QString& label, const int pId, const int = -1,
118 const QString& section = QString::null,
119 const QString& param = QString::null );
120 QVariant preferenceProperty( const int, const QString& ) const;
121 void setPreferenceProperty( const int, const QString&, const QVariant& );
123 /*! Module stores operations in map. This method starts operation by id.
124 * If operation isn't in map, then it will be created by createOperation method
125 * and will be inserted to map
127 void startOperation( const int );
128 /*! Create operation by its id. You must not call this method, it will be called automatically
129 * by startOperation. Please redefine this method in current module
131 virtual LightApp_Operation* createOperation( const int ) const;
133 virtual void updateControls();
136 typedef QMap<int,LightApp_Operation*> MapOfOperation;
139 QtxPopupMgr* myPopupMgr;
140 MapOfOperation myOperations;
141 LightApp_SwitchOp* mySwitchOp;
144 int myDisplay, myErase, myDisplayOnly, myEraseAll;
148 #pragma warning ( default:4251 )