1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
3 #ifndef XGUI_WORKSHOP_LISTENER_H
4 #define XGUI_WORKSHOP_LISTENER_H
7 #include <Events_Listener.h>
8 #include <Events_Message.h>
10 #include <ModelAPI_Feature.h>
14 class Config_FeatureMessage;
16 class ModelAPI_ObjectUpdatedMessage;
19 class ModuleBase_IWorkshop;
23 /**\class XGUI_WorkshopListener
25 * \brief Class which process the events from the event loop.
27 class XGUI_EXPORT XGUI_WorkshopListener : public QObject, public Events_Listener
31 /// Constructor. Used only if the workshop is launched in Salome environment
32 /// \param theWorkshop a reference to workshop.
33 XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop);
34 virtual ~XGUI_WorkshopListener();
36 /// Register this class in the events loop for several types of events
37 void initializeEventListening();
39 //! Redefinition of Events_Listener method
40 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
43 /// Emitted when error in applivation happens
44 void errorOccurred(const QString&);
47 /// Procedure to process postponed events
48 bool event(QEvent * theEvent);
50 /// Process feature update message
51 void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
53 /// Process feature created message
54 void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
56 /// Process feature redisplay message
57 void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
59 /// Displaus object and fit all viewer if the object is first (update viewer will not be called)
60 /// Asks the module whether the object can be displayed
61 /// \param theObj an object
62 /// \param theFirstVisualizedBody an output state whether there are not object displayed in the view
63 /// and the displayed object is a body
64 /// \return true if the object is displayed
65 bool displayObject(ObjectPtr theObj, bool& theFirstVisualizedBody);
67 /// Calls the module method of cusomize object for the feature of the current operation
68 /// Perform cusomize if the force redisplay flag is true or the list of objects contains the
69 /// current operation feature
70 /// \param theObjects a list of objects to find current operation feature if forced redisplay is false
71 /// \param theForceRedisplay a flag to customize object even always
72 /// \return true if the object is modified
73 bool customizeCurrentObject(const std::set<ObjectPtr>& theObjects, bool theForceRedisplay);
75 /// Returns the workshop
76 XGUI_Workshop* workshop() const;
79 ModuleBase_IWorkshop* myWorkshop; // the current workshop