1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 #ifndef CONFIG_MESSAGE_H
4 #define CONFIG_MESSAGE_H
6 #include <Config_def.h>
7 #include <Events_Message.h>
12 * \class Config_FeatureMessage
14 * \brief Class to pass a feature entry extracted from xml file.
15 * Example of the feature entry:
17 * <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
20 class Config_FeatureMessage : public Events_Message
22 std::string myId; ///<Feature unique id
23 std::string myText; ///<Represents action's text
24 std::string myTooltip; ///<Represents action's tooltip
25 std::string myIcon; ///<Represents action's icon
26 std::string myKeysequence; ///<Represents action's key sequence
28 std::string myGroupId; ///<Id of feature's group
29 std::string myWorkbenchId; ///<Id of feature's workbench
30 std::string myDocumentKind; ///< kind of the document of the workbench (all documents if empty)
31 std::string myPluginLibrary; ///<Name of feature's library
33 bool myUseInput; ///<Action is being checked until user commit the operation
34 bool myInternal; ///<Internal feature without GUI representation
35 bool myModal; ///<True if the feature has to be represented by modal dialog box
36 bool myIsAutoPreview; ///< Preview computation is performed automatically
38 std::string myNestedFeatures; ///<Space separated list of child features
39 std::string myActionsWhenNested; ///<Space separated list of actions
42 /// Event ID that feature is loaded in workbench (GUI)
43 inline static const char* GUI_EVENT()
45 static const char * MY_GUI_EVENT_ID("WorkshopFeatureLoaded");
46 return MY_GUI_EVENT_ID;
48 /// Event ID that feature is loaded in workbench (Model)
49 inline static const char* MODEL_EVENT()
51 static const char * MY_MODEL_EVENT_ID("ModelFeatureLoaded");
52 return MY_MODEL_EVENT_ID;
55 /// Constructs Config_FeatureMessage
56 CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0);
57 /// Deletes Config_FeatureMessage
58 CONFIG_EXPORT virtual ~Config_FeatureMessage();
60 //Auto-generated getters/setters
62 CONFIG_EXPORT const std::string& id() const;
64 CONFIG_EXPORT const std::string& icon() const;
65 /// Feature's shortcut
66 CONFIG_EXPORT const std::string& keysequence() const;
68 CONFIG_EXPORT const std::string& text() const;
70 CONFIG_EXPORT const std::string& tooltip() const;
71 /// Id of Feature's Group
72 CONFIG_EXPORT const std::string& groupId() const;
73 /// Id of Feature's Workbench
74 CONFIG_EXPORT const std::string& workbenchId() const;
75 /// Kind of a document which contains the feature
76 CONFIG_EXPORT const std::string& documentKind() const;
77 /// Name of a library which contains the feature
78 CONFIG_EXPORT const std::string& pluginLibrary() const;
79 /// Space separated list of nested features
80 CONFIG_EXPORT const std::string& nestedFeatures() const;
81 /// Space separated list of actions
82 CONFIG_EXPORT const std::string& actionsWhenNested() const;
83 /// If false - feature has no Property panel representation
84 CONFIG_EXPORT bool isUseInput() const;
85 /// If true - feature will not be added into the workbench
86 CONFIG_EXPORT bool isInternal() const;
87 /// If true - the feature will be represented by modal dialog box GUI
88 CONFIG_EXPORT bool isModal() const;
90 /// If true - preview of the feature is done by any modification of the feature attributes
91 CONFIG_EXPORT bool isAutoPreview() const;
94 CONFIG_EXPORT void setId(const std::string& id);
96 CONFIG_EXPORT void setIcon(const std::string& icon);
97 ///Set feature's shortcut
98 CONFIG_EXPORT void setKeysequence(const std::string& keysequence);
100 CONFIG_EXPORT void setText(const std::string& text);
101 ///Set feature's tooltip
102 CONFIG_EXPORT void setTooltip(const std::string& tooltip);
103 ///Set id of Feature's Group
104 CONFIG_EXPORT void setGroupId(const std::string& groupId);
105 ///Set id of Feature's Workbench
106 CONFIG_EXPORT void setWorkbenchId(const std::string& workbenchId);
107 ///Set kind of a document which contains the feature
108 CONFIG_EXPORT void setDocumentKind(const std::string& documentKind);
109 ///Set name of a library which contains the feature
110 CONFIG_EXPORT void setPluginLibrary(const std::string& thePluginLibrary);
111 ///Set space separated list of nested features
112 CONFIG_EXPORT void setNestedFeatures(const std::string& theNestedFeatures);
113 ///Set space separated list of nested features
114 CONFIG_EXPORT void setActionsWhenNested(const std::string& theActions);
115 ///Set use input state; If false - feature has no Property panel representation
116 CONFIG_EXPORT void setUseInput(bool isUseInput);
117 ///Set internal state; If true - feature will not be added into the workbench
118 CONFIG_EXPORT void setInternal(bool isInternal);
119 ///Set auto preview state; If true - preview of the feature is computed automatically
120 CONFIG_EXPORT void setAutoPreview(bool isAutoPreview);
121 ///Set modality state; If true - the feature will be represented by modal dialog box GUI
122 CONFIG_EXPORT void setModal(bool isModal);
125 #endif // CONFIG_MESSAGE_H