Salome HOME
Add missing resource item
[modules/gui.git] / src / LightApp / LightApp_Application.h
index 7f17879092ff70efc975cf05008fd2bc8c3ccaa9..967676ef11f12849cc4bd6573aa0a43cd36054ac 100644 (file)
@@ -1,28 +1,29 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
 //
-//  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
-//  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+// Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
 //
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
+// This library is free software; you can redistribute it and/or
+// modify it under the terms of the GNU Lesser General Public
+// License as published by the Free Software Foundation; either
+// version 2.1 of the License.
 //
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+// Lesser General Public License for more details.
 //
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+// You should have received a copy of the GNU Lesser General Public
+// License along with this library; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
 //
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
 //
+
 // File:      LightApp_Application.h
 // Created:   6/20/2005 18:39:25 PM
 // Author:    OCC team
-//
+
 #ifndef LIGHTAPP_APPLICATION_H
 #define LIGHTAPP_APPLICATION_H
 
 #endif // _MSC_VER > 1000
 
 #include "LightApp.h"
+#include <SUIT_TreeModel.h>
 #include <CAM_Application.h>
 
 #include <QPointer>
+#include <QStringList>
 
 class LogWindow;
 #ifndef DISABLE_PYCONSOLE
@@ -42,6 +45,7 @@ class PyConsole_Console;
 class LightApp_WidgetContainer;
 class LightApp_Preferences;
 class LightApp_SelectionMgr;
+class LightApp_FullScreenHelper;
 class LightApp_DataObject;
 class SUIT_DataBrowser;
 class SUIT_Study;
@@ -52,6 +56,7 @@ class QString;
 class QWidget;
 class QStringList;
 class QDockWidget;
+class QTimer;
 
 #ifdef WIN32
 #pragma warning( disable:4251 )
@@ -61,7 +66,7 @@ class QDockWidget;
   Description : Application containing only LightApp module
 */
 
-class LIGHTAPP_EXPORT LightApp_Application : public CAM_Application
+class LIGHTAPP_EXPORT LightApp_Application : public CAM_Application, public SUIT_DataSearcher
 {
   Q_OBJECT
 
@@ -77,15 +82,17 @@ public:
   enum { MenuWindowId = 6 };
 
   enum { RenameId = CAM_Application::UserID,
-        CloseId, CloseAllId, GroupAllId,
-        PreferencesId, MRUId, ModulesListId,
-         NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId, NewQxGraphViewId,
-        NewQxSceneViewId, StyleId,
-        UserID };
+         CloseId, CloseAllId, GroupAllId,
+         PreferencesId, MRUId, ModulesListId,
+         NewGLViewId, NewPlot2dId, NewOCCViewId, NewVTKViewId,
+         NewQxSceneViewId, NewGraphicsViewId, StyleId, FullScreenId,
+         UserID };
 
 protected:
   enum { NewStudyId = 1, OpenStudyId };
 
+  enum BrowsePolicy { BP_Never = 0, BP_ApplyAndClose, BP_Always };
+
 public:
   LightApp_Application();
   virtual ~LightApp_Application();
@@ -101,7 +108,7 @@ public:
   LogWindow*                          logWindow();
   SUIT_DataBrowser*                   objectBrowser();
 #ifndef DISABLE_PYCONSOLE
-  PyConsole_Console*                  pythonConsole();
+  PyConsole_Console*                  pythonConsole(const bool force = false);
 #endif
 
   virtual void                        updateObjectBrowser( const bool = true );
@@ -111,10 +118,10 @@ public:
   virtual QString                     getFileFilter() const;
 
   virtual QString                     getFileName( bool open, const QString& initial, const QString& filters,
-                                                  const QString& caption, QWidget* parent );
+                                                   const QString& caption, QWidget* parent );
   virtual QString                     getDirectory( const QString& initial, const QString& caption, QWidget* parent );
   virtual QStringList                 getOpenFileNames( const QString& initial, const QString& filters,
-                                                       const QString& caption, QWidget* parent );
+                                                        const QString& caption, QWidget* parent );
 
   void                                updateActions();
 
@@ -122,6 +129,7 @@ public:
   virtual void                        addViewManager( SUIT_ViewManager* );
   virtual void                        removeViewManager( SUIT_ViewManager* );
   virtual SUIT_ViewManager*           createViewManager( const QString& vmType );
+  virtual SUIT_ViewManager*           createViewManager( const QString& vmType, QWidget* w );
 
   QWidget*                            getWindow( const int, const int = -1 );
   QWidget*                            dockWindow( const int ) const;
