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, DumpStudyId,
56 LoadScriptId,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 virtual bool useStudy( const QString& );
70 SalomeApp_SelectionMgr* selectionMgr() const;
72 LogWindow* logWindow();
73 OB_Browser* objectBrowser();
74 PythonConsole* pythonConsole();
76 virtual void updateObjectBrowser( const bool = true );
78 SalomeApp_Preferences* preferences() const;
80 virtual QString getFileFilter() const;
81 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
82 const QString& caption, QWidget* parent );
83 virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
84 virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
85 const QString& caption, QWidget* parent );
87 SUIT_ViewManager* getViewManager( const QString&, const bool );
91 QWidget* getWindow( const int, const int = -1 );
93 QWidget* window( const int, const int = -1 ) const;
94 void addWindow( QWidget*, const int, const int = -1 );
95 void removeWindow( const int, const int = -1 );
97 bool isWindowVisible( const int ) const;
98 void setWindowShown( const int, const bool );
100 virtual void start();
102 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
104 static CORBA::ORB_var orb();
105 static SALOMEDSClient_StudyManager* studyMgr();
106 static SALOME_NamingService* namingService();
107 static SALOME_LifeCycleCORBA* lcc();
108 static QString defaultEngineIOR();
116 virtual void onNewDoc();
117 virtual void onOpenDoc();
118 virtual void onHelpAbout();
119 virtual bool onOpenDoc( const QString& );
120 virtual bool onLoadDoc( const QString& );
121 virtual void onCopy();
122 virtual void onPaste();
129 virtual void createActions();
130 virtual SUIT_Study* createNewStudy();
131 virtual QWidget* createWindow( const int );
132 virtual void defaultWindows( QMap<int, int>& ) const;
133 virtual void defaultViewManagers( QStringList& ) const;
135 virtual void setActiveStudy( SUIT_Study* );
137 virtual void updateCommandsStatus();
139 virtual void onSelectionChanged();
141 virtual void beforeCloseDoc( SUIT_Study* );
142 virtual void afterCloseDoc();
144 virtual void moduleAdded( CAM_Module* );
146 SalomeApp_Preferences* preferences( const bool ) const;
148 virtual void createPreferences( SalomeApp_Preferences* );
149 virtual void preferencesChanged( const QString&, const QString& );
150 virtual void updateDesktopTitle();
153 virtual void onDesktopActivated();
157 void onModuleActivation( QAction* );
158 void onCloseView( SUIT_ViewManager* );
160 void onStudyCreated( SUIT_Study* );
161 void onStudyOpened( SUIT_Study* );
162 void onStudySaved( SUIT_Study* );
163 void onStudyClosed( SUIT_Study* );
169 void onPreferences();
170 void onMRUActivated( QString );
172 void onPreferenceChanged( QString&, QString&, QString& );
176 void updateWindows();
177 void updateViewManagers();
178 void updateModuleActions();
180 void loadWindowsGeometry();
181 void saveWindowsGeometry();
183 void updatePreference( const QString&, const QString&, const QString& );
185 QString defaultModule() const;
186 void currentWindows( QMap<int, int>& ) const;
187 void currentViewManagers( QStringList& ) const;
188 SUIT_ViewManager* createViewManager( const QString& vmType );
189 void moduleIconNames( QMap<QString, QString>& ) const;
191 void activateWindows();
194 typedef QMap<QString, QAction*> ActionMap;
195 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
198 SalomeApp_Preferences* myPrefs;
199 SalomeApp_SelectionMgr* mySelMgr;
203 static SalomeApp_Preferences* _prefs_;
207 #pragma warning( default:4251 )