SHAPER  9.12.0
XGUI_WorkshopListener.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
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.
7 //
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.
12 //
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
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef XGUI_WORKSHOP_LISTENER_H
21 #define XGUI_WORKSHOP_LISTENER_H
22 
23 #include "XGUI.h"
24 #include <Events_Listener.h>
25 #include <Events_Message.h>
26 
27 #include <ModelAPI_Feature.h>
28 #include <Events_InfoMessage.h>
29 
30 #include <QObject>
31 
33 
35 class XGUI_Workshop;
36 
38 
39 class QString;
40 class Events_InfoMessage;
41 
46 class XGUI_EXPORT XGUI_WorkshopListener : public QObject, public Events_Listener
47 {
48  Q_OBJECT
49 public:
53  virtual ~XGUI_WorkshopListener();
54 
56  void initializeEventListening();
57 
59  virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
60 
61 signals:
63  void errorOccurred(std::shared_ptr<Events_InfoMessage> theMsg);
64 
65 protected:
67  bool event(QEvent * theEvent);
68 
71  void onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
72 
75  void onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
76 
79  void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
80 
83  void onFeatureEmptyPresentationMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& theMsg);
84 
91  bool displayObject(ObjectPtr theObj);
92 
100  bool customizeFeature(const std::set<ObjectPtr>& theObjects, bool theForceRedisplay);
101 
103  XGUI_Workshop* workshop() const;
104 
105 private:
106 
107  void setDisplayed(ObjectPtr theObject, const bool theIsLoadedScript, bool& theDisplayed);
108 
109  XGUI_Workshop* myWorkshop; // the current workshop
110 
111  bool myUpdatePrefs;
112 };
113 
114 #endif
Class to pass a feature entry extracted from xml file.
Definition: Config_FeatureMessage.h:39
An event message for sending a string message which has to be translated.
Definition: Events_InfoMessage.h:35
Base interface for any event listener.
Definition: Events_Listener.h:37
virtual EVENTS_EXPORT void processEvent(const std::shared_ptr< Events_Message > &theMessage)=0
This method is called by loop when the event is started to process.
Message that feature was changed (used for Object Browser update): moved, updated and deleted.
Definition: ModelAPI_Events.h:140
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
Class which process the events from the event loop.
Definition: XGUI_WorkshopListener.h:47
void errorOccurred(std::shared_ptr< Events_InfoMessage > theMsg)
Emitted when error in applivation happens.
Class which defines a configuration of the application (Workshop) and launches it.
Definition: XGUI_Workshop.h:82