1 // Copyright (C) 2006-2014 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef _QTGUICONTEXT_HXX_
21 #define _QTGUICONTEXT_HXX_
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"
34 #include <QGraphicsScene>
35 #include <QItemSelectionModel>
36 #include <QStackedWidget>
41 #include <SuitWrapper.hxx>
47 class GENERICGUI_EXPORT QtGuiContext: public GuiContext
50 QtGuiContext(YACS::HMI::GenericGui* gmain);
51 virtual ~QtGuiContext();
52 virtual void setProc(YACS::ENGINE::Proc* proc);
54 inline YACS::HMI::GenericGui* getGMain() {return _gmain; };
56 inline YACS::HMI::SchemaModel* getSchemaModel() {return _schemaModel; };
57 inline FormEditTree* getEditTree() {return _editTree; };
58 inline QGraphicsScene* getScene() {return _scene; };
59 inline YACS::HMI::GraphicsView* getView() {return _view; };
60 inline YACS::HMI::ItemEditionRoot* getEditionRoot() {return _rootEdit; };
61 inline QWidget* getWindow() {return _window; };
62 inline QItemSelectionModel* getSelectionModel() {return _selectionModel; };
63 inline QStackedWidget* getStackedWidget() {return _stackedWidget; };
64 inline QString getFileName() {return _fileName; };
65 inline YACS::HMI::GuiExecutor* getGuiExecutor() {return _guiExecutor; };
66 inline bool isEdition() {return _isEdition; };
67 inline int getStudyId() {return _studyId; };
68 inline bool isLoadingPresentation() {return _isLoadingPresentation; };
70 YACS::HMI::Subject* getSubjectToPaste(bool &isCut);
72 YACS::HMI::Subject* getSelectedSubject() {return _selectedSubject; };
74 inline void setSchemaModel(YACS::HMI::SchemaModel* model) {_schemaModel = model; };
75 inline void setEditTree(FormEditTree* editTree) {_editTree = editTree; };
76 inline void setScene(QGraphicsScene *scene) {_scene = scene; };
77 inline void setView(YACS::HMI::GraphicsView *view) {_view = view; };
78 inline void setEditionRoot(YACS::HMI::ItemEditionRoot* re) {_rootEdit = re; };
79 inline void setWindow(QWidget* window) {_window = window; };
80 inline void setSelectionModel(QItemSelectionModel* selmod) {_selectionModel = selmod; };
81 inline void setStackedWidget(QStackedWidget* sw) {_stackedWidget = sw; };
82 inline void setFileName(const QString& fileName) {_fileName = fileName; };
83 inline void setGuiExecutor(YACS::HMI::GuiExecutor* guiEx) {_guiExecutor = guiEx; };
84 inline void setEdition(bool isEdition) {_isEdition = isEdition; };
85 inline void setStudyId(int studyId) {_studyId = studyId; };
86 inline void setLoadingPresentation(bool isLoadpres) {_isLoadingPresentation = isLoadpres; };
88 void setSubjectToCut(YACS::HMI::Subject* sub);
89 void setSubjectToCopy(YACS::HMI::Subject* sub);
91 inline void setSelectedSubject(YACS::HMI::Subject* sub) {_selectedSubject = sub; };
93 inline static QtGuiContext* getQtCurrent() {return _QtCurrent; };
94 inline static void setQtCurrent(QtGuiContext* context) { _QtCurrent=context; _current=context; };
96 std::map<YACS::HMI::Subject*, YACS::HMI::SchemaItem*> _mapOfSchemaItem;
97 std::map<YACS::HMI::Subject*, YACS::HMI::SceneItem*> _mapOfSceneItem;
98 std::map<YACS::HMI::Subject*, QWidget*> _mapOfEditionItem;
99 std::set<YACS::HMI::Subject*> _setOfModifiedSubjects;
101 static std::set<QtGuiContext*> _setOfContext;
102 static counters* _counters;
103 static bool _delayCalc;
106 static QtGuiContext* _QtCurrent;
107 YACS::HMI::GenericGui* _gmain;
108 YACS::HMI::SchemaModel* _schemaModel;
109 FormEditTree* _editTree;
110 QItemSelectionModel* _selectionModel;
111 QGraphicsScene* _scene;
112 YACS::HMI::GraphicsView* _view;
113 YACS::HMI::ItemEditionRoot* _rootEdit;
115 QStackedWidget * _stackedWidget;
117 YACS::HMI::GuiExecutor *_guiExecutor;
118 YACS::HMI::Subject* _selectedSubject;
119 YACS::HMI::Subject* _subjectToCut;
120 YACS::HMI::Subject* _subjectToCopy;
122 bool _isLoadingPresentation;
124 SuitWrapper* _wrapper;