1 // File: LightApp_Application.h
2 // Created: 6/20/2005 18:39:25 PM
4 // Copyright (C) CEA 2005
6 #ifndef LIGHTAPP_APPLICATION_H
7 #define LIGHTAPP_APPLICATION_H
11 #endif // _MSC_VER > 1000
14 #include <CAM_Application.h>
18 #ifndef DISABLE_PYCONSOLE
21 class STD_Application;
22 class LightApp_WidgetContainer;
23 class LightApp_Preferences;
24 class LightApp_SelectionMgr;
35 #pragma warning( disable:4251 )
39 Description : Application containing only LightApp module
42 class LIGHTAPP_EXPORT LightApp_Application : public CAM_Application
47 typedef enum { WT_ObjectBrowser,
48 #ifndef DISABLE_PYCONSOLE
55 enum { MenuWindowId = 6 };
57 enum { RenameId = CAM_Application::UserID,
59 #ifndef DISABLE_GLVIEWER
63 #ifndef DISABLE_PLOT2DVIEWER
67 #ifndef DISABLE_OCCVIEWER
71 #ifndef DISABLE_VTKVIEWER
75 PreferencesId, MRUId, UserID };
77 LightApp_Application();
78 virtual ~LightApp_Application();
80 virtual QString applicationName() const;
81 virtual QString applicationVersion() const;
83 virtual CAM_Module* loadModule( const QString& );
84 virtual bool activateModule( const QString& );
86 virtual bool useStudy( const QString& );
88 LightApp_SelectionMgr* selectionMgr() const;
90 LogWindow* logWindow();
91 OB_Browser* objectBrowser();
92 #ifndef DISABLE_PYCONSOLE
93 PythonConsole* pythonConsole();
96 virtual void updateObjectBrowser( const bool = true );
98 LightApp_Preferences* preferences() const;
100 virtual QString getFileFilter() const;
102 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
103 const QString& caption, QWidget* parent );
104 virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
105 virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
106 const QString& caption, QWidget* parent );
108 void updateActions();
110 SUIT_ViewManager* getViewManager( const QString&, const bool );
111 virtual void addViewManager( SUIT_ViewManager* );
112 virtual void removeViewManager( SUIT_ViewManager* );
113 QWidget* getWindow( const int, const int = -1 );
114 QWidget* window( const int, const int = -1 ) const;
115 void addWindow( QWidget*, const int, const int = -1 );
116 void removeWindow( const int, const int = -1 );
118 bool isWindowVisible( const int ) const;
119 void setWindowShown( const int, const bool );
121 virtual void start();
123 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
125 virtual void createEmptyStudy();
127 SUIT_Accel* accel() const;
129 void setDefaultStudyName( const QString& theName );
131 static int studyId();
133 virtual bool event( QEvent* );
141 virtual void onHelpContentsModule();
142 virtual void onHelpContextModule( const QString&, const QString& );
143 virtual void onNewDoc();
144 virtual void onOpenDoc();
145 virtual void onHelpAbout();
146 virtual bool onOpenDoc( const QString& );
147 virtual bool onLoadDoc( const QString& );
150 virtual void createActions();
151 virtual void createActionForViewer( const int id,
153 const QString& suffix,
155 virtual SUIT_Study* createNewStudy();
156 virtual QWidget* createWindow( const int );
157 virtual void defaultWindows( QMap<int, int>& ) const;
158 void defaultViewManagers( QStringList& ) const;
160 virtual void setActiveStudy( SUIT_Study* );
161 virtual void updateCommandsStatus();
162 virtual void onSelectionChanged();
164 virtual void beforeCloseDoc( SUIT_Study* );
165 virtual void afterCloseDoc();
166 virtual void moduleAdded( CAM_Module* );
167 virtual bool activateModule( CAM_Module* = 0 );
169 LightApp_Preferences* preferences( const bool ) const;
170 virtual void createPreferences( LightApp_Preferences* );
171 virtual void preferencesChanged( const QString&, const QString& );
172 virtual void savePreferences();
173 virtual void updateDesktopTitle();
176 virtual void onDesktopActivated();
179 void onModuleActivation( QAction* );
180 void onCloseView( SUIT_ViewManager* );
182 void onStudyCreated( SUIT_Study* );
183 void onStudyOpened( SUIT_Study* );
184 void onStudySaved( SUIT_Study* );
185 void onStudyClosed( SUIT_Study* );
187 void onWCDestroyed( QObject* );
192 void onPreferences();
193 void onMRUActivated( QString );
194 void onPreferenceChanged( QString&, QString&, QString& );
195 void onRenameWindow();
196 void onVisibilityChanged( bool );
199 void updateWindows();
200 void updateViewManagers();
201 void updateModuleActions();
203 void loadWindowsGeometry();
204 void saveWindowsGeometry();
206 void updatePreference( const QString&, const QString&, const QString& );
208 QString defaultModule() const;
209 void currentWindows( QMap<int, int>& ) const;
210 void currentViewManagers( QStringList& ) const;
211 virtual SUIT_ViewManager* createViewManager( const QString& vmType );
212 void moduleIconNames( QMap<QString, QString>& ) const;
214 void activateWindows();
215 bool isLibExists( const QString& ) const;
218 typedef QMap<QString, QAction*> ActionMap;
219 typedef QMap<int, LightApp_WidgetContainer*> WindowMap;
220 typedef QMap<int, bool> WindowVisibilityMap;
223 LightApp_Preferences* myPrefs;
224 LightApp_SelectionMgr* mySelMgr;
227 WindowVisibilityMap myWindowsVisible;
231 static LightApp_Preferences* _prefs_;
233 static int lastStudyId;
237 #pragma warning( default:4251 )