SHAPER  9.12.0
Config_WidgetAPI.h
1 // Copyright (C) 2014-2023 CEA, EDF
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_WIDGETAPI_H_
21 #define CONFIG_WIDGETAPI_H_
22 
23 #include <Config_def.h>
24 
25 #include <cstdarg>
26 #include <string>
27 
28 //>> Forward declaration of xmlNodePtr.
29 typedef struct _xmlNode xmlNode;
30 typedef xmlNode *xmlNodePtr;
31 struct _xmlNode;
32 //<<
33 
34 //>> Forward declaration of xmlDocPtr.
35 typedef struct _xmlDoc xmlDoc;
36 typedef xmlDoc *xmlDocPtr;
37 struct _xmlDoc;
38 //<<
39 
46 {
47  public:
48  CONFIG_EXPORT virtual ~Config_WidgetAPI();
49 
51  CONFIG_EXPORT std::string widgetType() const;
53  CONFIG_EXPORT bool isGroupBoxWidget() const;
56  CONFIG_EXPORT bool isPagedWidget() const;
57 
59  CONFIG_EXPORT std::string featureId() const;
61  CONFIG_EXPORT std::string widgetId() const;
63  CONFIG_EXPORT std::string widgetIcon() const;
65  CONFIG_EXPORT std::string widgetLabel() const;
67  CONFIG_EXPORT std::string widgetTooltip() const;
69  CONFIG_EXPORT std::string getProperty(const char* thePropName) const;
70 
78  CONFIG_EXPORT bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const;
79 
81  CONFIG_EXPORT Config_WidgetAPI(std::string theRawXml, const std::string theAttributePrefix = "");
83  CONFIG_EXPORT bool toNextWidget();
85  CONFIG_EXPORT bool toChildWidget();
87  CONFIG_EXPORT bool toParentWidget();
88 
89  private:
90  xmlDocPtr myDoc;
91  xmlNodePtr myCurrentNode;
92  std::string myFeatureId;
93  std::string myAttributePrefix;
94 
95  friend class ModuleBase_WidgetFactory;
96 };
97 
98 #endif /* CONFIG_WIDGETAPI_H_ */
Provides low-level API for WidgetFactory for reading xml definitions of widgets.
Definition: Config_WidgetAPI.h:46
CONFIG_EXPORT bool toChildWidget()
Pass into the child node of widget's xml definition. If impossible, returns false.
Definition: Config_WidgetAPI.cpp:58
CONFIG_EXPORT std::string widgetLabel() const
Returns text for label of current widget.
Definition: Config_WidgetAPI.cpp:131
CONFIG_EXPORT bool getBooleanAttribute(const char *theAttributeName, bool theDefault) const
Definition: Config_WidgetAPI.cpp:111
CONFIG_EXPORT std::string featureId() const
Returns id of current feature.
Definition: Config_WidgetAPI.cpp:116
CONFIG_EXPORT bool toNextWidget()
Pass to the next (sibling) node of widget's xml definition. If impossible, returns false.
Definition: Config_WidgetAPI.cpp:42
CONFIG_EXPORT bool toParentWidget()
Pass into the parent node of widget's xml definition. If impossible, returns false.
Definition: Config_WidgetAPI.cpp:77
CONFIG_EXPORT Config_WidgetAPI(std::string theRawXml, const std::string theAttributePrefix="")
These fields are accessible for ModuleBase_WidgetFactory only.
Definition: Config_WidgetAPI.cpp:29
CONFIG_EXPORT std::string widgetId() const
Returns id of current widget.
Definition: Config_WidgetAPI.cpp:121
CONFIG_EXPORT std::string widgetType() const
Returns name of widget's node (attribute)
Definition: Config_WidgetAPI.cpp:85
CONFIG_EXPORT bool isPagedWidget() const
Returns true if widget has page type; Page is container widget with combo box control to switch betwe...
Definition: Config_WidgetAPI.cpp:100
CONFIG_EXPORT bool isGroupBoxWidget() const
Returns true if widget has container type, which means it able to contain other widgets.
Definition: Config_WidgetAPI.cpp:94
CONFIG_EXPORT std::string widgetTooltip() const
Returns text for tooltip of current widget.
Definition: Config_WidgetAPI.cpp:136
CONFIG_EXPORT std::string getProperty(const char *thePropName) const
Returns a custom property of current widget.
Definition: Config_WidgetAPI.cpp:106
CONFIG_EXPORT std::string widgetIcon() const
Returns icon of current widget.
Definition: Config_WidgetAPI.cpp:126
A class for creation of widgets instances in for property panel using XML deskription of a feature.
Definition: ModuleBase_WidgetFactory.h:41