1 // Copyright (C) 2007-2012 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
23 // File: LightApp_Module.h
24 // Created: 6/20/2005 16:25:06 AM
27 #ifndef LIGHTAPP_MODULE_H
28 #define LIGHTAPP_MODULE_H
31 #include "LightApp_Preferences.h"
32 #include <CAM_Module.h>
34 #include <SUIT_DataObject.h>
36 class LightApp_Application;
37 class LightApp_Selection;
38 class LightApp_Operation;
39 class LightApp_SwitchOp;
40 class LightApp_Displayer;
41 class LightApp_SelectionMgr;
44 //class SUIT_DataObject;
46 class SUIT_ViewManager;
47 class CAM_Application;
55 #pragma warning ( disable:4251 )
59 \class LightApp_Module
60 Base class for all light modules
63 class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
68 LightApp_Module( const QString& );
69 virtual ~LightApp_Module();
71 virtual void initialize( CAM_Application* );
72 virtual void windows( QMap<int, int>& ) const;
73 virtual void viewManagers( QStringList& ) const;
75 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
77 virtual void createPreferences();
79 LightApp_Application* getApp() const;
81 virtual void update( const int );
82 // Update viewer or/and object browser etc. in accordance with update flags
83 // (see SalomeApp_UpdateFlags enumeration). Derived modules can redefine this method
84 // for their own purposes
86 virtual void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
87 // Update object browser (for updating model or whole object browser use update() method)
89 virtual void selectionChanged();
90 virtual void preferencesChanged( const QString&, const QString& );
91 virtual void message( const QString& );
93 virtual void studyActivated() {};
95 virtual LightApp_Displayer* displayer();
96 virtual LightApp_Selection* createSelection() const;
98 virtual bool canCopy() const;
99 virtual bool canPaste() const;
100 virtual bool isDraggable( const SUIT_DataObject* ) const;
101 virtual bool isDropAccepted( const SUIT_DataObject* ) const;
102 virtual void dropObjects( const DataObjectList&, SUIT_DataObject*,
103 const int, Qt::DropAction );
105 virtual void paste();
106 virtual bool renameAllowed( const QString& ) const;
107 virtual bool renameObject( const QString&, const QString& );
110 virtual bool activateModule( SUIT_Study* );
111 virtual bool deactivateModule( SUIT_Study* );
116 virtual void onModelSaved();
117 virtual void onModelOpened();
118 virtual void onModelClosed();
120 virtual void onOperationStopped( SUIT_Operation* );
121 virtual void onOperationDestroyed();
122 virtual void onShowHide();
123 virtual void onViewManagerAdded( SUIT_ViewManager* );
124 virtual void onViewManagerRemoved( SUIT_ViewManager* );
127 virtual QtxPopupMgr* popupMgr();
128 LightApp_Preferences* preferences() const;
130 virtual CAM_DataModel* createDataModel();
132 virtual bool reusableOperation( const int id );
134 int addPreference( const QString& label );
135 int addPreference( const QString& label, const int pId,
136 const int type = LightApp_Preferences::Auto,
137 const QString& section = QString(),
138 const QString& param = QString() );
139 QVariant preferenceProperty( const int, const QString& ) const;
140 void setPreferenceProperty( const int, const QString&, const QVariant& );
142 /*! Module stores operations in map. This method starts operation by id.
143 * If operation isn't in map, then it will be created by createOperation method
144 * and will be inserted to map
146 void startOperation( const int );
147 /*! Create operation by its id. You must not call this method, it will be called automatically
148 * by startOperation. Please redefine this method in current module
150 virtual LightApp_Operation* createOperation( const int ) const;
152 virtual void updateControls();
154 virtual bool isSelectionCompatible();
156 LightApp_Operation* operation( const int ) const;
159 typedef QMap<int,LightApp_Operation*> MapOfOperation;
162 QtxPopupMgr* myPopupMgr;
163 MapOfOperation myOperations;
164 LightApp_SwitchOp* mySwitchOp;
167 int myDisplay, myErase, myDisplayOnly, myEraseAll;
171 #pragma warning ( default:4251 )