1 // File: SalomeApp_Application.h
2 // Created: 10/22/2004 3:37:25 PM
3 // Author: Sergey LITONIN
4 // Copyright (C) CEA 2004
6 #ifndef SALOMEAPP_APPLICATION_H
7 #define SALOMEAPP_APPLICATION_H
11 #endif // _MSC_VER > 1000
13 #include "SalomeApp.h"
14 #include <CAM_Application.h>
18 #include <SALOMEconfig.h>
19 //#include CORBA_CLIENT_HEADER(SALOMEDS)
20 #include <SALOME_NamingService.hxx>
22 #include "SALOMEDSClient.hxx"
31 class SalomeApp_Module;
32 class SalomeApp_Preferences;
33 class SalomeApp_SelectionMgr;
34 class SalomeApp_WidgetContainer;
37 class SALOME_LifeCycleCORBA;
40 #pragma warning( disable:4251 )
44 Description : Application containing SalomeApp module
47 class SALOMEAPP_EXPORT SalomeApp_Application : public CAM_Application
52 typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
54 enum { ModulesListId = STD_Application::UserID, NewGLViewId,
55 NewPlot2dId, NewOCCViewId, NewVTKViewId, DumpStudyId,
56 LoadScriptId, PropertiesId, PreferencesId, MRUId,
57 CatalogGenId, RegDisplayId, UserID };
60 SalomeApp_Application();
61 virtual ~SalomeApp_Application();
63 virtual QString applicationName() const;
64 virtual QString applicationVersion() const;
66 virtual CAM_Module* loadModule( const QString& );
67 virtual bool activateModule( const QString& );
69 virtual bool useStudy( const QString& );
71 SalomeApp_SelectionMgr* selectionMgr() const;
73 LogWindow* logWindow();
74 OB_Browser* objectBrowser();
75 PythonConsole* pythonConsole();
77 virtual void updateObjectBrowser( const bool = true );
79 SalomeApp_Preferences* preferences() const;
81 virtual QString getFileFilter() const;
82 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
83 const QString& caption, QWidget* parent );
84 virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
85 virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
86 const QString& caption, QWidget* parent );
88 SUIT_ViewManager* getViewManager( const QString&, const bool );
92 QWidget* getWindow( const int, const int = -1 );
94 QWidget* window( const int, const int = -1 ) const;
95 void addWindow( QWidget*, const int, const int = -1 );
96 void removeWindow( const int, const int = -1 );
98 bool isWindowVisible( const int ) const;
99 void setWindowShown( const int, const bool );
101 virtual void start();
103 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
105 virtual void createEmptyStudy();
107 SUIT_Accel* accel() const;
109 static CORBA::ORB_var orb();
110 static SALOMEDSClient_StudyManager* studyMgr();
111 static SALOME_NamingService* namingService();
112 static SALOME_LifeCycleCORBA* lcc();
113 static QString defaultEngineIOR();
121 virtual void onNewDoc();
122 virtual void onOpenDoc();
123 virtual void onHelpAbout();
124 virtual void onHelpContentsModule();
125 virtual bool onOpenDoc( const QString& );
126 virtual void onLoadDoc();
127 virtual bool onLoadDoc( const QString& );
128 virtual void onCopy();
129 virtual void onPaste();
134 void onDeleteReferences();
137 virtual void createActions();
138 virtual SUIT_Study* createNewStudy();
139 virtual QWidget* createWindow( const int );
140 virtual void defaultWindows( QMap<int, int>& ) const;
141 virtual void defaultViewManagers( QStringList& ) const;
143 virtual void setActiveStudy( SUIT_Study* );
145 virtual void updateCommandsStatus();
147 virtual void onSelectionChanged();
149 virtual void beforeCloseDoc( SUIT_Study* );
150 virtual void afterCloseDoc();
152 virtual void moduleAdded( CAM_Module* );
153 virtual bool activateModule( CAM_Module* = 0 );
155 SalomeApp_Preferences* preferences( const bool ) const;
157 virtual void createPreferences( SalomeApp_Preferences* );
158 virtual void preferencesChanged( const QString&, const QString& );
159 virtual void updateDesktopTitle();
162 virtual void onDesktopActivated();
166 void onModuleActivation( QAction* );
167 void onCloseView( SUIT_ViewManager* );
169 void onStudyCreated( SUIT_Study* );
170 void onStudyOpened( SUIT_Study* );
171 void onStudySaved( SUIT_Study* );
172 void onStudyClosed( SUIT_Study* );
178 void onPreferences();
179 void onMRUActivated( QString );
184 void onPreferenceChanged( QString&, QString&, QString& );
188 void updateWindows();
189 void updateViewManagers();
190 void updateModuleActions();
192 void loadWindowsGeometry();
193 void saveWindowsGeometry();
195 void updatePreference( const QString&, const QString&, const QString& );
197 QString defaultModule() const;
198 void currentWindows( QMap<int, int>& ) const;
199 void currentViewManagers( QStringList& ) const;
200 SUIT_ViewManager* createViewManager( const QString& vmType );
201 void moduleIconNames( QMap<QString, QString>& ) const;
203 void activateWindows();
206 typedef QMap<QString, QAction*> ActionMap;
207 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
210 SalomeApp_Preferences* myPrefs;
211 SalomeApp_SelectionMgr* mySelMgr;
217 static SalomeApp_Preferences* _prefs_;
221 #pragma warning( default:4251 )