@@ -135,6 +143,8 @@ public:
 
   virtual void                        createEmptyStudy();
 
+  virtual void                        setDesktop( SUIT_Desktop* );
+
   SUIT_Accel*                         accel() const;
 
   void                                setDefaultStudyName( const QString& theName );
@@ -147,11 +157,29 @@ public:
 
   virtual void                        updateDesktopTitle();
 
+  //! Returns list of view manager types which are supported by this application
+  QStringList                          viewManagersTypes() const;
+
+  //! Removes ViewManagers only of known type
+  virtual void                        clearKnownViewManagers();
+
+  virtual QString                     browseObjects( const QStringList& theEntryList,
+                                                     const bool theIsApplyAndClose = true,
+                                                     const bool theIsOptimizedBrowsing = false );
+
+  virtual SUIT_DataObject*            findObject( const QString& ) const;
+
+  virtual bool                        renameAllowed( const QString& ) const;
+  virtual bool                        renameObject( const QString&, const QString& );
+
+  void                                emitOperationFinished( const QString&, const QString&, const QStringList& );
+
 signals:
   void                                studyOpened();
   void                                studySaved();
   void                                studyClosed();
   void                                preferenceChanged( const QString&, const QString&, const QString& );
+  void                                operationFinished( const QString&, const QString&, const QStringList& );
 
 public slots:
   virtual void                        onHelpContentsModule();
@@ -160,6 +188,9 @@ public slots:
   virtual void                        onOpenDoc();
   virtual void                        onHelpAbout();
   virtual bool                        onOpenDoc( const QString& );
+  virtual void                        onCopy();
+  virtual void                        onPaste();
+  virtual void                        onSelectionChanged();
 
 protected:
   virtual void                        createActions();
@@ -174,7 +205,6 @@ protected:
 
   virtual void                        setActiveStudy( SUIT_Study* );
   virtual void                        updateCommandsStatus();
-  virtual void                        onSelectionChanged();
 
   virtual void                        beforeCloseDoc( SUIT_Study* );
   virtual void                        afterCloseDoc();
@@ -208,10 +238,14 @@ protected slots:
   void                                onMRUActivated( const QString& );
 
   void                                onStylePreferences();
+  void                                onFullScreen();
+
+  virtual void                        onDesktopMessage( const QString& );
 
 private slots:
   void                                onSelection();
   void                                onRefresh();
+  void                                onDropped( const QList<SUIT_DataObject*>&, SUIT_DataObject*, int, Qt::DropAction );
   void                                onPreferences();
   void                                onPreferenceChanged( QString&, QString&, QString& );
   void                                onRenameWindow();
@@ -223,17 +257,19 @@ protected:
   void                                updateWindows();
   void                                updateViewManagers();
   void                                updateModuleActions();
+  void                                removeModuleAction( const QString& );
 
   void                                loadDockWindowsState();
   void                                saveDockWindowsState();
 
   virtual void                        studyOpened( SUIT_Study* );
   virtual void                        studyCreated( SUIT_Study* );
+  virtual void                        studySaved( SUIT_Study* );
 
   void                                updatePreference( const QString&, const QString&, const QString& );
 
   QString                             defaultModule() const;
-  void                                currentWindows( QMap<int, int>& ) const;
+  virtual void                        currentWindows( QMap<int, int>& ) const;
   void                                currentViewManagers( QStringList& ) const;
   void                                moduleIconNames( QMap<QString, QString>& ) const;
 
@@ -250,6 +286,9 @@ protected:
 
 private:
   void                                emptyPreferences( const QString& );
+  QList<QToolBar*>                    findToolBars();
+  
+  QByteArray                          processState(QByteArray& input, const bool processWin,const bool processTb, QByteArray defaultState = QByteArray());
 
 protected:
   typedef QPointer<QWidget>         WinPtr;
@@ -263,15 +302,18 @@ protected:
   LightApp_Preferences*               myPrefs;
   LightApp_SelectionMgr*              mySelMgr;
 
+  LightApp_FullScreenHelper*          myScreenHelper;
+
   WinMap                              myWin;
   WinVis                              myWinVis;
-  WinGeom                             myWinGeom;
 
   SUIT_Accel*                         myAccel;
+  QTimer*                             myAutoSaveTimer;
 
   static LightApp_Preferences*        _prefs_;
 
   static int                          lastStudyId;
+  QStringList                         myUserWmTypes;
 };
 
 #ifdef WIN32