]> SALOME platform Git repositories - modules/shaper.git/blob - src/XGUI/XGUI_ModuleConnector.h
Salome HOME
Issues #2027, #2024, #2063, #2067: reentrant message to fill new operation by result...
[modules/shaper.git] / src / XGUI / XGUI_ModuleConnector.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
2
3 // File:        XGUI_ModuleConnector.h
4 // Created:     3 June 2014
5 // Author:      Vitaly Smetannikov
6
7 #ifndef XGUI_ModuleConnector_H
8 #define XGUI_ModuleConnector_H
9
10 #include "XGUI.h"
11 #include <ModuleBase_Definitions.h>
12 #include <ModuleBase_IWorkshop.h>
13
14 class XGUI_Workshop;
15 class XGUI_Displayer;
16
17 /**
18  * \ingroup GUI
19  * Implementation of IWorkshop interface which provides access to Workshop services at module level
20  */
21 class XGUI_EXPORT XGUI_ModuleConnector : public ModuleBase_IWorkshop
22 {
23 Q_OBJECT
24  public:
25    /// Constructor
26    /// \param theWorkshop a workshop
27   XGUI_ModuleConnector(XGUI_Workshop* theWorkshop);
28
29   virtual ~XGUI_ModuleConnector();
30
31   //! Returns list of currently selected data objects
32   virtual ModuleBase_ISelection* selection() const;
33
34   /// Activate sub-shapes selection (opens local context if it was not opened)
35   /// Types has to be dined according to TopAbs_ShapeEnum
36   virtual void activateSubShapesSelection(const QIntList& theTypes);
37
38   /// Activate objects in the module selection modes(opens local context)
39   virtual void activateModuleSelectionModes();
40
41   /// Deactivate sub-shapes selection (closes local context)
42   virtual void deactivateSubShapesSelection();
43
44   //! Returns instance of loaded module
45   virtual ModuleBase_IModule* module() const;
46
47   //! Returns current viewer
48   virtual ModuleBase_IViewer* viewer() const;
49
50   //! Returns property panel
51   virtual ModuleBase_IPropertyPanel* propertyPanel() const;
52
53   //! Returns error manager
54   virtual ModuleBase_IErrorMgr* errorMgr() const;
55
56   //! Returns currently active operation
57   virtual ModuleBase_Operation* currentOperation() const;
58
59   //! Returns true if the operation with id theId can be started
60   virtual bool canStartOperation(QString theId);
61
62   //! Performs the operation launch
63   //! \param theOperation an operation to be launched
64   virtual void processLaunchOperation(ModuleBase_Operation* theOperation);
65
66   //! Returns started operation by the operation identifier. The operation manager is called.
67   //! \param theId an operation id
68   //! \return an operation instance or NULL
69   virtual ModuleBase_Operation* findStartedOperation(const QString& theId);
70
71   //! Returns true if the operation with id theId can be stopped. The operation manager is called.
72   //! \param theOperation a stopped operation
73   //! \return boolean result
74   virtual bool canStopOperation(ModuleBase_Operation* theOperation);
75
76   //! Commits if possible or aborts the given operation.
77   //! \param theOperation an aborted operation
78   virtual void stopOperation(ModuleBase_Operation* theOperation);
79
80   //! Returns AIS object by data object
81   virtual AISObjectPtr findPresentation(const ObjectPtr& theObject) const;
82
83   //! Returns data object by AIS
84   virtual ObjectPtr findPresentedObject(const AISObjectPtr& theAIS) const;
85
86   //! Select features clearing previous selection.
87   //! If the list is empty then selection will be cleared
88   virtual void setSelected(const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theValues);
89
90   //! Shows the message in the status bar
91   //! \param theMessage a message
92   virtual void setStatusBarMessage(const QString& theMessage);
93
94    /// Update of commands status
95   virtual void updateCommandStatus();
96
97   /// Returns Information about feature defined in corresponded XML
98   /// \param theId - id of the feature
99   virtual std::shared_ptr<Config_FeatureMessage> featureInfo(const QString& theId) const;
100
101   /// Return application main window
102   virtual QMainWindow* desktop() const;
103
104
105   //! Returns workshop
106   XGUI_Workshop* workshop() const { return myWorkshop; }
107
108 private:
109   QObjectPtrList activeObjects(const QObjectPtrList& theObjList) const;
110
111   /// Reference to workshop
112   XGUI_Workshop* myWorkshop;
113 };
114
115 #endif