X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_WidgetAPI.h;h=e9531e49fb7af27c9615c666c2e172a0a7af2df9;hb=82d3fff7d0ed2c089da5aa6b106789be076081f3;hp=4030ff257a204b12e70af6d7c14cdbd6f4677f10;hpb=d4d5684c9088ac4fea8411b62e10a277729c75fa;p=modules%2Fshaper.git diff --git a/src/Config/Config_WidgetAPI.h b/src/Config/Config_WidgetAPI.h index 4030ff257..e9531e49f 100644 --- a/src/Config/Config_WidgetAPI.h +++ b/src/Config/Config_WidgetAPI.h @@ -1,3 +1,5 @@ +// Copyright (C) 2014-20xx CEA/DEN, EDF R&D + /* * Config_WidgetAPI.h * @@ -8,7 +10,7 @@ #ifndef CONFIG_WIDGETAPI_H_ #define CONFIG_WIDGETAPI_H_ -#include +#include #include #include @@ -25,32 +27,59 @@ typedef xmlDoc *xmlDocPtr; struct _xmlDoc; //<< - +/*! + * \class Config_WidgetAPI + * \ingroup Config + * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets + */ class CONFIG_EXPORT Config_WidgetAPI { -public: - Config_WidgetAPI(std::string theRawXml); + public: virtual ~Config_WidgetAPI(); - bool toNextWidget(); - bool toChildWidget(); - bool toParentWidget(); + //! Returns name of widget's node (attribute) + std::string widgetType() const; + //! Returns true if widget has container type, which means it able to contain other widgets + bool isGroupBoxWidget() const; + //! Returns true if widget has page type; + //! Page is container widget with combo box control to switch between pages + bool isPagedWidget() const; - std::string widgetType(); - bool isContainerWidget(); - bool isPagedWidget(); + //! Returns id of current widget + std::string widgetId() const; + //! Returns icon of current widget + std::string widgetIcon() const; + //! Returns text for label of current widget + std::string widgetLabel() const; + //! Returns text for tooltip of current widget + std::string widgetTooltip() const; + //! Returns a custom property of current widget + std::string getProperty(const char* thePropName) const; - std::string widgetId(); - std::string widgetIcon(); - std::string widgetLabel(); - std::string widgetTooltip(); + /*! Checks if the XML representation of widget has given attribute, + * if yes - returns it's bool value, if no, or if the value can not + * be converted to bool - returns theDefault. + * \param theAttributeName attribute to check + * \param theDefault default value on bad data + * \return the boolean result + */ + bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const; - std::string getProperty(const char* thePropName); + protected: + /// These fields are accessible for ModuleBase_WidgetFactory only + Config_WidgetAPI(std::string theRawXml); + //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false + bool toNextWidget(); + //! Pass into the child node of widget's xml definition. If impossible, returns false + bool toChildWidget(); + //! Pass into the parent node of widget's xml definition. If impossible, returns false + bool toParentWidget(); -private: - xmlDocPtr myDoc; - xmlNodePtr myCurrentNode; + private: + xmlDocPtr myDoc; //!< Pointer to the root of widget's xml definition + xmlNodePtr myCurrentNode; //!< Pointer to the current node in the widget's xml definition + friend class ModuleBase_WidgetFactory; }; #endif /* CONFIG_WIDGETAPI_H_ */