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>
19 class STD_Application;
20 class LightApp_WidgetContainer;
21 class LightApp_Preferences;
22 class LightApp_SelectionMgr;
33 #pragma warning( disable:4251 )
37 Description : Application containing only LightApp module
40 class LIGHTAPP_EXPORT LightApp_Application : public CAM_Application
45 typedef enum { WT_ObjectBrowser, WT_PyConsole, WT_LogWindow, WT_User } WindowTypes;
47 enum { NewGLViewId = STD_Application::UserID, NewPlot2dId, NewOCCViewId, NewVTKViewId,
48 PreferencesId, MRUId, UserID };
50 LightApp_Application();
51 virtual ~LightApp_Application();
53 virtual QString applicationName() const;
54 virtual QString applicationVersion() const;
56 virtual CAM_Module* loadModule( const QString& );
57 virtual bool activateModule( const QString& );
59 virtual bool useStudy( const QString& );
61 LightApp_SelectionMgr* selectionMgr() const;
63 LogWindow* logWindow();
64 OB_Browser* objectBrowser();
65 PythonConsole* pythonConsole();
67 virtual void updateObjectBrowser( const bool = true );
69 LightApp_Preferences* preferences() const;
71 virtual QString getFileFilter() const;
73 virtual QString getFileName( bool open, const QString& initial, const QString& filters,
74 const QString& caption, QWidget* parent );
75 virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent );
76 virtual QStringList getOpenFileNames( const QString& initial, const QString& filters,
77 const QString& caption, QWidget* parent );
81 SUIT_ViewManager* getViewManager( const QString&, const bool );
82 QWidget* getWindow( const int, const int = -1 );
83 QWidget* window( const int, const int = -1 ) const;
84 void addWindow( QWidget*, const int, const int = -1 );
85 void removeWindow( const int, const int = -1 );
87 bool isWindowVisible( const int ) const;
88 void setWindowShown( const int, const bool );
92 virtual void contextMenuPopup( const QString&, QPopupMenu*, QString& );
94 virtual void createEmptyStudy();
96 SUIT_Accel* accel() const;
104 virtual void onHelpContentsModule();
105 virtual void onNewDoc();
106 virtual void onOpenDoc();
107 virtual void onHelpAbout();
108 virtual bool onOpenDoc( const QString& );
109 virtual bool onLoadDoc( const QString& );
112 virtual void createActions();
113 virtual SUIT_Study* createNewStudy();
114 virtual QWidget* createWindow( const int );
115 virtual void defaultWindows( QMap<int, int>& ) const;
116 void defaultViewManagers( QStringList& ) const;
118 virtual void setActiveStudy( SUIT_Study* );
119 virtual void updateCommandsStatus();
120 virtual void onSelectionChanged();
122 virtual void beforeCloseDoc( SUIT_Study* );
123 virtual void afterCloseDoc();
124 virtual void moduleAdded( CAM_Module* );
125 virtual bool activateModule( CAM_Module* = 0 );
127 LightApp_Preferences* preferences( const bool ) const;
128 virtual void createPreferences( LightApp_Preferences* );
129 virtual void preferencesChanged( const QString&, const QString& );
130 virtual void updateDesktopTitle();
133 virtual void onDesktopActivated();
136 void onModuleActivation( QAction* );
137 void onCloseView( SUIT_ViewManager* );
139 void onStudyCreated( SUIT_Study* );
140 void onStudyOpened( SUIT_Study* );
141 void onStudySaved( SUIT_Study* );
142 void onStudyClosed( SUIT_Study* );
147 void onPreferences();
148 void onMRUActivated( QString );
149 void onPreferenceChanged( QString&, QString&, QString& );
152 void updateWindows();
153 void updateViewManagers();
154 void updateModuleActions();
156 void loadWindowsGeometry();
157 void saveWindowsGeometry();
159 void updatePreference( const QString&, const QString&, const QString& );
161 QString defaultModule() const;
162 void currentWindows( QMap<int, int>& ) const;
163 void currentViewManagers( QStringList& ) const;
164 virtual SUIT_ViewManager* createViewManager( const QString& vmType );
165 void moduleIconNames( QMap<QString, QString>& ) const;
167 void activateWindows();
170 typedef QMap<QString, QAction*> ActionMap;
171 typedef QMap<int, LightApp_WidgetContainer*> WindowMap;
174 LightApp_Preferences* myPrefs;
175 LightApp_SelectionMgr* mySelMgr;
181 static LightApp_Preferences* _prefs_;
185 #pragma warning( default:4251 )