Salome HOME
44349fc418ec38d2d352966856b635f841e6f174
[modules/shaper.git] / src / Config / Config_WidgetAPI.h
1 /*
2  * Config_WidgetAPI.h
3  *
4  *  Created on: Apr 1, 2014
5  *      Author: sbh
6  */
7
8 #ifndef CONFIG_WIDGETAPI_H_
9 #define CONFIG_WIDGETAPI_H_
10
11 #include <Config_def.h>
12
13 #include <cstdarg>
14 #include <string>
15
16 //>> Forward declaration of xmlNodePtr.
17 typedef struct _xmlNode xmlNode;
18 typedef xmlNode *xmlNodePtr;
19 struct _xmlNode;
20 //<<
21
22 //>> Forward declaration of xmlDocPtr.
23 typedef struct _xmlDoc xmlDoc;
24 typedef xmlDoc *xmlDocPtr;
25 struct _xmlDoc;
26 //<<
27
28 class CONFIG_EXPORT Config_WidgetAPI
29 {
30  public:
31   virtual ~Config_WidgetAPI();
32
33   std::string widgetType() const;
34   bool isContainerWidget() const;
35   bool isPagedWidget() const;
36
37   std::string widgetId() const;
38   std::string widgetIcon() const;
39   std::string widgetLabel() const;
40   std::string widgetTooltip() const;
41
42   std::string getProperty(const char* thePropName) const;
43
44   /// Checks if the XML representation of widget has given attribute,
45   /// if yes - returns it's bool value, if no, or if the value can not
46   /// be converted to bool - returns theDefault.
47   /// \param theAttributeName attribute to check
48   /// \param theDefault default value on bad data
49   /// \return the boolean result
50   bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const;
51
52   bool isComputedDefault() const;
53
54  protected:
55   /// These fields are accessible for ModuleBase_WidgetFactory only
56   Config_WidgetAPI(std::string theRawXml);
57   bool toNextWidget();
58   bool toChildWidget();
59   bool toParentWidget();
60
61  private:
62   xmlDocPtr myDoc;
63   xmlNodePtr myCurrentNode;
64
65   friend class ModuleBase_WidgetFactory;
66 };
67
68 #endif /* CONFIG_WIDGETAPI_H_ */