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
32 /// \param theConnector a Salome connector object.
33 /// Used only if the workshop is launched in Salome environment
34 XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop);
35 virtual ~XGUI_WorkshopListener();
37 /// Register this class in the events loop for several types of events
38 void initializeEventListening();
40 //! Redefinition of Events_Listener method
41 virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
44 /// Emitted when error in applivation happens
45 void errorOccurred(const QString&);
48 /// Procedure to process postponed events
49 bool event(QEvent * theEvent);
51 /// Process event "Add a feature"
52 void addFeature(const std::shared_ptr<Config_FeatureMessage>&);
54 /// Process feature update message
55 void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
57 /// Process feature created message
58 void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
60 /// Process feature redisplay message
61 void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
63 /// Displaus object and fit all viewer if the object is first (update viewer will not be called)
64 /// Asks the module whether the object can be displayed
65 /// \param theObj an object
66 /// \return true if the object is displayed
67 bool displayObject(ObjectPtr theObj);
69 /// Returns the workshop
70 XGUI_Workshop* workshop() const;
73 ModuleBase_IWorkshop* myWorkshop; // the current workshop