Salome HOME
Update from BR_V5_DEV 13Feb2009
[modules/gui.git] / src / SalomeApp / SalomeApp_Application.h
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 //  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
6 //  This library is free software; you can redistribute it and/or
7 //  modify it under the terms of the GNU Lesser General Public
8 //  License as published by the Free Software Foundation; either
9 //  version 2.1 of the License.
10 //
11 //  This library is distributed in the hope that it will be useful,
12 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 //  Lesser General Public License for more details.
15 //
16 //  You should have received a copy of the GNU Lesser General Public
17 //  License along with this library; if not, write to the Free Software
18 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
19 //
20 //  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22 // File:      SalomeApp_Application.h
23 // Created:   10/22/2004 3:37:25 PM
24 // Author:    Sergey LITONIN
25 //
26 #ifndef SALOMEAPP_APPLICATION_H
27 #define SALOMEAPP_APPLICATION_H
28
29 #if _MSC_VER > 1000
30 #pragma once
31 #endif // _MSC_VER > 1000
32
33 #include "SalomeApp.h"
34 #include <LightApp_Application.h>
35
36 #include <CORBA.h>
37
38 //#include <SALOMEconfig.h>
39 //#include CORBA_CLIENT_HEADER(SALOMEDS)
40 #include <SALOME_NamingService.hxx>
41
42 #include "SALOMEDSClient.hxx"
43
44 class LightApp_Preferences;
45 class SalomeApp_Study;
46 class SalomeApp_NoteBookDlg;
47 class SUIT_DataObject;
48
49 class SALOME_LifeCycleCORBA;
50
51
52 #ifdef WIN32
53 #pragma warning( disable:4251 )
54 #endif
55
56 /*!
57   \class SalomeApp_Application
58   \brief Application containing SalomeApp module or LightApp module
59 */
60
61 class SALOMEAPP_EXPORT SalomeApp_Application : public LightApp_Application
62 {
63   Q_OBJECT
64
65 public:
66   enum { MenuToolsId = 5 };
67   enum { DumpStudyId = LightApp_Application::UserID, LoadScriptId, PropertiesId,
68          CatalogGenId, RegDisplayId, SaveGUIStateId, FileLoadId, NoteBookId, UserID };
69
70 protected:
71   enum { OpenRefresh = LightApp_Application::OpenReload + 1 };
72   enum { CloseUnload = LightApp_Application::CloseDiscard + 1 };
73   enum { LoadStudyId = LightApp_Application::OpenStudyId + 1 };
74
75 public:
76   SalomeApp_Application();
77   virtual ~SalomeApp_Application();
78
79   virtual void                        updateObjectBrowser( const bool = true );
80
81   virtual QString                     getFileFilter() const;
82
83   virtual void                        start();
84
85   virtual void                        contextMenuPopup( const QString&, QMenu*, QString& );
86
87   virtual bool                        checkDataObject(LightApp_DataObject* theObj);
88
89   static CORBA::ORB_var               orb();
90   static SALOMEDSClient_StudyManager* studyMgr();
91   static SALOME_NamingService*        namingService();
92   static SALOME_LifeCycleCORBA*       lcc();
93   static QString                      defaultEngineIOR();
94
95   SUIT_ViewManager*                   newViewManager(const QString&);
96   void                                updateSavePointDataObjects( SalomeApp_Study* );
97
98   virtual bool                        isPossibleToClose( bool& );
99
100   virtual bool                        useStudy( const QString& );
101   virtual void                        updateDesktopTitle();
102   
103   virtual void                        setNoteBook(SalomeApp_NoteBookDlg* theNoteBook);
104   virtual SalomeApp_NoteBookDlg*      getNoteBook() const;
105
106 public slots:
107   virtual void                        onLoadDoc();
108   virtual bool                        onLoadDoc( const QString& );
109   virtual void                        onCloseDoc( bool ask = true);
110
111   virtual void                        onExit();
112   virtual void                        onCopy();
113   virtual void                        onPaste();
114   void                                onSaveGUIState();// called from VISU
115
116 protected slots:
117   void                                onStudyCreated( SUIT_Study* );
118   void                                onStudySaved( SUIT_Study* );
119   void                                onStudyOpened( SUIT_Study* );
120   void                                onDesktopMessage( const QString& );
121
122 protected:
123   virtual void                        createActions();
124   virtual SUIT_Study*                 createNewStudy();
125   virtual QWidget*                    createWindow( const int );
126
127   virtual void                        updateCommandsStatus();
128   virtual void                        onSelectionChanged();
129
130   virtual void                        createPreferences( LightApp_Preferences* );
131
132   virtual bool                        closeAction( const int, bool& );
133   virtual int                         closeChoice( const QString& );
134
135   virtual int                         openChoice( const QString& );
136   virtual bool                        openAction( const int, const QString& );
137
138   virtual QMap<int, QString>          activateModuleActions() const;
139   virtual void                        moduleActionSelected( const int );
140
141   void                                objectBrowserColumnsVisibility();
142
143 private slots:
144   void                                onDeleteInvalidReferences();
145   void                                onDblClick( SUIT_DataObject* );
146   void                                onProperties();
147   void                                onDumpStudy();
148   void                                onNoteBook();
149   void                                onLoadScript();
150
151   void                                onDeleteGUIState();
152   void                                onRestoreGUIState();
153   void                                onRenameGUIState();
154
155   void                                onCatalogGen();
156   void                                onRegDisplay();
157   void                                onOpenWith();
158
159  private:
160   SalomeApp_NoteBookDlg*             myNoteBook;
161 };
162
163 #ifdef WIN32
164 #pragma warning( default:4251 )
165 #endif
166
167 #endif