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 Description : Application containing SalomeApp module
46 class SALOMEAPP_EXPORT SalomeApp_Application : public CAM_Application
51 typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
53 enum { ModulesListId = STD_Application::UserID, NewGLViewId,
54 NewPlot2dId, NewOCCViewId, NewVTKViewId, DumpStudyId,
55 LoadScriptId, PropertiesId, PreferencesId, MRUId,
56 CatalogGenId, RegDisplayId, 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 virtual void createEmptyStudy();
106 static CORBA::ORB_var orb();
107 static SALOMEDSClient_StudyManager* studyMgr();
108 static SALOME_NamingService* namingService();
109 static SALOME_LifeCycleCORBA* lcc();
110 static QString defaultEngineIOR();
118 virtual void onNewDoc();
119 virtual void onOpenDoc();
120 virtual void onHelpAbout();
121 virtual bool onOpenDoc( const QString& );
122 virtual void onLoadDoc();
123 virtual bool onLoadDoc( const QString& );
124 virtual void onCopy();
125 virtual void onPaste();
132 virtual void createActions();
133 virtual SUIT_Study* createNewStudy();
134 virtual QWidget* createWindow( const int );
135 virtual void defaultWindows( QMap<int, int>& ) const;
136 virtual void defaultViewManagers( QStringList& ) const;
138 virtual void setActiveStudy( SUIT_Study* );
140 virtual void updateCommandsStatus();
142 virtual void onSelectionChanged();
144 virtual void beforeCloseDoc( SUIT_Study* );
145 virtual void afterCloseDoc();
147 virtual void moduleAdded( CAM_Module* );
148 virtual bool activateModule( CAM_Module* = 0 );
150 SalomeApp_Preferences* preferences( const bool ) const;
152 virtual void createPreferences( SalomeApp_Preferences* );
153 virtual void preferencesChanged( const QString&, const QString& );
154 virtual void updateDesktopTitle();
157 virtual void onDesktopActivated();
161 void onModuleActivation( QAction* );
162 void onCloseView( SUIT_ViewManager* );
164 void onStudyCreated( SUIT_Study* );
165 void onStudyOpened( SUIT_Study* );
166 void onStudySaved( SUIT_Study* );
167 void onStudyClosed( SUIT_Study* );
173 void onPreferences();
174 void onMRUActivated( QString );
179 void onPreferenceChanged( QString&, QString&, QString& );
183 void updateWindows();
184 void updateViewManagers();
185 void updateModuleActions();
187 void loadWindowsGeometry();
188 void saveWindowsGeometry();
190 void updatePreference( const QString&, const QString&, const QString& );
192 QString defaultModule() const;
193 void currentWindows( QMap<int, int>& ) const;
194 void currentViewManagers( QStringList& ) const;
195 SUIT_ViewManager* createViewManager( const QString& vmType );
196 void moduleIconNames( QMap<QString, QString>& ) const;
198 void activateWindows();
201 typedef QMap<QString, QAction*> ActionMap;
202 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
205 SalomeApp_Preferences* myPrefs;
206 SalomeApp_SelectionMgr* mySelMgr;
210 static SalomeApp_Preferences* _prefs_;
214 #pragma warning( default:4251 )