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;
36 class SALOME_LifeCycleCORBA;
39 #pragma warning( disable:4251 )
43 Class : SalomeApp_Application
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, LoadScriptId,
56 PropertiesId, PreferencesId, MRUId, UserID };
59 SalomeApp_Application();
60 virtual ~SalomeApp_Application();
62 virtual QString applicationName() const;
63 virtual QString applicationVersion() const;
65 virtual CAM_Module* loadModule( const QString& );
66 virtual bool activateModule( const QString& );
68 SalomeApp_SelectionMgr* selectionMgr() const;
70 LogWindow* logWindow();
71 OB_Browser* objectBrowser();
72 PythonConsole* pythonConsole();
74 SalomeApp_Preferences* preferences() const;
76 virtual QString getFileFilter() const;
77 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
78 const QString& caption, QWidget* parent );
80 SUIT_ViewManager* getViewManager( const QString&, const bool );
84 QWidget* getWindow( const int, const int = -1 );
86 QWidget* window( const int, const int = -1 ) const;
87 void addWindow( QWidget*, const int, const int = -1 );
88 void removeWindow( const int, const int = -1 );
90 bool isWindowVisible( const int ) const;
91 void setWindowShown( const int, const bool );
95 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
97 static CORBA::ORB_var orb();
98 static SALOMEDSClient_StudyManager* studyMgr();
99 static SALOME_NamingService* namingService();
100 static SALOME_LifeCycleCORBA* lcc();
101 static QString defaultEngineIOR();
109 virtual void onNewDoc();
110 virtual void onOpenDoc();
111 virtual void onHelpAbout();
112 virtual bool onOpenDoc( const QString& );
119 virtual void createActions();
120 virtual SUIT_Study* createNewStudy();
121 virtual QWidget* createWindow( const int );
122 virtual void defaultWindows( QMap<int, int>& ) const;
123 virtual void defaultViewManagers( QStringList& ) const;
125 virtual void setActiveStudy( SUIT_Study* );
127 virtual void updateCommandsStatus();
129 virtual void onSelectionChanged();
131 virtual void beforeCloseDoc( SUIT_Study* );
132 virtual void afterCloseDoc();
134 virtual void moduleAdded( CAM_Module* );
136 SalomeApp_Preferences* preferences( const bool ) const;
138 virtual void createPreferences( SalomeApp_Preferences* );
139 virtual void preferencesChanged( const QString&, const QString& );
143 void onModuleActivation( QAction* );
144 void onCloseView( SUIT_ViewManager* );
146 void onStudyCreated( SUIT_Study* );
147 void onStudyOpened( SUIT_Study* );
148 void onStudySaved( SUIT_Study* );
149 void onStudyClosed( SUIT_Study* );
154 void onPreferences();
155 void onMRUActivated( QString );
157 void onPreferenceChanged( QString&, QString&, QString& );
160 void updateWindows();
161 void updateViewManagers();
162 void updateModuleActions();
164 void loadWindowsGeometry();
165 void saveWindowsGeometry();
167 void updatePreference( const QString&, const QString&, const QString& );
169 QString defaultModule() const;
170 void currentWindows( QMap<int, int>& ) const;
171 void currentViewManagers( QStringList& ) const;
172 SUIT_ViewManager* createViewManager( const QString& vmType );
173 void moduleIconNames( QMap<QString, QString>& ) const;
175 void activateWindows();
178 typedef QMap<QString, QAction*> ActionMap;
179 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
182 SalomeApp_Preferences* myPrefs;
183 SalomeApp_SelectionMgr* mySelMgr;
187 static SalomeApp_Preferences* _prefs_;
191 #pragma warning( default:4251 )