Version: 6.3.1

src/LightApp/LightApp_Module.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // File:      LightApp_Module.h
00024 // Created:   6/20/2005 16:25:06 AM
00025 // Author:    OCC team
00026 //
00027 #ifndef LIGHTAPP_MODULE_H
00028 #define LIGHTAPP_MODULE_H
00029 
00030 #include "LightApp.h"
00031 #include "LightApp_Preferences.h"
00032 #include <CAM_Module.h>
00033 
00034 class LightApp_Application;
00035 class LightApp_Selection;
00036 class LightApp_Operation;
00037 class LightApp_SwitchOp;
00038 class LightApp_Displayer;
00039 class LightApp_SelectionMgr;
00040 
00041 class SUIT_Study;
00042 class SUIT_DataObject;
00043 class SUIT_Operation;
00044 class SUIT_ViewManager;
00045 class CAM_Application;
00046 
00047 class QtxPopupMgr;
00048 
00049 class QString;
00050 class QVariant;
00051 
00052 #ifdef WIN32
00053 #pragma warning ( disable:4251 )
00054 #endif
00055 
00061 class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
00062 {
00063   Q_OBJECT
00064 
00065 public:
00066   LightApp_Module( const QString& );
00067   virtual ~LightApp_Module();
00068 
00069   virtual void                        initialize( CAM_Application* );
00070   virtual void                        windows( QMap<int, int>& ) const;
00071   virtual void                        viewManagers( QStringList& ) const;
00072 
00073   virtual void                        contextMenuPopup( const QString&, QMenu*, QString& );
00074 
00075   virtual void                        createPreferences();
00076 
00077   LightApp_Application*               getApp() const;
00078 
00079   virtual void                        update( const int );
00080   // Update viewer or/and object browser etc. in accordance with update flags
00081   // ( see SalomeApp_UpdateFlags enumeration ). Derived modules can redefine this method
00082   // for their own purposes
00083 
00084   virtual void                        updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
00085   // Update object bropwser ( for updating model or whole object browser use update() method
00086   // can be used )
00087 
00088   virtual void                        selectionChanged();
00089   virtual void                        preferencesChanged( const QString&, const QString& );
00090 
00091   virtual void                        studyActivated() {};
00092 
00093   virtual LightApp_Displayer*         displayer();
00094   virtual LightApp_Selection*         createSelection() const;
00095 
00096   virtual bool                        canCopy() const;
00097   virtual bool                        canPaste() const;
00098   virtual void                        copy();
00099   virtual void                        paste();
00100   virtual bool                        renameAllowed( const QString& ) const;
00101   virtual bool                        renameObject( const QString&, const QString& );
00102 
00103   int                    createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
00104   int                    createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
00105   int                    createMenu( const int, const int, const int = -1, const int = -1 );
00106   int                    createMenu( const int, const QString&, const int = -1, const int = -1 );
00107   int                    createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
00108   int                    createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );
00109 
00110 public slots:
00111   virtual bool                        activateModule( SUIT_Study* );
00112   virtual bool                        deactivateModule( SUIT_Study* );
00113 
00114   void                                MenuItem();
00115 
00116 protected slots:
00117   virtual void                        onModelSaved();
00118   virtual void                        onModelOpened();
00119   virtual void                        onModelClosed();
00120 
00121   virtual void                        onOperationStopped( SUIT_Operation* );
00122   virtual void                        onOperationDestroyed();
00123   virtual void                        onShowHide();
00124   virtual void                        onViewManagerAdded( SUIT_ViewManager* );
00125   virtual void                        onViewManagerRemoved( SUIT_ViewManager* );
00126 
00127 protected:
00128   virtual QtxPopupMgr*                popupMgr();
00129   LightApp_Preferences*               preferences() const;
00130 
00131   virtual CAM_DataModel*              createDataModel();
00132 
00133   virtual bool                        reusableOperation( const int id );
00134 
00135   int                                 addPreference( const QString& label );
00136   int                                 addPreference( const QString& label, const int pId, const int = LightApp_Preferences::Auto,
00137                                                      const QString& section = QString(),
00138                                                      const QString& param = QString() );
00139   QVariant                            preferenceProperty( const int, const QString& ) const;
00140   void                                setPreferenceProperty( const int, const QString&, const QVariant& );
00141 
00146   void                                startOperation( const int );
00150   virtual LightApp_Operation*         createOperation( const int ) const;
00151 
00152   virtual void                        updateControls();
00153 
00154   virtual bool                        isSelectionCompatible();
00155 
00156   LightApp_Operation*                 operation( const int ) const;
00157 
00158 private:
00159   typedef QMap<int,LightApp_Operation*> MapOfOperation;
00160 
00161 private:
00162   QtxPopupMgr*          myPopupMgr;
00163   MapOfOperation        myOperations;
00164   LightApp_SwitchOp*    mySwitchOp;
00165 
00166 protected:
00167   int                   myDisplay, myErase, myDisplayOnly, myEraseAll;
00168 };
00169 
00170 #ifdef WIN32
00171 #pragma warning ( default:4251 )
00172 #endif
00173 
00174 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS