Version: 8.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
LightApp_Module.h
Go to the documentation of this file.
1 // Copyright (C) 2007-2016 CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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, or (at your option) any later version.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 
23 // File: LightApp_Module.h
24 // Created: 6/20/2005 16:25:06 AM
25 // Author: OCC team
26 
27 #ifndef LIGHTAPP_MODULE_H
28 #define LIGHTAPP_MODULE_H
29 
30 #include "LightApp.h"
31 #include "LightApp_Preferences.h"
32 #include <CAM_Module.h>
33 
34 #include <SUIT_DataObject.h>
35 
37 class LightApp_Selection;
38 class LightApp_Operation;
39 class LightApp_SwitchOp;
40 class LightApp_Displayer;
42 
43 class SUIT_Study;
44 //class SUIT_DataObject;
45 class SUIT_Operation;
46 class SUIT_ViewManager;
47 class CAM_Application;
48 
49 class QtxPopupMgr;
50 
51 class QString;
52 class QVariant;
53 
54 #ifdef WIN32
55 #pragma warning ( disable:4251 )
56 #endif
57 
64 {
65  Q_OBJECT
66 
67 public:
68  LightApp_Module( const QString& );
69  virtual ~LightApp_Module();
70 
71  virtual void initialize( CAM_Application* );
72  virtual void windows( QMap<int, int>& ) const;
73  virtual void viewManagers( QStringList& ) const;
74 
75  virtual void contextMenuPopup( const QString&, QMenu*, QString& );
76 
77  virtual void createPreferences();
78 
79  LightApp_Application* getApp() const;
80 
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
85 
86  virtual void updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
87  // Update object browser (for updating model or whole object browser use update() method)
88 
89  virtual void selectionChanged();
90  virtual void preferencesChanged( const QString&, const QString& );
91  virtual void message( const QString& );
92 
93  virtual void studyActivated() {};
94 
95  virtual LightApp_Displayer* displayer();
96  virtual LightApp_Selection* createSelection() const;
97 
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 );
104  virtual void copy();
105  virtual void paste();
106  virtual bool renameAllowed( const QString& ) const;
107  virtual bool renameObject( const QString&, const QString& );
108 
109  virtual void updateModuleVisibilityState();
110 
111 public slots:
112  virtual bool activateModule( SUIT_Study* );
113  virtual bool deactivateModule( SUIT_Study* );
114  virtual void studyClosed( SUIT_Study* );
115  virtual void onObjectClicked( SUIT_DataObject*, int );
116  void onOBDestroyed();
117 
118  void MenuItem();
119 
120 protected slots:
121  virtual void onModelSaved();
122  virtual void onModelOpened();
123  virtual void onModelClosed();
124 
125  virtual void onOperationStopped( SUIT_Operation* );
126  virtual void onOperationDestroyed();
127  virtual void onShowHide();
128  virtual void onViewManagerAdded( SUIT_ViewManager* );
129  virtual void onViewManagerRemoved( SUIT_ViewManager* );
130 
131 protected:
132  virtual QtxPopupMgr* popupMgr();
133  LightApp_Preferences* preferences() const;
134 
135  virtual CAM_DataModel* createDataModel();
136 
137  virtual bool reusableOperation( const int id );
138 
139  int addPreference( const QString& label );
140  int addPreference( const QString& label, const int pId,
141  const int type = LightApp_Preferences::Auto,
142  const QString& section = QString(),
143  const QString& param = QString() );
144  QVariant preferenceProperty( const int, const QString& ) const;
145  void setPreferenceProperty( const int, const QString&, const QVariant& );
146 
151  void startOperation( const int );
155  virtual LightApp_Operation* createOperation( const int ) const;
156 
157  virtual void updateControls();
158 
159  virtual bool isSelectionCompatible();
160 
161  LightApp_Operation* operation( const int ) const;
162 
163 private:
164  typedef QMap<int,LightApp_Operation*> MapOfOperation;
165 
166 private:
170 
171 protected:
172  int myDisplay, myErase, myDisplayOnly, myEraseAll;
174 };
175 
176 #ifdef WIN32
177 #pragma warning ( default:4251 )
178 #endif
179 
180 #endif