Back to index

salome-gui  6.5.0
LightApp_Module.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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 #include <SUIT_DataObject.h>
00035 
00036 class LightApp_Application;
00037 class LightApp_Selection;
00038 class LightApp_Operation;
00039 class LightApp_SwitchOp;
00040 class LightApp_Displayer;
00041 class LightApp_SelectionMgr;
00042 
00043 class SUIT_Study;
00044 //class SUIT_DataObject;
00045 class SUIT_Operation;
00046 class SUIT_ViewManager;
00047 class CAM_Application;
00048 
00049 class QtxPopupMgr;
00050 
00051 class QString;
00052 class QVariant;
00053 
00054 #ifdef WIN32
00055 #pragma warning ( disable:4251 )
00056 #endif
00057 
00063 class LIGHTAPP_EXPORT LightApp_Module : public CAM_Module
00064 {
00065   Q_OBJECT
00066 
00067 public:
00068   LightApp_Module( const QString& );
00069   virtual ~LightApp_Module();
00070 
00071   virtual void                        initialize( CAM_Application* );
00072   virtual void                        windows( QMap<int, int>& ) const;
00073   virtual void                        viewManagers( QStringList& ) const;
00074 
00075   virtual void                        contextMenuPopup( const QString&, QMenu*, QString& );
00076 
00077   virtual void                        createPreferences();
00078 
00079   LightApp_Application*               getApp() const;
00080 
00081   virtual void                        update( const int );
00082   // Update viewer or/and object browser etc. in accordance with update flags
00083   // (see SalomeApp_UpdateFlags enumeration). Derived modules can redefine this method
00084   // for their own purposes
00085 
00086   virtual void                        updateObjBrowser( bool = true, SUIT_DataObject* = 0 );
00087   // Update object browser (for updating model or whole object browser use update() method)
00088 
00089   virtual void                        selectionChanged();
00090   virtual void                        preferencesChanged( const QString&, const QString& );
00091   virtual void                        message( const QString& );
00092 
00093   virtual void                        studyActivated() {};
00094 
00095   virtual LightApp_Displayer*         displayer();
00096   virtual LightApp_Selection*         createSelection() const;
00097 
00098   virtual bool                        canCopy() const;
00099   virtual bool                        canPaste() const;
00100   virtual bool                        isDraggable( const SUIT_DataObject* ) const;
00101   virtual bool                        isDropAccepted( const SUIT_DataObject* ) const;
00102   virtual void                        dropObjects( const DataObjectList&, SUIT_DataObject*,
00103                                              const int, Qt::DropAction );
00104   virtual void                        copy();
00105   virtual void                        paste();
00106   virtual bool                        renameAllowed( const QString& ) const;
00107   virtual bool                        renameObject( const QString&, const QString& );
00108 
00109   int                    createMenu( const QString&, const int, const int = -1, const int = -1, const int = -1 );
00110   int                    createMenu( const QString&, const QString&, const int = -1, const int = -1, const int = -1 );
00111   int                    createMenu( const int, const int, const int = -1, const int = -1 );
00112   int                    createMenu( const int, const QString&, const int = -1, const int = -1 );
00113   int                    createMenu( QAction*, const int, const int = -1, const int = -1, const int = -1 );
00114   int                    createMenu( QAction*, const QString&, const int = -1, const int = -1, const int = -1 );
00115 
00116 public slots:
00117   virtual bool                        activateModule( SUIT_Study* );
00118   virtual bool                        deactivateModule( SUIT_Study* );
00119 
00120   void                                MenuItem();
00121 
00122 protected slots:
00123   virtual void                        onModelSaved();
00124   virtual void                        onModelOpened();
00125   virtual void                        onModelClosed();
00126 
00127   virtual void                        onOperationStopped( SUIT_Operation* );
00128   virtual void                        onOperationDestroyed();
00129   virtual void                        onShowHide();
00130   virtual void                        onViewManagerAdded( SUIT_ViewManager* );
00131   virtual void                        onViewManagerRemoved( SUIT_ViewManager* );
00132 
00133 protected:
00134   virtual QtxPopupMgr*                popupMgr();
00135   LightApp_Preferences*               preferences() const;
00136 
00137   virtual CAM_DataModel*              createDataModel();
00138 
00139   virtual bool                        reusableOperation( const int id );
00140 
00141   int                                 addPreference( const QString& label );
00142   int                                 addPreference( const QString& label, const int pId,
00143                                                      const int type = LightApp_Preferences::Auto,
00144                                                      const QString& section = QString(),
00145                                                      const QString& param = QString() );
00146   QVariant                            preferenceProperty( const int, const QString& ) const;
00147   void                                setPreferenceProperty( const int, const QString&, const QVariant& );
00148 
00153   void                                startOperation( const int );
00157   virtual LightApp_Operation*         createOperation( const int ) const;
00158 
00159   virtual void                        updateControls();
00160 
00161   virtual bool                        isSelectionCompatible();
00162 
00163   LightApp_Operation*                 operation( const int ) const;
00164 
00165 private:
00166   typedef QMap<int,LightApp_Operation*> MapOfOperation;
00167 
00168 private:
00169   QtxPopupMgr*          myPopupMgr;
00170   MapOfOperation        myOperations;
00171   LightApp_SwitchOp*    mySwitchOp;
00172 
00173 protected:
00174   int                   myDisplay, myErase, myDisplayOnly, myEraseAll;
00175 };
00176 
00177 #ifdef WIN32
00178 #pragma warning ( default:4251 )
00179 #endif
00180 
00181 #endif