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 CONFIG_FEATUREMESSAGE_H
22 #define CONFIG_FEATUREMESSAGE_H
24 #include <Config_def.h>
25 #include <Events_Message.h>
30 * \class Config_FeatureMessage
32 * \brief Class to pass a feature entry extracted from xml file.
33 * Example of the feature entry:
35 * <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
38 class Config_FeatureMessage : public Events_Message
40 std::string myId; ///<Feature unique id
41 std::string myText; ///<Represents action's text
42 std::string myTooltip; ///<Represents action's tooltip
43 std::string myIcon; ///<Represents action's icon
44 std::string myKeysequence; ///<Represents action's key sequence
46 std::string myGroupId; ///<Id of feature's group
47 std::string myWorkbenchId; ///<Id of feature's workbench
48 std::string myDocumentKind; ///< kind of the document of the workbench (all documents if empty)
49 std::string myPluginLibrary; ///<Name of feature's library
51 bool myUseInput; ///<Action is being checked until user commit the operation
52 bool myInternal; ///<Internal feature without GUI representation
53 bool myModal; ///<True if the feature has to be represented by modal dialog box
54 bool myIsAutoPreview; ///< Preview computation is performed automatically
56 std::string myNestedFeatures; ///<Space separated list of child features
57 std::string myActionsWhenNested; ///<Space separated list of actions
60 /// Event ID that feature is loaded in workbench (GUI)
61 inline static const char* GUI_EVENT()
63 static const char * MY_GUI_EVENT_ID("WorkshopFeatureLoaded");
64 return MY_GUI_EVENT_ID;
66 /// Event ID that feature is loaded in workbench (Model)
67 inline static const char* MODEL_EVENT()
69 static const char * MY_MODEL_EVENT_ID("ModelFeatureLoaded");
70 return MY_MODEL_EVENT_ID;
73 /// Constructs Config_FeatureMessage
74 CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0);
75 /// Deletes Config_FeatureMessage
76 CONFIG_EXPORT virtual ~Config_FeatureMessage();
78 //Auto-generated getters/setters
80 CONFIG_EXPORT const std::string& id() const;
82 CONFIG_EXPORT const std::string& icon() const;
83 /// Feature's shortcut
84 CONFIG_EXPORT const std::string& keysequence() const;
86 CONFIG_EXPORT const std::string& text() const;
88 CONFIG_EXPORT const std::string& tooltip() const;
89 /// Id of Feature's Group
90 CONFIG_EXPORT const std::string& groupId() const;
91 /// Id of Feature's Workbench
92 CONFIG_EXPORT const std::string& workbenchId() const;
93 /// Kind of a document which contains the feature
94 CONFIG_EXPORT const std::string& documentKind() const;
95 /// Name of a library which contains the feature
96 CONFIG_EXPORT const std::string& pluginLibrary() const;
97 /// Space separated list of nested features
98 CONFIG_EXPORT const std::string& nestedFeatures() const;
99 /// Space separated list of actions
100 CONFIG_EXPORT const std::string& actionsWhenNested() const;
101 /// If false - feature has no Property panel representation
102 CONFIG_EXPORT bool isUseInput() const;
103 /// If true - feature will not be added into the workbench
104 CONFIG_EXPORT bool isInternal() const;
105 /// If true - the feature will be represented by modal dialog box GUI
106 CONFIG_EXPORT bool isModal() const;
108 /// If true - preview of the feature is done by any modification of the feature attributes
109 CONFIG_EXPORT bool isAutoPreview() const;
112 CONFIG_EXPORT void setId(const std::string& id);
113 ///Set feature's Icon
114 CONFIG_EXPORT void setIcon(const std::string& icon);
115 ///Set feature's shortcut
116 CONFIG_EXPORT void setKeysequence(const std::string& keysequence);
117 ///Set feature's text
118 CONFIG_EXPORT void setText(const std::string& text);
119 ///Set feature's tooltip
120 CONFIG_EXPORT void setTooltip(const std::string& tooltip);
121 ///Set id of Feature's Group
122 CONFIG_EXPORT void setGroupId(const std::string& groupId);
123 ///Set id of Feature's Workbench
124 CONFIG_EXPORT void setWorkbenchId(const std::string& workbenchId);
125 ///Set kind of a document which contains the feature
126 CONFIG_EXPORT void setDocumentKind(const std::string& documentKind);
127 ///Set name of a library which contains the feature
128 CONFIG_EXPORT void setPluginLibrary(const std::string& thePluginLibrary);
129 ///Set space separated list of nested features
130 CONFIG_EXPORT void setNestedFeatures(const std::string& theNestedFeatures);
131 ///Set space separated list of nested features
132 CONFIG_EXPORT void setActionsWhenNested(const std::string& theActions);
133 ///Set use input state; If false - feature has no Property panel representation
134 CONFIG_EXPORT void setUseInput(bool isUseInput);
135 ///Set internal state; If true - feature will not be added into the workbench
136 CONFIG_EXPORT void setInternal(bool isInternal);
137 ///Set auto preview state; If true - preview of the feature is computed automatically
138 CONFIG_EXPORT void setAutoPreview(bool isAutoPreview);
139 ///Set modality state; If true - the feature will be represented by modal dialog box GUI
140 CONFIG_EXPORT void setModal(bool isModal);
143 #endif // CONFIG_MESSAGE_H