Salome HOME
Corrections in the documentation of the Config package
[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 /*!
31  * \class Config_WidgetAPI
32  * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets
33  */
34 class CONFIG_EXPORT Config_WidgetAPI
35 {
36  public:
37   virtual ~Config_WidgetAPI();
38
39   std::string widgetType() const;
40   bool isContainerWidget() const;
41   bool isPagedWidget() const;
42
43   std::string widgetId() const;
44   std::string widgetIcon() const;
45   std::string widgetLabel() const;
46   std::string widgetTooltip() const;
47
48   std::string getProperty(const char* thePropName) const;
49
50   /// Checks if the XML representation of widget has given attribute,
51   /// if yes - returns it's bool value, if no, or if the value can not
52   /// be converted to bool - returns theDefault.
53   /// \param theAttributeName attribute to check
54   /// \param theDefault default value on bad data
55   /// \return the boolean result
56   bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const;
57
58   bool isComputedDefault() const;
59
60  protected:
61   /// These fields are accessible for ModuleBase_WidgetFactory only
62   Config_WidgetAPI(std::string theRawXml);
63   bool toNextWidget();
64   bool toChildWidget();
65   bool toParentWidget();
66
67  private:
68   xmlDocPtr myDoc;
69   xmlNodePtr myCurrentNode;
70
71   friend class ModuleBase_WidgetFactory;
72 };
73
74 #endif /* CONFIG_WIDGETAPI_H_ */