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 removeViewManager( SUIT_ViewManager* );
112 QWidget* getWindow( const int, const int = -1 );
113 QWidget* window( const int, const int = -1 ) const;
114 void addWindow( QWidget*, const int, const int = -1 );
115 void removeWindow( const int, const int = -1 );
117 bool isWindowVisible( const int ) const;
118 void setWindowShown( const int, const bool );
120 virtual void start();
122 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
124 virtual void createEmptyStudy();
126 SUIT_Accel* accel() const;
128 void setDefaultStudyName( const QString& theName );
130 static int studyId();
138 virtual void onHelpContentsModule();
139 virtual void onNewDoc();
140 virtual void onOpenDoc();
141 virtual void onHelpAbout();
142 virtual bool onOpenDoc( const QString& );
143 virtual bool onLoadDoc( const QString& );
146 virtual void createActions();
147 virtual void createActionForViewer( const int id,
149 const QString& suffix,
151 virtual SUIT_Study* createNewStudy();
152 virtual QWidget* createWindow( const int );
153 virtual void defaultWindows( QMap<int, int>& ) const;
154 void defaultViewManagers( QStringList& ) const;
156 virtual void setActiveStudy( SUIT_Study* );
157 virtual void updateCommandsStatus();
158 virtual void onSelectionChanged();
160 virtual void beforeCloseDoc( SUIT_Study* );
161 virtual void afterCloseDoc();
162 virtual void moduleAdded( CAM_Module* );
163 virtual bool activateModule( CAM_Module* = 0 );
165 LightApp_Preferences* preferences( const bool ) const;
166 virtual void createPreferences( LightApp_Preferences* );
167 virtual void preferencesChanged( const QString&, const QString& );
168 virtual void savePreferences();
169 virtual void updateDesktopTitle();
172 virtual void onDesktopActivated();
175 void onModuleActivation( QAction* );
176 void onCloseView( SUIT_ViewManager* );
178 void onStudyCreated( SUIT_Study* );
179 void onStudyOpened( SUIT_Study* );
180 void onStudySaved( SUIT_Study* );
181 void onStudyClosed( SUIT_Study* );
183 void onWCDestroyed( QObject* );
188 void onPreferences();
189 void onMRUActivated( QString );
190 void onPreferenceChanged( QString&, QString&, QString& );
191 void onRenameWindow();
194 void updateWindows();
195 void updateViewManagers();
196 void updateModuleActions();
198 void loadWindowsGeometry();
199 void saveWindowsGeometry();
201 void updatePreference( const QString&, const QString&, const QString& );
203 QString defaultModule() const;
204 void currentWindows( QMap<int, int>& ) const;
205 void currentViewManagers( QStringList& ) const;
206 virtual SUIT_ViewManager* createViewManager( const QString& vmType );
207 void moduleIconNames( QMap<QString, QString>& ) const;
209 void activateWindows();
210 bool isLibExists( const QString& ) const;
213 typedef QMap<QString, QAction*> ActionMap;
214 typedef QMap<int, LightApp_WidgetContainer*> WindowMap;
217 LightApp_Preferences* myPrefs;
218 LightApp_SelectionMgr* mySelMgr;
224 static LightApp_Preferences* _prefs_;
226 static int lastStudyId;
230 #pragma warning( default:4251 )