1 // Copyright (C) 2006-2016 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 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 setLoadingPresentation(bool isLoadpres) {_isLoadingPresentation = isLoadpres; };
87 void setSubjectToCut(YACS::HMI::Subject* sub);
88 void setSubjectToCopy(YACS::HMI::Subject* sub);
90 inline void setSelectedSubject(YACS::HMI::Subject* sub) {_selectedSubject = sub; };
92 inline static QtGuiContext* getQtCurrent() {return _QtCurrent; };
93 inline static void setQtCurrent(QtGuiContext* context) { _QtCurrent=context; _current=context; };
95 std::map<YACS::HMI::Subject*, YACS::HMI::SchemaItem*> _mapOfSchemaItem;
96 std::map<YACS::HMI::Subject*, YACS::HMI::SceneItem*> _mapOfSceneItem;
97 std::map<YACS::HMI::Subject*, QWidget*> _mapOfEditionItem;
98 std::set<YACS::HMI::Subject*> _setOfModifiedSubjects;
100 static std::set<QtGuiContext*> _setOfContext;
101 static counters* _counters;
102 static bool _delayCalc;
105 static QtGuiContext* _QtCurrent;
106 YACS::HMI::GenericGui* _gmain;
107 YACS::HMI::SchemaModel* _schemaModel;
108 FormEditTree* _editTree;
109 QItemSelectionModel* _selectionModel;
110 QGraphicsScene* _scene;
111 YACS::HMI::GraphicsView* _view;
112 YACS::HMI::ItemEditionRoot* _rootEdit;
114 QStackedWidget * _stackedWidget;
116 YACS::HMI::GuiExecutor *_guiExecutor;
117 YACS::HMI::Subject* _selectedSubject;
119 bool _isLoadingPresentation;
120 SuitWrapper* _wrapper;