X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_WidgetAPI.h;h=b2a626655e263b226c195423cc5c2fc49912da1b;hb=7ec27d9ade25264df5a6d8e2308b3fb742366170;hp=c98888f12339d66b223378151118d86268d4e099;hpb=a142c8797585ec0b35310ec3608d38b3a4908b7c;p=modules%2Fshaper.git diff --git a/src/Config/Config_WidgetAPI.h b/src/Config/Config_WidgetAPI.h index c98888f12..b2a626655 100644 --- a/src/Config/Config_WidgetAPI.h +++ b/src/Config/Config_WidgetAPI.h @@ -1,14 +1,26 @@ -/* - * Config_WidgetAPI.h - * - * Created on: Apr 1, 2014 - * Author: sbh - */ +// Copyright (C) 2014-2022 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef CONFIG_WIDGETAPI_H_ #define CONFIG_WIDGETAPI_H_ -#include +#include #include #include @@ -25,32 +37,62 @@ typedef xmlDoc *xmlDocPtr; struct _xmlDoc; //<< - -class CONFIG_EXPORT Config_WidgetAPI +/*! + * \class Config_WidgetAPI + * \ingroup Config + * \brief Provides low-level API for WidgetFactory for reading xml definitions of widgets + */ +class Config_WidgetAPI { -public: - Config_WidgetAPI(std::string theRawXml); - virtual ~Config_WidgetAPI(); - - void reset(); - bool nextWidget(); + public: + CONFIG_EXPORT virtual ~Config_WidgetAPI(); - std::string widgetType(); + //! Returns name of widget's node (attribute) + CONFIG_EXPORT std::string widgetType() const; + //! Returns true if widget has container type, which means it able to contain other widgets + CONFIG_EXPORT bool isGroupBoxWidget() const; + //! Returns true if widget has page type; + //! Page is container widget with combo box control to switch between pages + CONFIG_EXPORT bool isPagedWidget() const; - std::string widgetId(); - std::string widgetIcon(); - std::string widgetLabel(); - std::string widgetTooltip(); + //! Returns id of current feature + CONFIG_EXPORT std::string featureId() const; + //! Returns id of current widget + CONFIG_EXPORT std::string widgetId() const; + //! Returns icon of current widget + CONFIG_EXPORT std::string widgetIcon() const; + //! Returns text for label of current widget + CONFIG_EXPORT std::string widgetLabel() const; + //! Returns text for tooltip of current widget + CONFIG_EXPORT std::string widgetTooltip() const; + //! Returns a custom property of current widget + CONFIG_EXPORT std::string getProperty(const char* thePropName) const; - std::string getProperty(const char* thePropName); + /*! 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 + */ + CONFIG_EXPORT bool getBooleanAttribute(const char* theAttributeName, bool theDefault) const; -protected: - bool isNode(xmlNodePtr theNode, const char* name, ...); + /// These fields are accessible for ModuleBase_WidgetFactory only + CONFIG_EXPORT Config_WidgetAPI(std::string theRawXml, const std::string theAttributePrefix = ""); + //! Pass to the next (sibling) node of widget's xml definition. If impossible, returns false + CONFIG_EXPORT bool toNextWidget(); + //! Pass into the child node of widget's xml definition. If impossible, returns false + CONFIG_EXPORT bool toChildWidget(); + //! Pass into the parent node of widget's xml definition. If impossible, returns false + CONFIG_EXPORT 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 + std::string myFeatureId; + std::string myAttributePrefix; //!< prefix that must be added to the attribute name + friend class ModuleBase_WidgetFactory; }; #endif /* CONFIG_WIDGETAPI_H_ */