Salome HOME
Update copyrights 2014.
[modules/yacs.git] / src / salomegui / Yacsgui.hxx
1 // Copyright (C) 2006-2014  CEA/DEN, EDF R&D
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19
20 #ifndef _YACSGUI_HXX_
21 #define _YACSGUI_HXX_
22
23 #include "SalomeWrap_Module.hxx"
24 #include "Yacsgui_Resource.hxx"
25 #include <SALOMEconfig.h>
26
27 #include <QModelIndex>
28 #include <map>
29
30 namespace YACS
31 {
32   namespace HMI
33   {
34     class GenericGui;
35     class SuitWrapper;
36     class QtGuiContext;
37   }
38 }
39
40 class SalomeApp_Application;
41 class SUIT_ViewWindow;
42
43 class Yacsgui: public SalomeWrap_Module
44 {
45   Q_OBJECT
46
47   friend class Yacsgui_Resource;
48
49 public:
50   Yacsgui();
51   virtual ~Yacsgui();
52
53   void initialize( CAM_Application* app);
54   void windows( QMap<int, int>& theMap) const;
55   virtual QString  engineIOR() const;
56
57   virtual void viewManagers( QStringList& list) const;
58   virtual void setResource(SUIT_ResourceMgr* r);
59   virtual void createPreferences();
60   virtual void preferencesChanged( const QString& sect, const QString& name );
61   virtual void loadSchema(const std::string& filename,bool edit=true, bool arrangeLocalNodes=false);
62   virtual void studyActivated();
63   
64 public slots:
65   bool deactivateModule( SUIT_Study* theStudy);
66   bool activateModule( SUIT_Study* theStudy);
67   void onDblClick(const QModelIndex& index);
68   void onCleanOnExit();
69   
70 protected slots:
71   void onWindowActivated( SUIT_ViewWindow* svw);
72   void onWindowClosed( SUIT_ViewWindow* svw);
73   void onTryClose(bool &isClosed, QxScene_ViewWindow* window);
74
75 protected:
76   virtual  CAM_DataModel* createDataModel();
77   bool createSComponent(); 
78
79   YACS::HMI::SuitWrapper* _wrapper;
80   YACS::HMI::GenericGui* _genericGui;
81   bool _selectFromTree;
82   Yacsgui_Resource* _myresource;
83   SUIT_ViewWindow* _currentSVW;
84   std::map<int, YACS::HMI::QtGuiContext*> _studyContextMap;
85   static int _oldStudyId;
86 };
87
88 #endif