Salome HOME
76da61c77d4bc28bfed684d28332f19d37adcd84
[modules/shaper.git] / src / Config / Config_AttributeMessage.h
1 // Copyright (C) 2014-2023  CEA/DEN, EDF R&D
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 ATTRIBUTE_MESSAGE_H
21 #define ATTRIBUTE_MESSAGE_H
22
23 #include <Config_def.h>
24 #include <Config_FeatureMessage.h>
25 #include <Events_Message.h>
26
27 #include <string>
28 #include <list>
29
30 /*!
31  * \class Config_AttributeMessage
32  * \brief Class to pass an attribute's (widget's) entry info extracted from xml file.
33  * \code
34  * <widget id="tool_object" concealment="true" obligatory="0"/>
35  * \endcode
36  */
37 class Config_AttributeMessage : public Events_Message
38 {
39   std::string myAttributeId; ///< Attribute's unique id
40   std::string myFeatureId; ///< Attribute's feature's unique id
41   bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
42   bool myIsConcealment; ///< If true, conceals features used as input
43   bool myIsMainArgument; ///< Mark attribute as a main argument of the feature
44   bool myIsGeometricalSelection; ///< If true selects geometry instead of shape;
45   ///< a list of pairs, if the attribute is placed inside paged containers: (case, switch)
46   std::list<std::pair<std::string, std::string> > myCases;
47
48 public:
49   /// Same event as Config_FeatureMessage::MODEL_EVENT()
50   inline static const char* MODEL_EVENT()
51   {
52     return Config_FeatureMessage::MODEL_EVENT();
53   }
54
55   /// Constructor
56   CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, const void* theParent = 0);
57   /// Destructor
58   CONFIG_EXPORT virtual ~Config_AttributeMessage();
59
60   //Auto-generated getters/setters
61   /// Returns attribute's unique id
62   CONFIG_EXPORT const std::string& attributeId() const;
63   /// Returns attribute's feature's unique id
64   CONFIG_EXPORT const std::string& featureId() const;
65   /// Returns true if attribute is obligatory:
66   /// Required to be set by user, else it's feature is invalid.
67   CONFIG_EXPORT bool isObligatory() const;
68   /// Returns true if attribute should conceal input features
69   CONFIG_EXPORT bool isConcealment() const;
70   /// Returns true if attribute is a main argument of the feature
71   CONFIG_EXPORT bool isMainArgument() const;
72   /// Returns true if attribute selects geometry instead of shape;
73   CONFIG_EXPORT bool isGeometricalSelection() const;
74   /// Returns container of ids of pair of a case and switches
75   CONFIG_EXPORT const std::list<std::pair<std::string, std::string> >& getCases() const;
76   /// Sets ids of pair of a case and switches
77   CONFIG_EXPORT void setCases(const std::list<std::pair<std::string, std::string> >& theCases);
78
79   /// Set attribute's unique id
80   CONFIG_EXPORT void setAttributeId(const std::string& theId);
81   /// Set attribute's feature's unique id
82   CONFIG_EXPORT void setFeatureId(const std::string& id);
83   /// Set attribute's concealment state
84   CONFIG_EXPORT void setConcealment(bool isConcealment);
85   /// Set attribute's obligatory state
86   CONFIG_EXPORT void setObligatory(bool isObligatory);
87   /// Set a state that the attribute is a main argument of the feature
88   CONFIG_EXPORT void setMainArgument(bool isMainArg);
89   /// Set attribute's geometrical selection state
90   CONFIG_EXPORT void setGeometricalSelection(bool isGeometricalSelection);
91 };
92
93 #endif // ATTRIBUTE_MESSAGE_H