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 widget
49 std::string widgetId() const;
50 //! Returns icon of current widget
51 std::string widgetIcon() const;
52 //! Returns text for label of current widget
53 std::string widgetLabel() const;
54 //! Returns text for tooltip of current widget
55 std::string widgetTooltip() const;
56 //! Returns a custom property of current widget
57 std::string getProperty(const char* thePropName) const;
59 /*! Checks if the XML representation of widget has given attribute,
60 * if yes - returns it's bool value, if no, or if the value can not
61 * be converted to bool - returns theDefault.
62 * \param theAttributeName attribute to check
63 * \param theDefault default value on bad data
64 * \return the boolean result
66 bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const;
69 /// These fields are accessible for ModuleBase_WidgetFactory only
70 Config_WidgetAPI(std::string theRawXml);
71 //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false
73 //! Pass into the child node of widget's xml definition. If impossible, returns false
75 //! Pass into the parent node of widget's xml definition. If impossible, returns false
76 bool toParentWidget();
79 xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition
80 xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml definition
82 friend class ModuleBase_WidgetFactory;
85 #endif /* CONFIG_WIDGETAPI_H_ */