Salome HOME
updated copyright message
[modules/shaper.git] / src / ModelAPI / 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
35 /// Message that style of visualization of parameter is changed.
36 /// It will be shown as expression or value
37 class ModelAPI_EventReentrantMessage : public Events_Message
38 {
39 public:
40   /// Creates an empty message
41   MODELAPI_EXPORT ModelAPI_EventReentrantMessage(const Events_ID theID,
42                                                  const void* theSender);
43   /// The virtual destructor
44   MODELAPI_EXPORT virtual ~ModelAPI_EventReentrantMessage() {}
45   /// Static. Returns EventID of the message.
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
52   /// Fills previous feature parameter
53   MODELAPI_EXPORT void setCreatedFeature(const std::shared_ptr<ModelAPI_Feature>& theFeature)
54   { myCreatedFeature = theFeature; }
55
56   /// Returns previous feature parameter
57   MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Feature>& createdFeature() const
58   { return myCreatedFeature; }
59
60   /// Fills selected object parameter
61   /// \theObject a feature or result
62   MODELAPI_EXPORT void setSelectedObject(const std::shared_ptr<ModelAPI_Object>& theObject)
63   { mySelectedObject = theObject; }
64
65   /// Returns selected object parameter
66   MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Object>& selectedObject() const
67   { return mySelectedObject; }
68
69   /// Fills selected attribute parameter
70   /// \theAttribute
71   MODELAPI_EXPORT void setSelectedAttribute
72                                   (const std::shared_ptr<ModelAPI_Attribute>& theAttribute)
73   { mySelectedAttribute = theAttribute; }
74
75   /// Returns selected attribute parameter
76   MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Attribute>& selectedAttribute()
77   { return mySelectedAttribute; }
78
79   /// Fills clicked point
80   /// \thePoint
81   MODELAPI_EXPORT void setClickedPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
82   { myClickedPoint = thePoint; }
83
84   /// Returns clicked point
85   MODELAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt2d>& clickedPoint()
86   { return myClickedPoint; }
87
88 private:
89   std::shared_ptr<ModelAPI_Feature> myCreatedFeature; ///< previous object
90   std::shared_ptr<ModelAPI_Object> mySelectedObject; ///< selected object
91   std::shared_ptr<ModelAPI_Attribute> mySelectedAttribute; ///< selected attribute
92   std::shared_ptr<GeomAPI_Pnt2d> myClickedPoint; ///< clicked point
93 };
94
95 typedef std::shared_ptr<ModelAPI_EventReentrantMessage> ReentrantMessagePtr;
96
97
98 #endif