1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
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.
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.
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
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 // File: SalomeApp_Application.h
24 // Created: 10/22/2004 3:37:25 PM
25 // Author: Sergey LITONIN
27 #ifndef SALOMEAPP_APPLICATION_H
28 #define SALOMEAPP_APPLICATION_H
32 #endif // _MSC_VER > 1000
34 #include "SalomeApp.h"
35 #include <LightApp_Application.h>
37 #include <SUIT_DataObject.h>
39 #include <omniORB4/CORBA.h>
41 //#include <SALOMEconfig.h>
42 //#include CORBA_CLIENT_HEADER(SALOMEDS)
43 #include <SALOME_NamingService.hxx>
45 #include "SALOMEDSClient.hxx"
47 class LightApp_Preferences;
48 class SalomeApp_Study;
49 class SalomeApp_NoteBook;
53 class SALOME_LifeCycleCORBA;
57 #pragma warning( disable:4251 )
61 \class SalomeApp_Application
62 \brief Application containing SalomeApp module or LightApp module
65 class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
70 enum { MenuToolsId = 5 };
71 enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
72 CatalogGenId, RegDisplayId, SaveGUIStateId, FileLoadId, UserID };
74 typedef enum { WT_NoteBook = LightApp_Application::WT_User } WindowTypes;
77 enum { OpenRefresh = LightApp_Application::OpenReload + 1 };
78 enum { CloseUnload = LightApp_Application::CloseDiscard + 1 };
79 enum { LoadStudyId = LightApp_Application::OpenStudyId + 1, NewAndScriptId };
82 SalomeApp_Application();
83 virtual ~SalomeApp_Application();
85 virtual void updateObjectBrowser( const bool = true );
87 virtual QString getFileFilter() const;
91 virtual void contextMenuPopup( const QString&, QMenu*, QString& );
93 virtual bool checkDataObject(LightApp_DataObject* theObj);
95 virtual void setDesktop( SUIT_Desktop* );
97 static CORBA::ORB_var orb();
98 static SALOMEDSClient_StudyManager* studyMgr();
99 static SALOME_NamingService* namingService();
100 static SALOME_LifeCycleCORBA* lcc();
102 SUIT_ViewManager* newViewManager(const QString&);
103 void updateSavePointDataObjects( SalomeApp_Study* );
105 virtual bool isPossibleToClose( bool& );
107 virtual bool useStudy( const QString& );
108 virtual void updateDesktopTitle();
109 virtual void currentWindows( QMap<int, int>& ) const;
111 virtual void setNoteBook(SalomeApp_NoteBook* theNoteBook);
112 virtual SalomeApp_NoteBook* getNoteBook() const;
114 //! update visibility state of objects
115 void updateVisibilityState( DataObjectList& theList,
116 SUIT_ViewModel* theViewModel );
118 virtual bool renameAllowed( const QString& ) const;
119 virtual bool renameObject( const QString&, const QString& );
122 virtual void onLoadDoc();
123 virtual void onNewWithScript();
124 virtual bool onLoadDoc( const QString& );
125 virtual void onCloseDoc( bool ask = true);
127 virtual void onExit();
128 virtual void onCopy();
129 virtual void onPaste();
130 void onSaveGUIState();// called from VISU
131 void onUpdateStudy(); // called from NoteBook
132 bool onRestoreStudy( const QString& theDumpScript,
133 const QString& theStudyName,
134 bool theIsStudySaved );
137 void onStudyCreated( SUIT_Study* );
138 void onStudySaved( SUIT_Study* );
139 void onStudyOpened( SUIT_Study* );
140 void onStudyClosed( SUIT_Study* );
142 void onViewManagerRemoved( SUIT_ViewManager* );
145 virtual void createActions();
146 virtual SUIT_Study* createNewStudy();
147 virtual QWidget* createWindow( const int );
149 virtual void updateCommandsStatus();
150 virtual void onSelectionChanged();
152 virtual void createPreferences( LightApp_Preferences* );
154 virtual bool closeAction( const int, bool& );
155 virtual int closeChoice( const QString& );
157 virtual int openChoice( const QString& );
158 virtual bool openAction( const int, const QString& );
160 virtual QMap<int, QString> activateModuleActions() const;
161 virtual void moduleActionSelected( const int );
163 virtual void defaultWindows( QMap<int, int>& ) const;
165 void objectBrowserColumnsVisibility();
169 virtual void closeApplication();
172 void onDeleteInvalidReferences();
173 void onDblClick( SUIT_DataObject* );
178 void onDeleteGUIState();
179 void onRestoreGUIState();
186 void onWindowActivated( SUIT_ViewWindow* theViewWindow );
189 void createExtraActions();
192 SalomeApp_NoteBook* myNoteBook;
193 QMap<QString, QAction*> myExtActions; // Map <AttributeUserID, QAction>
196 void dumpedStudyClosed( const QString& theDumpScript,
197 const QString& theStudyName,
198 bool theIsStudySaved );
199 void notebookVarUpdated( QString theVarName );
204 #pragma warning( default:4251 )