Back to index

salome-gui  6.5.0
SalomeApp_Application.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:      SalomeApp_Application.h
00024 // Created:   10/22/2004 3:37:25 PM
00025 // Author:    Sergey LITONIN
00026 //
00027 #ifndef SALOMEAPP_APPLICATION_H
00028 #define SALOMEAPP_APPLICATION_H
00029 
00030 #if _MSC_VER > 1000
00031 #pragma once
00032 #endif // _MSC_VER > 1000
00033 
00034 #include "SalomeApp.h"
00035 #include <LightApp_Application.h>
00036 
00037 #include <SUIT_DataObject.h>
00038 
00039 #include <CORBA.h>
00040 
00041 //#include <SALOMEconfig.h>
00042 //#include CORBA_CLIENT_HEADER(SALOMEDS)
00043 #include <SALOME_NamingService.hxx>
00044 
00045 #include "SALOMEDSClient.hxx"
00046 
00047 class LightApp_Preferences;
00048 class SalomeApp_Study;
00049 class SalomeApp_NoteBookDlg;
00050 class SUIT_Desktop;
00051 
00052 class SUIT_ViewModel;
00053 class SALOME_LifeCycleCORBA;
00054 
00055 
00056 #ifdef WIN32
00057 #pragma warning( disable:4251 )
00058 #endif
00059 
00065 class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
00066 {
00067   Q_OBJECT
00068 
00069 public:
00070   enum { MenuToolsId = 5 };
00071   enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
00072          CatalogGenId, RegDisplayId, SaveGUIStateId, FileLoadId, NoteBookId, UserID };
00073 
00074 protected:
00075   enum { OpenRefresh = LightApp_Application::OpenReload + 1 };
00076   enum { CloseUnload = LightApp_Application::CloseDiscard + 1 };
00077   enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId };
00078 
00079 public:
00080   SalomeApp_Application();
00081   virtual ~SalomeApp_Application();
00082 
00083   virtual void                        updateObjectBrowser( const bool = true );
00084 
00085   virtual QString                     getFileFilter() const;
00086 
00087   virtual void                        start();
00088 
00089   virtual void                        contextMenuPopup( const QString&, QMenu*, QString& );
00090 
00091   virtual bool                        checkDataObject(LightApp_DataObject* theObj);
00092 
00093   virtual void                        setDesktop( SUIT_Desktop* );
00094 
00095   static CORBA::ORB_var               orb();
00096   static SALOMEDSClient_StudyManager* studyMgr();
00097   static SALOME_NamingService*        namingService();
00098   static SALOME_LifeCycleCORBA*       lcc();
00099 
00100   SUIT_ViewManager*                   newViewManager(const QString&);
00101   void                                updateSavePointDataObjects( SalomeApp_Study* );
00102 
00103   virtual bool                        isPossibleToClose( bool& );
00104 
00105   virtual bool                        useStudy( const QString& );
00106   virtual void                        updateDesktopTitle();
00107   
00108   virtual void                        setNoteBook(SalomeApp_NoteBookDlg* theNoteBook);
00109   virtual SalomeApp_NoteBookDlg*      getNoteBook() const;
00110 
00112   void                                updateVisibilityState( DataObjectList& theList,
00113                                                              SUIT_ViewModel* theViewModel );  
00114 
00115   virtual bool                        renameAllowed( const QString& ) const;
00116   virtual bool                        renameObject( const QString&, const QString& );
00117   
00118 public slots:
00119   virtual void                        onLoadDoc();
00120   virtual void                        onNewWithScript();
00121   virtual bool                        onLoadDoc( const QString& );
00122   virtual void                        onCloseDoc( bool ask = true);
00123 
00124   virtual void                        onExit();
00125   virtual void                        onCopy();
00126   virtual void                        onPaste();
00127   void                                onSaveGUIState();// called from VISU
00128 
00129 protected slots:
00130   void                                onStudyCreated( SUIT_Study* );
00131   void                                onStudySaved( SUIT_Study* );
00132   void                                onStudyOpened( SUIT_Study* );
00133   void                                onStudyClosed( SUIT_Study* );
00134   
00135   void                                onViewManagerRemoved( SUIT_ViewManager* );
00136 
00137 protected:
00138   virtual void                        createActions();
00139   virtual SUIT_Study*                 createNewStudy();
00140   virtual QWidget*                    createWindow( const int );
00141 
00142   virtual void                        updateCommandsStatus();
00143   virtual void                        onSelectionChanged();
00144 
00145   virtual void                        createPreferences( LightApp_Preferences* );
00146 
00147   virtual bool                        closeAction( const int, bool& );
00148   virtual int                         closeChoice( const QString& );
00149 
00150   virtual int                         openChoice( const QString& );
00151   virtual bool                        openAction( const int, const QString& );
00152 
00153   virtual QMap<int, QString>          activateModuleActions() const;
00154   virtual void                        moduleActionSelected( const int );
00155 
00156   void                                objectBrowserColumnsVisibility();
00157 
00158 private slots:
00159   void                                onDeleteInvalidReferences();
00160   void                                onDblClick( SUIT_DataObject* );
00161   void                                onProperties();
00162   void                                onDumpStudy();
00163   void                                onNoteBook();
00164   void                                onLoadScript();
00165 
00166   void                                onDeleteGUIState();
00167   void                                onRestoreGUIState();
00168 
00169   void                                onCatalogGen();
00170   void                                onRegDisplay();
00171   void                                onOpenWith();
00172   void                                onExtAction();
00173 
00174   void                                onWindowActivated( SUIT_ViewWindow* theViewWindow );
00175 
00176 private:
00177   void                                createExtraActions();
00178 
00179 private:
00180   SalomeApp_NoteBookDlg*              myNoteBook;
00181   QMap<QString, QAction*>             myExtActions; // Map <AttributeUserID, QAction>
00182 };
00183 
00184 #ifdef WIN32
00185 #pragma warning( default:4251 )
00186 #endif
00187 
00188 #endif