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 virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
82 virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
83 const QString& caption, QWidget* parent );
85 SUIT_ViewManager* getViewManager( const QString&, const bool );
89 QWidget* getWindow( const int, const int = -1 );
91 QWidget* window( const int, const int = -1 ) const;
92 void addWindow( QWidget*, const int, const int = -1 );
93 void removeWindow( const int, const int = -1 );
95 bool isWindowVisible( const int ) const;
96 void setWindowShown( const int, const bool );
100 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
102 static CORBA::ORB_var orb();
103 static SALOMEDSClient_StudyManager* studyMgr();
104 static SALOME_NamingService* namingService();
105 static SALOME_LifeCycleCORBA* lcc();
106 static QString defaultEngineIOR();
114 virtual void onNewDoc();
115 virtual void onOpenDoc();
116 virtual void onHelpAbout();
117 virtual bool onOpenDoc( const QString& );
124 virtual void createActions();
125 virtual SUIT_Study* createNewStudy();
126 virtual QWidget* createWindow( const int );
127 virtual void defaultWindows( QMap<int, int>& ) const;
128 virtual void defaultViewManagers( QStringList& ) const;
130 virtual void setActiveStudy( SUIT_Study* );
132 virtual void updateCommandsStatus();
134 virtual void onSelectionChanged();
136 virtual void beforeCloseDoc( SUIT_Study* );
137 virtual void afterCloseDoc();
139 virtual void moduleAdded( CAM_Module* );
141 SalomeApp_Preferences* preferences( const bool ) const;
143 virtual void createPreferences( SalomeApp_Preferences* );
144 virtual void preferencesChanged( const QString&, const QString& );
148 void onModuleActivation( QAction* );
149 void onCloseView( SUIT_ViewManager* );
151 void onStudyCreated( SUIT_Study* );
152 void onStudyOpened( SUIT_Study* );
153 void onStudySaved( SUIT_Study* );
154 void onStudyClosed( SUIT_Study* );
159 void onPreferences();
160 void onMRUActivated( QString );
162 void onPreferenceChanged( QString&, QString&, QString& );
165 void updateWindows();
166 void updateViewManagers();
167 void updateModuleActions();
169 void loadWindowsGeometry();
170 void saveWindowsGeometry();
172 void updatePreference( const QString&, const QString&, const QString& );
174 QString defaultModule() const;
175 void currentWindows( QMap<int, int>& ) const;
176 void currentViewManagers( QStringList& ) const;
177 SUIT_ViewManager* createViewManager( const QString& vmType );
178 void moduleIconNames( QMap<QString, QString>& ) const;
180 void activateWindows();
183 typedef QMap<QString, QAction*> ActionMap;
184 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
187 SalomeApp_Preferences* myPrefs;
188 SalomeApp_SelectionMgr* mySelMgr;
192 static SalomeApp_Preferences* _prefs_;
196 #pragma warning( default:4251 )