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 virtual void updateObjectBrowser( const bool = true );
76 SalomeApp_Preferences* preferences() const;
78 virtual QString getFileFilter() const;
79 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
80 const QString& caption, QWidget* parent );
81 QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
83 SUIT_ViewManager* getViewManager( const QString&, const bool );
87 QWidget* getWindow( const int, const int = -1 );
89 QWidget* window( const int, const int = -1 ) const;
90 void addWindow( QWidget*, const int, const int = -1 );
91 void removeWindow( const int, const int = -1 );
93 bool isWindowVisible( const int ) const;
94 void setWindowShown( const int, const bool );
98 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
100 static CORBA::ORB_var orb();
101 static SALOMEDSClient_StudyManager* studyMgr();
102 static SALOME_NamingService* namingService();
103 static SALOME_LifeCycleCORBA* lcc();
104 static QString defaultEngineIOR();
112 virtual void onNewDoc();
113 virtual void onOpenDoc();
114 virtual void onHelpAbout();
115 virtual bool onOpenDoc( const QString& );
122 virtual void createActions();
123 virtual SUIT_Study* createNewStudy();
124 virtual QWidget* createWindow( const int );
125 virtual void defaultWindows( QMap<int, int>& ) const;
126 virtual void defaultViewManagers( QStringList& ) const;
128 virtual void setActiveStudy( SUIT_Study* );
130 virtual void updateCommandsStatus();
132 virtual void onSelectionChanged();
134 virtual void beforeCloseDoc( SUIT_Study* );
135 virtual void afterCloseDoc();
137 virtual void moduleAdded( CAM_Module* );
139 SalomeApp_Preferences* preferences( const bool ) const;
141 virtual void createPreferences( SalomeApp_Preferences* );
142 virtual void preferencesChanged( const QString&, const QString& );
146 void onModuleActivation( QAction* );
147 void onCloseView( SUIT_ViewManager* );
149 void onStudyCreated( SUIT_Study* );
150 void onStudyOpened( SUIT_Study* );
151 void onStudySaved( SUIT_Study* );
152 void onStudyClosed( SUIT_Study* );
157 void onPreferences();
158 void onMRUActivated( QString );
160 void onPreferenceChanged( QString&, QString&, QString& );
163 void updateWindows();
164 void updateViewManagers();
165 void updateModuleActions();
167 void loadWindowsGeometry();
168 void saveWindowsGeometry();
170 void updatePreference( const QString&, const QString&, const QString& );
172 QString defaultModule() const;
173 void currentWindows( QMap<int, int>& ) const;
174 void currentViewManagers( QStringList& ) const;
175 SUIT_ViewManager* createViewManager( const QString& vmType );
176 void moduleIconNames( QMap<QString, QString>& ) const;
178 void activateWindows();
181 typedef QMap<QString, QAction*> ActionMap;
182 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
185 SalomeApp_Preferences* myPrefs;
186 SalomeApp_SelectionMgr* mySelMgr;
190 static SalomeApp_Preferences* _prefs_;
194 #pragma warning( default:4251 )