Salome HOME
f40351ea285f9db65f2baf8e796689adcc68d296
[modules/shaper.git] / src / Config / Config_FeatureMessage.h
1 // Copyright (C) 2014-2023  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
18 //
19
20 #ifndef CONFIG_FEATUREMESSAGE_H
21 #define CONFIG_FEATUREMESSAGE_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
33  * Example of the feature entry:
34  * \code
35  * <feature id="Part" text="New part" tooltip="Creates a new part" icon=":pictures/part_ico.png"/>
36  * \endcode
37  */
38 class Config_FeatureMessage : public Events_Message
39 {
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
45   std::string myHelpFile;  ///<Contains name of help file
46
47   std::string myGroupId;  ///<Id of feature's group
48   std::string myWorkbenchId;  ///<Id of feature's workbench
49   std::string myToolBarId;  ///<Id of toolbar/ By default == myWorkbenchId
50   std::string myDocumentKind;  ///< kind of the document of the workbench (all documents if empty)
51   std::string myPluginLibrary;  ///<Name of feature's library
52
53   bool myUseInput;  ///<Action is being checked until user commit the operation
54   bool myInternal;  ///<Internal feature without GUI representation
55   bool myModal;     ///<True if the feature has to be represented by modal dialog box
56   bool myIsAutoPreview; ///< Preview computation is performed automatically
57   bool myIsTitleInToolbar; ///< False if title should not be displayed in the toolbar
58   bool myHideFacesPanel; ///< Show or Hide HideFaces panel. By default is False
59   bool myAbortConfirmation; ///< Ask confirmation of abort of the feature from user
60
61   /// True if the feature can have Apply/Continue button in its property panel
62   bool myIsApplyContinue;
63
64   std::string myNestedFeatures; ///<Space separated list of child features
65   std::string myActionsWhenNested; ///<Space separated list of actions
66
67  public:
68   /// Event ID that feature is loaded in workbench (GUI)
69   inline static const char* GUI_EVENT()
70   {
71     static const char * MY_GUI_EVENT_ID("WorkshopFeatureLoaded");
72     return MY_GUI_EVENT_ID;
73   }
74   /// Event ID that feature is loaded in workbench (Model)
75   inline static const char* MODEL_EVENT()
76   {
77     static const char * MY_MODEL_EVENT_ID("ModelFeatureLoaded");
78     return MY_MODEL_EVENT_ID;
79   }
80
81   /// Constructs Config_FeatureMessage
82   CONFIG_EXPORT Config_FeatureMessage(const Events_ID theId, const void* theParent = 0);
83   /// Deletes Config_FeatureMessage
84   CONFIG_EXPORT virtual ~Config_FeatureMessage();
85
86   //Auto-generated getters/setters
87   /// Feature's Id
88   CONFIG_EXPORT const std::string& id() const;
89   /// Feature's Icon
90   CONFIG_EXPORT const std::string& icon() const;
91   /// Feature's shortcut
92   CONFIG_EXPORT const std::string& keysequence() const;
93   /// Feature's text
94   CONFIG_EXPORT const std::string& text() const;
95   /// Feature's tooltip
96   CONFIG_EXPORT const std::string& tooltip() const;
97   /// Id of Feature's Group
98   CONFIG_EXPORT const std::string& groupId() const;
99   /// Id of Feature's Toolbar
100   CONFIG_EXPORT const std::string& toolBarId() const;
101   /// Returns help file name for the feature
102   CONFIG_EXPORT const std::string& helpFileName() const;
103   /// Id of Feature's Workbench
104   CONFIG_EXPORT const std::string& workbenchId() const;
105   /// Kind of a document which contains the feature
106   CONFIG_EXPORT const std::string& documentKind() const;
107   /// Name of a library which contains the feature
108   CONFIG_EXPORT const std::string& pluginLibrary() const;
109   /// Space separated list of nested features
110   CONFIG_EXPORT const std::string& nestedFeatures() const;
111   /// Space separated list of actions
112   CONFIG_EXPORT const std::string& actionsWhenNested() const;
113   /// If false - feature has no Property panel representation
114   CONFIG_EXPORT bool isUseInput() const;
115   /// If true - feature will not be added into the workbench
116   CONFIG_EXPORT bool isInternal() const;
117   /// If true - the feature will be represented by modal dialog box GUI
118   CONFIG_EXPORT bool isModal() const;
119   /// If true - the feature can have Apply/Continue button in its property panel
120   CONFIG_EXPORT bool isApplyContinue() const;
121   /// If true - preview of the feature is done by any modification of the feature attributes
122   CONFIG_EXPORT bool isAutoPreview() const;
123   /// If true - title should normally be displayed in the toolbar
124   CONFIG_EXPORT bool isTitleInToolbar() const;
125   /// If true - then HideFaces panel has to be shown
126   CONFIG_EXPORT bool isHideFacesPanel() const;
127   CONFIG_EXPORT bool isAbortConfirmation() const;
128
129   ///Set feature's Id
130   CONFIG_EXPORT void setId(const std::string& id);
131   ///Set feature's Icon
132   CONFIG_EXPORT void setIcon(const std::string& icon);
133   ///Set feature's shortcut
134   CONFIG_EXPORT void setKeysequence(const std::string& keysequence);
135   ///Set feature's text
136   CONFIG_EXPORT void setText(const std::string& text);
137   ///Set feature's tooltip
138   CONFIG_EXPORT void setTooltip(const std::string& tooltip);
139   ///Set id of Feature's Group
140   CONFIG_EXPORT void setGroupId(const std::string& groupId);
141   ///Set id of Feature's Group
142   CONFIG_EXPORT void setToolBarId(const std::string& aId);
143   ///Set help file name
144   CONFIG_EXPORT void setHelpFileName(const std::string& aName);
145   ///Set id of Feature's Workbench
146   CONFIG_EXPORT void setWorkbenchId(const std::string& workbenchId);
147   ///Set kind of a document which contains the feature
148   CONFIG_EXPORT void setDocumentKind(const std::string& documentKind);
149   ///Set name of a library which contains the feature
150   CONFIG_EXPORT void setPluginLibrary(const std::string& thePluginLibrary);
151   ///Set space separated list of nested features
152   CONFIG_EXPORT void setNestedFeatures(const std::string& theNestedFeatures);
153   ///Set space separated list of nested features
154   CONFIG_EXPORT void setActionsWhenNested(const std::string& theActions);
155   ///Set use input state; If false - feature has no Property panel representation
156   CONFIG_EXPORT void setUseInput(bool isUseInput);
157   ///Set internal state; If true - feature will not be added into the workbench
158   CONFIG_EXPORT void setInternal(bool isInternal);
159   ///Set auto preview state; If true - preview of the feature is computed automatically
160   CONFIG_EXPORT void setAutoPreview(bool isAutoPreview);
161   ///Set modality state; If true - the feature will be represented by modal dialog box GUI
162   CONFIG_EXPORT void setModal(bool isModal);
163   ///Set flag to display title in toolbar
164   CONFIG_EXPORT void setTitleInToolbar(bool theValue);
165   ///Set flag to display title in toolbar
166   CONFIG_EXPORT void setHideFacesPanel(bool theValue);
167   ///Set flag to display title in toolbar
168   CONFIG_EXPORT void setAbortConfirmation(bool theValue);
169   ///Set Apply/Continue state;
170   ///If true - the feature can have Apply/Continue button in its property panel
171   CONFIG_EXPORT void setApplyContinue(bool isModal);
172 };
173
174 #endif // CONFIG_MESSAGE_H