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
32 * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets
34 class CONFIG_EXPORT Config_WidgetAPI
37 virtual ~Config_WidgetAPI();
39 //! Returns name of widget's node (attribute)
40 std::string widgetType() const;
41 //! Returns true if widget has container type, which means it able to contain other widgets
42 bool isContainerWidget() const;
43 //! Returns true if widget has page type;
44 //! Page is container widget with combo box control to switch between pages
45 bool isPagedWidget() const;
47 //! Returns id of current widget
48 std::string widgetId() const;
49 //! Returns icon of current widget
50 std::string widgetIcon() const;
51 //! Returns text for label of current widget
52 std::string widgetLabel() const;
53 //! Returns text for tooltip of current widget
54 std::string widgetTooltip() const;
55 //! Returns a custom property of current widget
56 std::string getProperty(const char* thePropName) const;
58 /*! Checks if the XML representation of widget has given attribute,
59 * if yes - returns it's bool value, if no, or if the value can not
60 * be converted to bool - returns theDefault.
61 * \param theAttributeName attribute to check
62 * \param theDefault default value on bad data
63 * \return the boolean result
65 bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const;
68 /// These fields are accessible for ModuleBase_WidgetFactory only
69 Config_WidgetAPI(std::string theRawXml);
70 //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false
72 //! Pass into the child node of widget's xml definition. If impossible, returns false
74 //! Pass into the parent node of widget's xml definition. If impossible, returns false
75 bool toParentWidget();
78 xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition
79 xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml definition
81 friend class ModuleBase_WidgetFactory;
84 #endif /* CONFIG_WIDGETAPI_H_ */