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