Version: 6.3.1

src/SalomeApp/SalomeApp_Application.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:      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   static QString                      defaultEngineIOR();
00100 
00101   SUIT_ViewManager*                   newViewManager(const QString&);
00102   void                                updateSavePointDataObjects( SalomeApp_Study* );
00103 
00104   virtual bool                        isPossibleToClose( bool& );
00105 
00106   virtual bool                        useStudy( const QString& );
00107   virtual void                        updateDesktopTitle();
00108   
00109   virtual void                        setNoteBook(SalomeApp_NoteBookDlg* theNoteBook);
00110   virtual SalomeApp_NoteBookDlg*      getNoteBook() const;
00111 
00113   void                                updateVisibilityState( DataObjectList& theList,
00114                                                              SUIT_ViewModel* theViewModel );  
00115 
00116   virtual bool                        renameAllowed( const QString& ) const;
00117   virtual bool                        renameObject( const QString&, const QString& );
00118   
00119 public slots:
00120   virtual void                        onLoadDoc();
00121   virtual void                        onNewWithScript();
00122   virtual bool                        onLoadDoc( const QString& );
00123   virtual void                        onCloseDoc( bool ask = true);
00124 
00125   virtual void                        onExit();
00126   virtual void                        onCopy();
00127   virtual void                        onPaste();
00128   void                                onSaveGUIState();// called from VISU
00129 
00130 protected slots:
00131   void                                onStudyCreated( SUIT_Study* );
00132   void                                onStudySaved( SUIT_Study* );
00133   void                                onStudyOpened( SUIT_Study* );
00134   void                                onDesktopMessage( const QString& );
00135   void                                onStudyClosed( SUIT_Study* );
00136   
00137   void                                onViewManagerRemoved( SUIT_ViewManager* );
00138 
00139 protected:
00140   virtual void                        createActions();
00141   virtual SUIT_Study*                 createNewStudy();
00142   virtual QWidget*                    createWindow( const int );
00143 
00144   virtual void                        updateCommandsStatus();
00145   virtual void                        onSelectionChanged();
00146 
00147   virtual void                        createPreferences( LightApp_Preferences* );
00148 
00149   virtual bool                        closeAction( const int, bool& );
00150   virtual int                         closeChoice( const QString& );
00151 
00152   virtual int                         openChoice( const QString& );
00153   virtual bool                        openAction( const int, const QString& );
00154 
00155   virtual QMap<int, QString>          activateModuleActions() const;
00156   virtual void                        moduleActionSelected( const int );
00157 
00158   void                                objectBrowserColumnsVisibility();
00159 
00160 private slots:
00161   void                                onDeleteInvalidReferences();
00162   void                                onDblClick( SUIT_DataObject* );
00163   void                                onProperties();
00164   void                                onDumpStudy();
00165   void                                onNoteBook();
00166   void                                onLoadScript();
00167 
00168   void                                onDeleteGUIState();
00169   void                                onRestoreGUIState();
00170 
00171   void                                onCatalogGen();
00172   void                                onRegDisplay();
00173   void                                onOpenWith();
00174   void                                onExtAction();
00175 
00176   void                                onWindowActivated( SUIT_ViewWindow* theViewWindow );
00177 
00178 private:
00179   void                                createExtraActions();
00180 
00181 private:
00182   SalomeApp_NoteBookDlg*              myNoteBook;
00183   QMap<QString, QAction*>             myExtActions; // Map <AttributeUserID, QAction>
00184 };
00185 
00186 #ifdef WIN32
00187 #pragma warning( default:4251 )
00188 #endif
00189 
00190 #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