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;
37 class SALOME_LifeCycleCORBA;
42 #pragma warning( disable:4251 )
46 Description : Application containing SalomeApp module
49 class SALOMEAPP_EXPORT SalomeApp_Application : public CAM_Application
54 typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
56 enum { ModulesListId = STD_Application::UserID, NewGLViewId,
57 NewPlot2dId, NewOCCViewId, NewVTKViewId, DumpStudyId,
58 LoadScriptId, PropertiesId, PreferencesId, MRUId,
59 CatalogGenId, RegDisplayId, UserID };
62 SalomeApp_Application();
63 virtual ~SalomeApp_Application();
65 virtual QString applicationName() const;
66 virtual QString applicationVersion() const;
68 virtual CAM_Module* loadModule( const QString& );
69 virtual bool activateModule( const QString& );
71 virtual bool useStudy( const QString& );
73 SalomeApp_SelectionMgr* selectionMgr() const;
75 LogWindow* logWindow();
76 OB_Browser* objectBrowser();
77 PythonConsole* pythonConsole();
79 virtual void updateObjectBrowser( const bool = true );
81 SalomeApp_Preferences* preferences() const;
83 virtual QString getFileFilter() const;
84 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
85 const QString& caption, QWidget* parent );
86 virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
87 virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
88 const QString& caption, QWidget* parent );
90 SUIT_ViewManager* getViewManager( const QString&, const bool );
94 QWidget* getWindow( const int, const int = -1 );
96 QWidget* window( const int, const int = -1 ) const;
97 void addWindow( QWidget*, const int, const int = -1 );
98 void removeWindow( const int, const int = -1 );
100 bool isWindowVisible( const int ) const;
101 void setWindowShown( const int, const bool );
103 virtual void start();
105 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
107 virtual void createEmptyStudy();
109 SUIT_Accel* accel() const;
111 static CORBA::ORB_var orb();
112 static SALOMEDSClient_StudyManager* studyMgr();
113 static SALOME_NamingService* namingService();
114 static SALOME_LifeCycleCORBA* lcc();
115 static QString defaultEngineIOR();
123 virtual void onNewDoc();
124 virtual void onOpenDoc();
125 virtual void onHelpAbout();
126 virtual void onHelpContentsModule();
127 virtual bool onOpenDoc( const QString& );
128 virtual void onLoadDoc();
129 virtual bool onLoadDoc( const QString& );
130 virtual void onCopy();
131 virtual void onPaste();
136 void onDeleteReferences();
137 void onDblClick( QListViewItem* );
140 virtual void createActions();
141 virtual SUIT_Study* createNewStudy();
142 virtual QWidget* createWindow( const int );
143 virtual void defaultWindows( QMap<int, int>& ) const;
144 virtual void defaultViewManagers( QStringList& ) const;
146 virtual void setActiveStudy( SUIT_Study* );
148 virtual void updateCommandsStatus();
150 virtual void onSelectionChanged();
152 virtual void beforeCloseDoc( SUIT_Study* );
153 virtual void afterCloseDoc();
155 virtual void moduleAdded( CAM_Module* );
156 virtual bool activateModule( CAM_Module* = 0 );
158 SalomeApp_Preferences* preferences( const bool ) const;
160 virtual void createPreferences( SalomeApp_Preferences* );
161 virtual void preferencesChanged( const QString&, const QString& );
162 virtual void updateDesktopTitle();
165 virtual void onDesktopActivated();
169 void onModuleActivation( QAction* );
170 void onCloseView( SUIT_ViewManager* );
172 void onStudyCreated( SUIT_Study* );
173 void onStudyOpened( SUIT_Study* );
174 void onStudySaved( SUIT_Study* );
175 void onStudyClosed( SUIT_Study* );
181 void onPreferences();
182 void onMRUActivated( QString );
187 void onPreferenceChanged( QString&, QString&, QString& );
191 void updateWindows();
192 void updateViewManagers();
193 void updateModuleActions();
195 void loadWindowsGeometry();
196 void saveWindowsGeometry();
198 void updatePreference( const QString&, const QString&, const QString& );
200 QString defaultModule() const;
201 void currentWindows( QMap<int, int>& ) const;
202 void currentViewManagers( QStringList& ) const;
203 SUIT_ViewManager* createViewManager( const QString& vmType );
204 void moduleIconNames( QMap<QString, QString>& ) const;
206 void activateWindows();
209 typedef QMap<QString, QAction*> ActionMap;
210 typedef QMap<int, SalomeApp_WidgetContainer*> WindowMap;
213 SalomeApp_Preferences* myPrefs;
214 SalomeApp_SelectionMgr* mySelMgr;
220 static SalomeApp_Preferences* _prefs_;
224 #pragma warning( default:4251 )