Salome HOME
Issue #1659 New widget for supporting optional inputs : correction for enclosed cases.
[modules/shaper.git] / src / Config / Config_AttributeMessage.h
1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
2
3 #ifndef ATTRIBUTE_MESSAGE_H
4 #define ATTRIBUTE_MESSAGE_H
5
6 #include <Config_def.h>
7 #include <Config_FeatureMessage.h>
8 #include <Events_Message.h>
9
10 #include <string>
11 #include <list>
12
13 /*!
14  * \class Config_AttributeMessage
15  * \brief Class to pass an attribute's (widget's) entry info extracted from xml file.
16  * \code
17  * <widget id="tool_object" concealment="true" obligatory="0"/>
18  * \endcode
19  */
20 class Config_AttributeMessage : public Events_Message
21 {
22   std::string myAttributeId; ///< Attribute's unique id
23   std::string myFeatureId; ///< Attribute's feature's unique id
24   bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
25   bool myIsConcealment; ///< If true, conceals features used as input
26   ///< a list of pairs, if the attribute is placed inside paged containers: (case, switch)
27   std::list<std::pair<std::string, std::string> > myCases;
28
29 public:
30   /// Same event as Config_FeatureMessage::MODEL_EVENT()
31   inline static const char* MODEL_EVENT()
32   {
33     return Config_FeatureMessage::MODEL_EVENT();
34   }
35
36   /// Constructor
37   CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, const void* theParent = 0);
38   /// Destructor
39   CONFIG_EXPORT virtual ~Config_AttributeMessage();
40
41   //Auto-generated getters/setters
42   /// Returns attribute's unique id
43   CONFIG_EXPORT const std::string& attributeId() const;
44   /// Returns attribute's feature's unique id
45   CONFIG_EXPORT const std::string& featureId() const;
46   /// Returns true if attribute is obligatory:
47   /// Required to be set by user, else it's feature is invalid.
48   CONFIG_EXPORT bool isObligatory() const;
49   /// Returns true if attribute should conceal input features
50   CONFIG_EXPORT bool isConcealment() const;
51   /// Returns container of ids of pair of a case and switches
52   CONFIG_EXPORT const std::list<std::pair<std::string, std::string> >& getCases() const;
53   /// Sets ids of pair of a case and switches
54   CONFIG_EXPORT void setCases(const std::list<std::pair<std::string, std::string> >& theCases);
55
56   /// Set attribute's unique id
57   CONFIG_EXPORT void setAttributeId(const std::string& theId);
58   /// Set attribute's feature's unique id
59   CONFIG_EXPORT void setFeatureId(const std::string& id);
60   /// Set attribute's concealment state
61   CONFIG_EXPORT void setConcealment(bool isConcealment);
62   /// Set attribute's obligatory state
63   CONFIG_EXPORT void setObligatory(bool isObligatory);
64 };
65
66 #endif // ATTRIBUTE_MESSAGE_H