X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FConfig%2FConfig_WidgetAPI.cpp;h=c95c03b4d01a00e793852234cbbc66547f5d1c94;hb=efe17b3c886ebdac71a0090714db258ce15bd45a;hp=bcf543bd17e21d93e81cfa832545a3672d594d8c;hpb=d090d2a84b306232c2bfc888594339f0042c9040;p=modules%2Fshaper.git diff --git a/src/Config/Config_WidgetAPI.cpp b/src/Config/Config_WidgetAPI.cpp index bcf543bd1..c95c03b4d 100644 --- a/src/Config/Config_WidgetAPI.cpp +++ b/src/Config/Config_WidgetAPI.cpp @@ -20,6 +20,7 @@ Config_WidgetAPI::Config_WidgetAPI(std::string theRawXml) { myDoc = xmlParseDoc(BAD_CAST theRawXml.c_str()); myCurrentNode = xmlDocGetRootElement(myDoc); + myFeatureId = getProperty(_ID); } Config_WidgetAPI::~Config_WidgetAPI() @@ -46,11 +47,18 @@ bool Config_WidgetAPI::toNextWidget() bool Config_WidgetAPI::toChildWidget() { if (myCurrentNode && hasChild(myCurrentNode)) { - myCurrentNode = myCurrentNode->children; - while (myCurrentNode && !isElementNode(myCurrentNode)) { - myCurrentNode = myCurrentNode->next; + xmlNodePtr aChildNode = myCurrentNode->children; + // it is possible that among child nodes, there is no an element node, so + // we should not change the current node until not-zero node is found + // otherwise, it may happens that the current node is null and the node tree information + // is lost + while (aChildNode && !isElementNode(aChildNode)) { + aChildNode = aChildNode->next; + } + if (aChildNode != NULL) { + myCurrentNode = aChildNode; + return true; } - return myCurrentNode != NULL; } return false; } @@ -72,16 +80,16 @@ std::string Config_WidgetAPI::widgetType() const return result; } -bool Config_WidgetAPI::isContainerWidget() const +bool Config_WidgetAPI::isGroupBoxWidget() const { - return isNode(myCurrentNode, WDG_GROUP, WDG_CHECK_GROUP, - NULL); + return isNode(myCurrentNode, WDG_GROUP, WDG_OPTIONALBOX, + NULL); } bool Config_WidgetAPI::isPagedWidget() const { return isNode(myCurrentNode, WDG_TOOLBOX, WDG_SWITCH, - NULL); + NULL); } std::string Config_WidgetAPI::getProperty(const char* thePropName) const @@ -94,6 +102,11 @@ bool Config_WidgetAPI::getBooleanAttribute(const char* theAttributeName, bool th return ::getBooleanAttribute(myCurrentNode, theAttributeName, theDefault); } +std::string Config_WidgetAPI::featureId() const +{ + return myFeatureId; +} + std::string Config_WidgetAPI::widgetId() const { return getProperty(_ID);