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 bool onOpenDoc( const QString& );
125 virtual void onLoadDoc();
126 virtual bool onLoadDoc( const QString& );
127 virtual void onCopy();
128 virtual void onPaste();
133 void onDeleteReferences();
136 virtual void createActions();
137 virtual SUIT_Study* createNewStudy();
138 virtual QWidget* createWindow( const int );
139 virtual void defaultWindows( QMap<int, int>& ) const;
140 virtual void defaultViewManagers( QStringList& ) const;
142 virtual void setActiveStudy( SUIT_Study* );
144 virtual void updateCommandsStatus();
146 virtual void onSelectionChanged();
148 virtual void beforeCloseDoc( SUIT_Study* );
149 virtual void afterCloseDoc();
151 virtual void moduleAdded( CAM_Module* );
152 virtual bool activateModule( CAM_Module* = 0 );
154 SalomeApp_Preferences* preferences( const bool ) const;
156 virtual void createPreferences( SalomeApp_Preferences* );
157 virtual void preferencesChanged( const QString&, const QString& );
158 virtual void updateDesktopTitle();
161 virtual void onDesktopActivated();
165 void onModuleActivation( QAction* );
166 void onCloseView( SUIT_ViewManager* );
168 void onStudyCreated( SUIT_Study* );
169 void onStudyOpened( SUIT_Study* );
170 void onStudySaved( SUIT_Study* );
171 void onStudyClosed( SUIT_Study* );
177 void onPreferences();
178 void onMRUActivated( QString );
183 void onPreferenceChanged( QString&, QString&, QString& );
187 void updateWindows();
188 void updateViewManagers();
189 void updateModuleActions();
191 void loadWindowsGeometry();
192 void saveWindowsGeometry();
194 void updatePreference( const QString&, const QString&, const QString& );
196 QString defaultModule() const;
197 void currentWindows( QMap<int, int>& ) const;
198 void currentViewManagers( QStringList& ) const;
199 SUIT_ViewManager* createViewManager( const QString& vmType );
200 void moduleIconNames( QMap<QString, QString>& ) const;
202 void activateWindows();
205 typedef QMap<QString, QAction*> ActionMap;
206 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
209 SalomeApp_Preferences* myPrefs;
210 SalomeApp_SelectionMgr* mySelMgr;
216 static SalomeApp_Preferences* _prefs_;
220 #pragma warning( default:4251 )