1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
6 * Created on: Apr 1, 2014
10 #ifndef CONFIG_WIDGETAPI_H_
11 #define CONFIG_WIDGETAPI_H_
13 #include <Config_def.h>
18 //>> Forward declaration of xmlNodePtr.
19 typedef struct _xmlNode xmlNode;
20 typedef xmlNode *xmlNodePtr;
24 //>> Forward declaration of xmlDocPtr.
25 typedef struct _xmlDoc xmlDoc;
26 typedef xmlDoc *xmlDocPtr;
31 * \class Config_WidgetAPI
33 * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets
35 class CONFIG_EXPORT Config_WidgetAPI
38 virtual ~Config_WidgetAPI();
40 //! Returns name of widget's node (attribute)
41 std::string widgetType() const;
42 //! Returns true if widget has container type, which means it able to contain other widgets
43 bool isGroupBoxWidget() const;
44 //! Returns true if widget has page type;
45 //! Page is container widget with combo box control to switch between pages
46 bool isPagedWidget() const;
48 //! Returns id of current feature
49 std::string featureId() const;
50 //! Returns id of current widget
51 std::string widgetId() const;
52 //! Returns icon of current widget
53 std::string widgetIcon() const;
54 //! Returns text for label of current widget
55 std::string widgetLabel() const;
56 //! Returns text for tooltip of current widget
57 std::string widgetTooltip() const;
58 //! Returns a custom property of current widget
59 std::string getProperty(const char* thePropName) const;
61 /*! Checks if the XML representation of widget has given attribute,
62 * if yes - returns it's bool value, if no, or if the value can not
63 * be converted to bool - returns theDefault.
64 * \param theAttributeName attribute to check
65 * \param theDefault default value on bad data
66 * \return the boolean result
68 bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const;
71 /// These fields are accessible for ModuleBase_WidgetFactory only
72 Config_WidgetAPI(std::string theRawXml);
73 //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false
75 //! Pass into the child node of widget's xml definition. If impossible, returns false
77 //! Pass into the parent node of widget's xml definition. If impossible, returns false
78 bool toParentWidget();
81 xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition
82 xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml definition
83 std::string myFeatureId;
85 friend class ModuleBase_WidgetFactory;
88 #endif /* CONFIG_WIDGETAPI_H_ */