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"
33 #include <QGraphicsScene>
34 #include <QItemSelectionModel>
35 #include <QStackedWidget>
40 #include <SuitWrapper.hxx>
48 class GENERICGUI_EXPORT QtGuiContext: public GuiContext
51 QtGuiContext(YACS::HMI::GenericGui* gmain);
52 virtual ~QtGuiContext();
53 virtual void setProc(YACS::ENGINE::Proc* proc);
55 inline YACS::HMI::GenericGui* getGMain() {return _gmain; };
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; };
71 YACS::HMI::Subject* getSubjectToPaste(bool &isCut);
73 YACS::HMI::Subject* getSelectedSubject() {return _selectedSubject; };
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; };
89 void setSubjectToCut(YACS::HMI::Subject* sub);
90 void setSubjectToCopy(YACS::HMI::Subject* sub);
92 inline void setSelectedSubject(YACS::HMI::Subject* sub) {_selectedSubject = sub; };
94 inline static QtGuiContext* getQtCurrent() {return _QtCurrent; };
95 inline static void setQtCurrent(QtGuiContext* context) { _QtCurrent=context; _current=context; };
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;
102 static std::set<QtGuiContext*> _setOfContext;
103 static counters* _counters;
104 static bool _delayCalc;
107 static QtGuiContext* _QtCurrent;
108 YACS::HMI::GenericGui* _gmain;
109 YACS::HMI::SchemaModel* _schemaModel;
110 FormEditTree* _editTree;
111 QItemSelectionModel* _selectionModel;
112 QGraphicsScene* _scene;
113 YACS::HMI::GraphicsView* _view;
114 YACS::HMI::ItemEditionRoot* _rootEdit;
116 QStackedWidget * _stackedWidget;
118 YACS::HMI::GuiExecutor *_guiExecutor;
119 YACS::HMI::Subject* _selectedSubject;
120 YACS::HMI::Subject* _subjectToCut;
121 YACS::HMI::Subject* _subjectToCopy;
123 bool _isLoadingPresentation;
125 SuitWrapper* _wrapper;