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