Version: 8.3.0
QtGuiContext.hxx
Go to the documentation of this file.
1 // Copyright (C) 2006-2016 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 _QTGUICONTEXT_HXX_
21 #define _QTGUICONTEXT_HXX_
22 
23 #include "GenericGuiExport.hxx"
24 #include "guiContext.hxx"
25 #include "SchemaModel.hxx"
26 #include "SchemaItem.hxx"
27 #include "SceneItem.hxx"
28 #include "ItemEdition.hxx"
29 #include "GenericGui.hxx"
30 #include "FormEditTree.hxx"
31 #include "GraphicsView.hxx"
32 #include "GuiExecutor.hxx"
33 #include <QGraphicsScene>
34 #include <QItemSelectionModel>
35 #include <QStackedWidget>
36 #include <QWidget>
37 #include <QString>
38 #include <set>
39 
40 #include <SuitWrapper.hxx>
41 
42 class counters;
43 
44 namespace YACS
45 {
46  namespace HMI
47  {
49  {
50  public:
52  virtual ~QtGuiContext();
53  virtual void setProc(YACS::ENGINE::Proc* proc);
54 
55  inline YACS::HMI::GenericGui* getGMain() {return _gmain; };
56 
57  inline YACS::HMI::SchemaModel* getSchemaModel() {return _schemaModel; };
58  inline FormEditTree* getEditTree() {return _editTree; };
59  inline QGraphicsScene* getScene() {return _scene; };
60  inline YACS::HMI::GraphicsView* getView() {return _view; };
61  inline YACS::HMI::ItemEditionRoot* getEditionRoot() {return _rootEdit; };
62  inline QWidget* getWindow() {return _window; };
63  inline QItemSelectionModel* getSelectionModel() {return _selectionModel; };
64  inline QStackedWidget* getStackedWidget() {return _stackedWidget; };
65  inline QString getFileName() {return _fileName; };
66  inline YACS::HMI::GuiExecutor* getGuiExecutor() {return _guiExecutor; };
67  inline bool isEdition() {return _isEdition; };
68  inline int getStudyId() {return _studyId; };
69  inline bool isLoadingPresentation() {return _isLoadingPresentation; };
70 
71  YACS::HMI::Subject* getSubjectToPaste(bool &isCut);
72 
73  YACS::HMI::Subject* getSelectedSubject() {return _selectedSubject; };
74 
75  inline void setSchemaModel(YACS::HMI::SchemaModel* model) {_schemaModel = model; };
76  inline void setEditTree(FormEditTree* editTree) {_editTree = editTree; };
77  inline void setScene(QGraphicsScene *scene) {_scene = scene; };
78  inline void setView(YACS::HMI::GraphicsView *view) {_view = view; };
79  inline void setEditionRoot(YACS::HMI::ItemEditionRoot* re) {_rootEdit = re; };
80  inline void setWindow(QWidget* window) {_window = window; };
81  inline void setSelectionModel(QItemSelectionModel* selmod) {_selectionModel = selmod; };
82  inline void setStackedWidget(QStackedWidget* sw) {_stackedWidget = sw; };
83  inline void setFileName(const QString& fileName) {_fileName = fileName; };
84  inline void setGuiExecutor(YACS::HMI::GuiExecutor* guiEx) {_guiExecutor = guiEx; };
85  inline void setEdition(bool isEdition) {_isEdition = isEdition; };
86  inline void setStudyId(int studyId) {_studyId = studyId; };
87  inline void setLoadingPresentation(bool isLoadpres) {_isLoadingPresentation = isLoadpres; };
88 
89  void setSubjectToCut(YACS::HMI::Subject* sub);
90  void setSubjectToCopy(YACS::HMI::Subject* sub);
91 
92  inline void setSelectedSubject(YACS::HMI::Subject* sub) {_selectedSubject = sub; };
93 
94  inline static QtGuiContext* getQtCurrent() {return _QtCurrent; };
95  inline static void setQtCurrent(QtGuiContext* context) { _QtCurrent=context; _current=context; };
96 
97  std::map<YACS::HMI::Subject*, YACS::HMI::SchemaItem*> _mapOfSchemaItem;
98  std::map<YACS::HMI::Subject*, YACS::HMI::SceneItem*> _mapOfSceneItem;
99  std::map<YACS::HMI::Subject*, QWidget*> _mapOfEditionItem;
100  std::set<YACS::HMI::Subject*> _setOfModifiedSubjects;
101 
102  static std::set<QtGuiContext*> _setOfContext;
104  static bool _delayCalc;
105 
106  protected:
111  QItemSelectionModel* _selectionModel;
116  QStackedWidget * _stackedWidget;
117  QString _fileName;
122  int _studyId;
124  };
125 
126  }
127 }
128 #endif