1 // Copyright (C) 2014-2017 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
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef ATTRIBUTE_MESSAGE_H
22 #define ATTRIBUTE_MESSAGE_H
24 #include <Config_def.h>
25 #include <Config_FeatureMessage.h>
26 #include <Events_Message.h>
32 * \class Config_AttributeMessage
33 * \brief Class to pass an attribute's (widget's) entry info extracted from xml file.
35 * <widget id="tool_object" concealment="true" obligatory="0"/>
38 class Config_AttributeMessage : public Events_Message
40 std::string myAttributeId; ///< Attribute's unique id
41 std::string myFeatureId; ///< Attribute's feature's unique id
42 bool myIsObligatory; ///< Required to be set by user, else it's feature is invalid.
43 bool myIsConcealment; ///< If true, conceals features used as input
44 bool myIsMainArgument; ///< Mark attribute as a main argument of the feature
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;
49 /// Same event as Config_FeatureMessage::MODEL_EVENT()
50 inline static const char* MODEL_EVENT()
52 return Config_FeatureMessage::MODEL_EVENT();
56 CONFIG_EXPORT Config_AttributeMessage(const Events_ID theId, const void* theParent = 0);
58 CONFIG_EXPORT virtual ~Config_AttributeMessage();
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 container of ids of pair of a case and switches
73 CONFIG_EXPORT const std::list<std::pair<std::string, std::string> >& getCases() const;
74 /// Sets ids of pair of a case and switches
75 CONFIG_EXPORT void setCases(const std::list<std::pair<std::string, std::string> >& theCases);
77 /// Set attribute's unique id
78 CONFIG_EXPORT void setAttributeId(const std::string& theId);
79 /// Set attribute's feature's unique id
80 CONFIG_EXPORT void setFeatureId(const std::string& id);
81 /// Set attribute's concealment state
82 CONFIG_EXPORT void setConcealment(bool isConcealment);
83 /// Set attribute's obligatory state
84 CONFIG_EXPORT void setObligatory(bool isObligatory);
85 /// Set a state that the attribute is a main argument of the feature
86 CONFIG_EXPORT void setMainArgument(bool isMainArg);
89 #endif // ATTRIBUTE_MESSAGE_H