SHAPER  9.12.0
ModelAPI_EventReentrantMessage.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 ModelAPI_EventReentrantMessage_H_
21 #define ModelAPI_EventReentrantMessage_H_
22 
23 #include <Events_Message.h>
24 #include <Events_Loop.h>
25 
26 #include <ModelAPI.h>
27 
28 #include <memory>
29 
30 class ModelAPI_Object;
31 class ModelAPI_Feature;
32 class ModelAPI_Attribute;
33 class GeomAPI_Pnt2d;
34 
38 {
39 public:
41  MODELAPI_EXPORT ModelAPI_EventReentrantMessage(const Events_ID theID,
42  const void* theSender);
44  MODELAPI_EXPORT virtual ~ModelAPI_EventReentrantMessage() {}
46  MODELAPI_EXPORT static Events_ID eventId()
47  {
48  static const char * MY_EVENT_REENTRANT_MESSAGE_ID("EventReentrantMessage");
49  return Events_Loop::eventByName(MY_EVENT_REENTRANT_MESSAGE_ID);
50  }
51 
53  MODELAPI_EXPORT void setCreatedFeature(const std::shared_ptr<ModelAPI_Feature>& theFeature)
54  { myCreatedFeature = theFeature; }
55 
57  MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Feature>& createdFeature() const
58  { return myCreatedFeature; }
59 
62  MODELAPI_EXPORT void setSelectedObject(const std::shared_ptr<ModelAPI_Object>& theObject)
63  { mySelectedObject = theObject; }
64 
66  MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Object>& selectedObject() const
67  { return mySelectedObject; }
68 
71  MODELAPI_EXPORT void setSelectedAttribute
72  (const std::shared_ptr<ModelAPI_Attribute>& theAttribute)
73  { mySelectedAttribute = theAttribute; }
74 
76  MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Attribute>& selectedAttribute()
77  { return mySelectedAttribute; }
78 
81  MODELAPI_EXPORT void setClickedPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
82  { myClickedPoint = thePoint; }
83 
85  MODELAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt2d>& clickedPoint()
86  { return myClickedPoint; }
87 
88 private:
89  std::shared_ptr<ModelAPI_Feature> myCreatedFeature;
90  std::shared_ptr<ModelAPI_Object> mySelectedObject;
91  std::shared_ptr<ModelAPI_Attribute> mySelectedAttribute;
92  std::shared_ptr<GeomAPI_Pnt2d> myClickedPoint;
93 };
94 
95 typedef std::shared_ptr<ModelAPI_EventReentrantMessage> ReentrantMessagePtr;
96 
97 
98 #endif
Identifier of the event kind.
Definition: Events_Message.h:36
static EVENTS_EXPORT Events_ID eventByName(const char *theName)
Returns the unique event by the given name.
Definition: Events_Loop.cpp:33
Message for communication between sender and listener of event.
Definition: Events_Message.h:65
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
Generic attribute of the Object.
Definition: ModelAPI_Attribute.h:34
Message that style of visualization of parameter is changed.
Definition: ModelAPI_EventReentrantMessage.h:38
MODELAPI_EXPORT const std::shared_ptr< ModelAPI_Object > & selectedObject() const
Returns selected object parameter.
Definition: ModelAPI_EventReentrantMessage.h:66
MODELAPI_EXPORT void setSelectedAttribute(const std::shared_ptr< ModelAPI_Attribute > &theAttribute)
Fills selected attribute parameter \theAttribute.
Definition: ModelAPI_EventReentrantMessage.h:72
MODELAPI_EXPORT void setCreatedFeature(const std::shared_ptr< ModelAPI_Feature > &theFeature)
Fills previous feature parameter.
Definition: ModelAPI_EventReentrantMessage.h:53
MODELAPI_EXPORT const std::shared_ptr< ModelAPI_Feature > & createdFeature() const
Returns previous feature parameter.
Definition: ModelAPI_EventReentrantMessage.h:57
MODELAPI_EXPORT void setSelectedObject(const std::shared_ptr< ModelAPI_Object > &theObject)
Fills selected object parameter \theObject a feature or result.
Definition: ModelAPI_EventReentrantMessage.h:62
MODELAPI_EXPORT const std::shared_ptr< GeomAPI_Pnt2d > & clickedPoint()
Returns clicked point.
Definition: ModelAPI_EventReentrantMessage.h:85
MODELAPI_EXPORT ModelAPI_EventReentrantMessage(const Events_ID theID, const void *theSender)
Creates an empty message.
Definition: ModelAPI_EventReentrantMessage.cpp:22
virtual MODELAPI_EXPORT ~ModelAPI_EventReentrantMessage()
The virtual destructor.
Definition: ModelAPI_EventReentrantMessage.h:44
MODELAPI_EXPORT const std::shared_ptr< ModelAPI_Attribute > & selectedAttribute()
Returns selected attribute parameter.
Definition: ModelAPI_EventReentrantMessage.h:76
static MODELAPI_EXPORT Events_ID eventId()
Static. Returns EventID of the message.
Definition: ModelAPI_EventReentrantMessage.h:46
MODELAPI_EXPORT void setClickedPoint(const std::shared_ptr< GeomAPI_Pnt2d > &thePoint)
Fills clicked point \thePoint.
Definition: ModelAPI_EventReentrantMessage.h:81
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45