1 // Copyright (C) 2014-2020 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #ifndef ModelAPI_EventReentrantMessage_H_
21 #define ModelAPI_EventReentrantMessage_H_
23 #include <Events_Message.h>
24 #include <Events_Loop.h>
30 class ModelAPI_Object;
31 class ModelAPI_Feature;
32 class ModelAPI_Attribute;
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
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()
48 static const char * MY_EVENT_REENTRANT_MESSAGE_ID("EventReentrantMessage");
49 return Events_Loop::eventByName(MY_EVENT_REENTRANT_MESSAGE_ID);
52 /// Fills previous feature parameter
53 MODELAPI_EXPORT void setCreatedFeature(const std::shared_ptr<ModelAPI_Feature>& theFeature)
54 { myCreatedFeature = theFeature; }
56 /// Returns previous feature parameter
57 MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Feature>& createdFeature() const
58 { return myCreatedFeature; }
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; }
65 /// Returns selected object parameter
66 MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Object>& selectedObject() const
67 { return mySelectedObject; }
69 /// Fills selected attribute parameter
71 MODELAPI_EXPORT void setSelectedAttribute
72 (const std::shared_ptr<ModelAPI_Attribute>& theAttribute)
73 { mySelectedAttribute = theAttribute; }
75 /// Returns selected attribute parameter
76 MODELAPI_EXPORT const std::shared_ptr<ModelAPI_Attribute>& selectedAttribute()
77 { return mySelectedAttribute; }
79 /// Fills clicked point
81 MODELAPI_EXPORT void setClickedPoint(const std::shared_ptr<GeomAPI_Pnt2d>& thePoint)
82 { myClickedPoint = thePoint; }
84 /// Returns clicked point
85 MODELAPI_EXPORT const std::shared_ptr<GeomAPI_Pnt2d>& clickedPoint()
86 { return myClickedPoint; }
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
95 typedef std::shared_ptr<ModelAPI_EventReentrantMessage> ReentrantMessagePtr;