[DEV] Update with the new exml API

This commit is contained in:
Edouard DUPIN 2016-04-18 21:01:17 +02:00
parent 75e42b9bfe
commit faad7fcd41
22 changed files with 147 additions and 151 deletions

View File

@ -245,47 +245,48 @@ void ewol::compositing::TextBase::print(const std::string& _text) {
}
void ewol::compositing::TextBase::parseHtmlNode(const std::shared_ptr<const exml::Element>& _element) {
void ewol::compositing::TextBase::parseHtmlNode(const exml::Element& _element) {
// get the static real pointer
if (_element == nullptr) {
if (_element.exist() == false) {
EWOL_ERROR( "Error Input node does not existed ...");
return;
}
for(size_t iii=0; iii< _element->size(); iii++) {
if (_element->getType(iii) == exml::typeComment) {
for(auto it : _element.nodes) {
if (it.isComment() == true) {
// nothing to do ...
} else if (_element->getType(iii) == exml::typeText) {
std::shared_ptr<const exml::Node> child = _element->getNode(iii);
htmlAddData(etk::to_u32string(child->getValue()));
EWOL_VERBOSE("XML add : " << child->getValue());
continue;
} else if (_element->getType(iii) != exml::typeElement) {
EWOL_ERROR("(l "<< _element->getNode(iii)->getPos() << ") node not suported type : " << _element->getType(iii) << " val=\""<< _element->getNode(iii)->getValue() << "\"" );
} else if (it.isText() == true) {
htmlAddData(etk::to_u32string(it.getValue()));
EWOL_VERBOSE("XML add : " << it.getValue());
continue;
} else if (it.isElement() == false) {
EWOL_ERROR("(l "<< it.getPos() << ") node not suported type : " << it.getType() << " val='"<< it.getValue() << "'" );
continue;
}
std::shared_ptr<const exml::Element> elem = _element->getElement(iii);
if (elem == nullptr) {
exml::Element elem = it.toElement();
if (elem.exist() == false) {
EWOL_ERROR("Cast error ...");
continue;
}
if(etk::compare_no_case(elem->getValue(), "br") == true) {
if(etk::compare_no_case(elem.getValue(), "br") == true) {
htmlFlush();
EWOL_VERBOSE("XML flush & newLine");
forceLineReturn();
} else if (etk::compare_no_case(elem->getValue(), "font") == true) {
} else if (etk::compare_no_case(elem.getValue(), "font") == true) {
EWOL_VERBOSE("XML Font ...");
TextDecoration tmpDeco = m_htmlDecoTmp;
std::string colorValue = elem->getAttribute("color");
std::string colorValue = elem.attributes["color"];
if (colorValue.size() != 0) {
m_htmlDecoTmp.m_colorFg = colorValue;
}
colorValue = elem->getAttribute("colorBg");
colorValue = elem.attributes["colorBg"];
if (colorValue.size() != 0) {
m_htmlDecoTmp.m_colorBg = colorValue;
}
parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco;
} else if( etk::compare_no_case(elem->getValue(), "b") == true
|| etk::compare_no_case(elem->getValue(), "bold") == true) {
} else if( etk::compare_no_case(elem.getValue(), "b") == true
|| etk::compare_no_case(elem.getValue(), "bold") == true) {
EWOL_VERBOSE("XML bold ...");
TextDecoration tmpDeco = m_htmlDecoTmp;
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
@ -295,8 +296,8 @@ void ewol::compositing::TextBase::parseHtmlNode(const std::shared_ptr<const exml
}
parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco;
} else if( etk::compare_no_case(elem->getValue(), "i") == true
|| etk::compare_no_case(elem->getValue(), "italic") == true) {
} else if( etk::compare_no_case(elem.getValue(), "i") == true
|| etk::compare_no_case(elem.getValue(), "italic") == true) {
EWOL_VERBOSE("XML italic ...");
TextDecoration tmpDeco = m_htmlDecoTmp;
if (m_htmlDecoTmp.m_mode == ewol::font::Regular) {
@ -306,40 +307,40 @@ void ewol::compositing::TextBase::parseHtmlNode(const std::shared_ptr<const exml
}
parseHtmlNode(elem);
m_htmlDecoTmp = tmpDeco;
} else if( etk::compare_no_case(elem->getValue(), "u") == true
|| etk::compare_no_case(elem->getValue(), "underline") == true) {
} else if( etk::compare_no_case(elem.getValue(), "u") == true
|| etk::compare_no_case(elem.getValue(), "underline") == true) {
EWOL_VERBOSE("XML underline ...");
parseHtmlNode(elem);
} else if( etk::compare_no_case(elem->getValue(), "p") == true
|| etk::compare_no_case(elem->getValue(), "paragraph") == true) {
} else if( etk::compare_no_case(elem.getValue(), "p") == true
|| etk::compare_no_case(elem.getValue(), "paragraph") == true) {
EWOL_VERBOSE("XML paragraph ...");
htmlFlush();
m_alignement = alignLeft;
forceLineReturn();
parseHtmlNode(elem);
forceLineReturn();
} else if (etk::compare_no_case(elem->getValue(), "center") == true) {
} else if (etk::compare_no_case(elem.getValue(), "center") == true) {
EWOL_VERBOSE("XML center ...");
htmlFlush();
m_alignement = alignCenter;
parseHtmlNode(elem);
} else if (etk::compare_no_case(elem->getValue(), "left") == true) {
} else if (etk::compare_no_case(elem.getValue(), "left") == true) {
EWOL_VERBOSE("XML left ...");
htmlFlush();
m_alignement = alignLeft;
parseHtmlNode(elem);
} else if (etk::compare_no_case(elem->getValue(), "right") == true) {
} else if (etk::compare_no_case(elem.getValue(), "right") == true) {
EWOL_VERBOSE("XML right ...");
htmlFlush();
m_alignement = alignRight;
parseHtmlNode(elem);
} else if (etk::compare_no_case(elem->getValue(), "justify") == true) {
} else if (etk::compare_no_case(elem.getValue(), "justify") == true) {
EWOL_VERBOSE("XML justify ...");
htmlFlush();
m_alignement = alignJustify;
parseHtmlNode(elem);
} else {
EWOL_ERROR("(l "<< elem->getPos() << ") node not suported type : " << elem->getType() << " val=\""<< elem->getValue() << "\"" );
EWOL_ERROR("(l "<< elem.getPos() << ") node not suported type: " << elem.getType() << " val='"<< elem.getValue() << "'" );
}
}
}
@ -373,15 +374,15 @@ void ewol::compositing::TextBase::printHTML(const std::string& _text) {
return;
}
std::shared_ptr<const exml::Element> root = doc.getNamed( "html" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"html\"");
exml::Element root = doc.nodes["html"];
if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'html'");
doc.display();
return;
}
std::shared_ptr<const exml::Element> bodyNode = root->getNamed( "body" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"body\"");
exml::Element bodyNode = root.nodes["body"];
if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'body'");
return;
}
parseHtmlNode(bodyNode);
@ -401,15 +402,15 @@ void ewol::compositing::TextBase::printHTML(const std::u32string& _text) {
return;
}
std::shared_ptr<exml::Element> root = doc.getNamed( "html" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"html\"");
exml::Element root = doc.nodes["html"];
if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'html'");
doc.display();
return;
}
std::shared_ptr<exml::Element> bodyNode = root->getNamed( "body" );
if (root == nullptr) {
EWOL_ERROR( "can not load XML: main node not find: \"body\"");
exml::Element bodyNode = root.nodes["body"];
if (root.exist() == false) {
EWOL_ERROR( "can not load XML: main node not find: 'body'");
return;
}
parseHtmlNode(bodyNode);

View File

@ -355,7 +355,7 @@ namespace ewol {
* @brief This parse a tinyXML node (void pointer to permit to hide tiny XML in include).
* @param[in] _element the exml element.
*/
void parseHtmlNode(const std::shared_ptr<const exml::Element>& _element);
void parseHtmlNode(const exml::Element& _element);
public:
/**
* @brief This generate the possibility to generate the big text property

View File

@ -116,14 +116,14 @@ bool ewol::Object::isTypeCompatible(const std::string& _type) {
return false;
}
bool ewol::Object::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::Object::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
bool errorOccured = false;
for(size_t iii=0 ; iii<_node->sizeAttribute() ; iii++) {
auto pair = _node->getAttrPair(iii);
for(const auto it : _node.attributes) {
auto pair = it.getPair();
if (pair.first == "") {
continue;
}
@ -134,13 +134,13 @@ bool ewol::Object::loadXML(const std::shared_ptr<const exml::Element>& _node) {
return errorOccured;
}
bool ewol::Object::storeXML(const std::shared_ptr<exml::Element>& _node) const {
if (nullptr == _node) {
bool ewol::Object::storeXML(exml::Element& _node) const {
if (_node.exist() == false) {
return false;
}
bool errorOccured = true;
for (auto &it : properties.getAll(true)) {
_node->setAttribute(it.first, it.second);
_node.attributes.set(it.first, it.second);
}
return errorOccured;
}

View File

@ -229,14 +229,14 @@ namespace ewol {
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node);
virtual bool loadXML(const exml::Element& _node);
/**
* @brief store properties in this XML node.
* @param[in,out] _node Pointer on the tinyXML node.
* @return true : All has been done corectly.
* @return false : An error occured.
*/
virtual bool storeXML(const std::shared_ptr<exml::Element>& _node) const;
virtual bool storeXML(exml::Element& _node) const;
public:
/**
* @breif get the current Object manager.

View File

@ -27,44 +27,44 @@ static ewol::WidgetShared composerGenerate(bool _modeFile, const std::string& _d
if (_data == "") {
return nullptr;
}
std::shared_ptr<exml::Document> doc = exml::Document::create();
exml::Document doc;
if (_modeFile == true) {
if (doc->load(_data) == false) {
if (doc.load(_data) == false) {
EWOL_ERROR(" can not load file XML : " << _data);
return nullptr;
}
} else {
if (doc->parse(_data) == false) {
if (doc.parse(_data) == false) {
EWOL_ERROR(" can not load file XML string...");
return nullptr;
}
}
std::shared_ptr<const exml::Element> root = doc->toElement();
if (root->size() == 0) {
exml::Element root = doc.toElement();
if (root.nodes.size() == 0) {
EWOL_ERROR(" (l ?) No node in the XML file/string.");
return nullptr;
}
if (root->size() > 1) {
if (root.nodes.size() > 1) {
EWOL_WARNING(" (l ?) More than 1 node in the XML file/string. (JUST parse the first)");
}
std::shared_ptr<const exml::Element> pNode = root->getElement(0);
if (pNode == nullptr) {
exml::Element pNode = root.nodes[0].toElement();
if (pNode.exist() == false) {
EWOL_ERROR(" (l ?) No node in the XML file/string. {2}");
return nullptr;
}
std::string widgetName = pNode->getValue();
std::string widgetName = pNode.getValue();
if (widgetManager.exist(widgetName) == false) {
EWOL_ERROR("(l "<<pNode->getPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << widgetManager.list() << "]" );
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << widgetManager.list() << "]" );
return nullptr;
}
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
ewol::WidgetShared tmpWidget = widgetManager.create(widgetName);
if (tmpWidget == nullptr) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'");
return nullptr;
}
if (tmpWidget->loadXML(pNode) == false) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") can not load widget properties : \"" << widgetName << "\"");
EWOL_ERROR ("(l " << pNode.getPos() << ") can not load widget properties : '" << widgetName << "'");
}
return tmpWidget;
}
@ -82,20 +82,20 @@ ewol::widget::Composer::~Composer() {
}
bool ewol::widget::Composer::loadFromFile(const std::string& _fileName) {
std::shared_ptr<exml::Document> doc = exml::Document::create();
if (doc->load(_fileName) == false) {
exml::Document doc;
if (doc.load(_fileName) == false) {
EWOL_ERROR(" can not load file XML : " << _fileName);
return false;
}
std::shared_ptr<const exml::Element> root = doc->getNamed("composer");
if (root == nullptr) {
exml::Element root = doc.nodes["composer"];
if (root.exist() == false) {
// Maybe a multiple node XML for internal config:
root = doc->toElement();
if (root == nullptr) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: \"composer\" ...");
root = doc.toElement();
if (root.exist() == false) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: 'composer' ...");
return false;
}
if (root->size() == 0) {
if (root.nodes.size() == 0) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) no node in the Container XML element.");
return false;
}
@ -107,20 +107,20 @@ bool ewol::widget::Composer::loadFromFile(const std::string& _fileName) {
}
bool ewol::widget::Composer::loadFromString(const std::string& _composerXmlString) {
std::shared_ptr<exml::Document> doc = exml::Document::create();
if (doc->parse(_composerXmlString) == false) {
exml::Document doc;
if (doc.parse(_composerXmlString) == false) {
EWOL_ERROR(" can not load file XML string...");
return false;
}
std::shared_ptr<const exml::Element> root = doc->getNamed("composer");
if (root == nullptr) {
exml::Element root = doc.nodes["composer"];
if (root.exist() == false) {
// Maybe a multiple node XML for internal config:
root = doc->toElement();
if (root == nullptr) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: \"composer\" ...");
root = doc.toElement();
if (root.exist() == false) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) main node not find: 'composer' ...");
return false;
}
if (root->size() == 0) {
if (root.nodes.size() == 0) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l ?) no node in the Container XML element.");
return false;
}

View File

@ -142,8 +142,8 @@ ewol::WidgetShared ewol::widget::Container::getWidgetAtPos(const vec2& _pos) {
return nullptr;
};
bool ewol::widget::Container::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::widget::Container::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
// parse generic properties:
@ -151,31 +151,31 @@ bool ewol::widget::Container::loadXML(const std::shared_ptr<const exml::Element>
// remove previous element:
subWidgetRemove();
// parse all the elements:
for(size_t iii=0; iii< _node->size(); iii++) {
std::shared_ptr<const exml::Element> pNode = _node->getElement(iii);
if (pNode == nullptr) {
for (const auto it : _node.nodes) {
exml::Element pNode = it.toElement();
if (pNode.exist() == false) {
// trash here all that is not element
continue;
}
std::string widgetName = pNode->getValue();
std::string widgetName = pNode.getValue();
if (getWidgetManager().exist(widgetName) == false) {
EWOL_ERROR("(l "<<pNode->getPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << getWidgetManager().list() << "]" );
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in : [" << getWidgetManager().list() << "]" );
continue;
}
if (getSubWidget() != nullptr) {
EWOL_ERROR("(l "<<pNode->getPos()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" );
EWOL_ERROR("(l " << pNode.getPos() << ") " << __class__ << " Can only have one subWidget ??? node='" << widgetName << "'" );
continue;
}
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName);
if (tmpWidget == nullptr) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget : '" << widgetName << "'");
continue;
}
// add widget :
setSubWidget(tmpWidget);
if (false == tmpWidget->loadXML(pNode)) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") can not load widget properties : \"" << widgetName << "\"");
if (tmpWidget->loadXML(pNode) == false) {
EWOL_ERROR ("(l " << pNode.getPos() << ") can not load widget properties : '" << widgetName << "'");
return false;
}
}

View File

@ -66,7 +66,7 @@ namespace ewol {
void calculateMinMaxSize() override;
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
bool loadXML(const exml::Element& _node) override;
void setOffset(const vec2& _newVal) override;
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
};

View File

@ -175,8 +175,8 @@ ewol::WidgetShared ewol::widget::Container2::getWidgetAtPos(const vec2& _pos) {
}
*/
bool ewol::widget::Container2::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::widget::Container2::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
// parse generic properties :
@ -185,29 +185,29 @@ bool ewol::widget::Container2::loadXML(const std::shared_ptr<const exml::Element
subWidgetRemove();
// parse all the elements :
for(size_t iii=0; iii< _node->size(); iii++) {
std::shared_ptr<const exml::Element> pNode = _node->getElement(iii);
if (pNode == nullptr) {
for(const auto it : _node.nodes) {
exml::Element pNode = _node.toElement();
if (pNode.exist()) {
// trash here all that is not element
continue;
}
std::string widgetName = pNode->getValue();
std::string widgetName = pNode.getValue();
if (getWidgetManager().exist(widgetName) == false) {
EWOL_ERROR("(l "<<pNode->getPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << getWidgetManager().list() << "]" );
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << widgetName << "' not in: [" << getWidgetManager().list() << "]" );
continue;
}
bool toogleMode=false;
if (getSubWidget() != nullptr) {
toogleMode=true;
if (getSubWidgetToggle() != nullptr) {
EWOL_ERROR("(l "<<pNode->getPos()<<") " << __class__ << " Can only have one subWidget ??? node=\"" << widgetName << "\"" );
EWOL_ERROR("(l " << pNode.getPos() << ") " << __class__ << " Can only have one subWidget ??? node='" << widgetName << "'" );
continue;
}
}
EWOL_DEBUG("try to create subwidget : '" << widgetName << "'");
ewol::WidgetShared tmpWidget = getWidgetManager().create(widgetName);
if (tmpWidget == nullptr) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
EWOL_ERROR ("(l " << pNode.getPos() << ") Can not create the widget: '" << widgetName << "'");
continue;
}
// add widget :
@ -217,7 +217,7 @@ bool ewol::widget::Container2::loadXML(const std::shared_ptr<const exml::Element
setSubWidgetToggle(tmpWidget);
}
if (tmpWidget->loadXML(pNode) == false) {
EWOL_ERROR ("(l "<<pNode->getPos()<<") can not load widget properties : \"" << widgetName << "\"");
EWOL_ERROR ("(l "<<pNode.getPos()<<") can not load widget properties: '" << widgetName << "'");
return false;
}
}

View File

@ -167,7 +167,7 @@ namespace ewol {
calculateMinMaxSizePadded();
}
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
bool loadXML(const exml::Element& _node) override;
void setOffset(const vec2& _newVal) override;
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
};

View File

@ -253,9 +253,8 @@ ewol::WidgetShared ewol::widget::ContainerN::getWidgetAtPos(const vec2& _pos) {
return nullptr;
};
bool ewol::widget::ContainerN::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::widget::ContainerN::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
// parse generic properties :
@ -263,31 +262,31 @@ bool ewol::widget::ContainerN::loadXML(const std::shared_ptr<const exml::Element
// remove previous element :
subWidgetRemoveAll();
std::string tmpAttributeValue = _node->getAttribute("lock");
std::string tmpAttributeValue = _node.attributes["lock"];
if (tmpAttributeValue.size()!=0) {
propertyLockExpand.set(tmpAttributeValue);
}
bool invertAdding=false;
tmpAttributeValue = _node->getAttribute("addmode");
tmpAttributeValue = _node.attributes["addmode"];
if(etk::compare_no_case(tmpAttributeValue, "invert")) {
invertAdding=true;
}
// parse all the elements :
for (size_t iii=0; iii < _node->size(); iii++) {
std::shared_ptr<const exml::Element> pNode = _node->getElement(iii);
if (pNode == nullptr) {
for (const auto nodeIt : _node.nodes) {
const exml::Element pNode = _node.toElement();
if (pNode.exist() == false) {
// trash here all that is not element
continue;
}
std::string widgetName = pNode->getValue();
std::string widgetName = pNode.getValue();
if (getWidgetManager().exist(widgetName) == false) {
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l "<<pNode->getPos()<<") Unknown basic node=\"" << widgetName << "\" not in : [" << getWidgetManager().list() << "]" );
EWOL_ERROR("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Unknown basic node=\"" << widgetName << "\" not in : [" << getWidgetManager().list() << "]" );
continue;
}
EWOL_DEBUG("[" << getId() << "] {" << getObjectType() << "} load new element : \"" << widgetName << "\"");
ewol::WidgetShared subWidget = getWidgetManager().create(widgetName);
if (subWidget == nullptr) {
EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l "<<pNode->getPos()<<") Can not create the widget : \"" << widgetName << "\"");
EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") Can not create the widget : \"" << widgetName << "\"");
continue;
}
// add sub element :
@ -297,7 +296,7 @@ bool ewol::widget::ContainerN::loadXML(const std::shared_ptr<const exml::Element
subWidgetAddStart(subWidget);
}
if (subWidget->loadXML(pNode) == false) {
EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l "<<pNode->getPos()<<") can not load widget properties : \"" << widgetName << "\"");
EWOL_ERROR ("[" << getId() << "] {" << getObjectType() << "} (l " << pNode.getPos() << ") can not load widget properties : \"" << widgetName << "\"");
return false;
}
}

View File

@ -97,7 +97,7 @@ namespace ewol {
void calculateMinMaxSize() override;
ewol::WidgetShared getWidgetAtPos(const vec2& _pos) override;
ewol::ObjectShared getSubObjectNamed(const std::string& _objectName) override;
bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
bool loadXML(const exml::Element& _node) override;
void setOffset(const vec2& _newVal) override;
void requestDestroyFromChild(const ewol::ObjectShared& _child) override;
protected:

View File

@ -145,14 +145,14 @@ bool ewol::widget::Image::onEventInput(const ewol::event::Input& _event) {
return false;
}
bool ewol::widget::Image::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::widget::Image::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
ewol::Widget::loadXML(_node);
// get internal data :
std::string tmpAttributeValue = _node->getAttribute("ratio");
std::string tmpAttributeValue = _node.attributes["ratio"];
if (tmpAttributeValue.size() != 0) {
if (etk::compare_no_case(tmpAttributeValue, "true") == true) {
propertyKeepRatio.setDirect(true);
@ -162,25 +162,25 @@ bool ewol::widget::Image::loadXML(const std::shared_ptr<const exml::Element>& _n
propertyKeepRatio.setDirect(false);
}
}
tmpAttributeValue = _node->getAttribute("size");
tmpAttributeValue = _node.attributes["size"];
if (tmpAttributeValue.size() != 0) {
//EWOL_CRITICAL(" Parse SIZE : " << tmpAttributeValue);
propertyImageSize.setDirect(tmpAttributeValue);
//EWOL_CRITICAL(" == > " << propertyImageSize);
}
tmpAttributeValue = _node->getAttribute("border");
tmpAttributeValue = _node.attributes["border"];
if (tmpAttributeValue.size() != 0) {
propertyBorder.setDirect(tmpAttributeValue);
}
tmpAttributeValue = _node->getAttribute("smooth");
tmpAttributeValue = _node.attributes["smooth"];
if (tmpAttributeValue.size() != 0) {
propertySmooth.setDirect(etk::string_to_bool(tmpAttributeValue));
}
//EWOL_DEBUG("Load label:" << node->ToElement()->getText());
if (_node->size() != 0) {
propertySource.set(_node->getText());
if (_node.nodes.size() != 0) {
propertySource.set(_node.getText());
} else {
tmpAttributeValue = _node->getAttribute("src");
tmpAttributeValue = _node.attributes["src"];
if (tmpAttributeValue.size() != 0) {
propertySource.set(tmpAttributeValue);
}

View File

@ -64,7 +64,7 @@ namespace ewol {
void calculateMinMaxSize() override;
void onRegenerateDisplay() override;
bool onEventInput(const ewol::event::Input& _event) override;
bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
bool loadXML(const exml::Element& _node) override;
protected:
virtual void onChangePropertySource();
virtual void onChangePropertyImageSize();

View File

@ -141,14 +141,14 @@ bool ewol::widget::Label::onEventInput(const ewol::event::Input& _event) {
return false;
}
bool ewol::widget::Label::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::widget::Label::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
ewol::Widget::loadXML(_node);
// get internal data :
EWOL_DEBUG("Load label:" << _node->getText());
propertyValue.set(_node->getText());
EWOL_DEBUG("Load label:" << _node.getText());
propertyValue.set(_node.getText());
return true;
}

View File

@ -54,7 +54,7 @@ namespace ewol {
void calculateMinMaxSize() override;
void onRegenerateDisplay() override;
bool onEventInput(const ewol::event::Input& _event) override;
bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
bool loadXML(const exml::Element& _node) override;
protected:
virtual void onChangePropertyValue();
virtual void onChangePropertyAutoTranslate();

View File

@ -111,8 +111,8 @@ void ewol::widget::Select::optionAdd(int32_t _value, std::string _data) {
m_listElement.push_back(ewol::widget::Select::Element(_value, _data, false));
}
bool ewol::widget::Select::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::widget::Select::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
// parse generic properties:
@ -120,26 +120,25 @@ bool ewol::widget::Select::loadXML(const std::shared_ptr<const exml::Element>& _
// remove previous element:
//subWidgetRemove();
// parse all the elements:
for(size_t iii=0; iii< _node->size(); iii++) {
std::shared_ptr<const exml::Element> pNode = _node->getElement(iii);
if (pNode == nullptr) {
for(const auto it : _node.nodes) {
exml::Element pNode = it.toElement();
if (pNode.exist() == false) {
// trash here all that is not element
continue;
}
if (pNode->getValue() != "option") {
EWOL_ERROR("(l "<<pNode->getPos()<<") Unknown basic node='" << pNode->getValue() << "' not in : [option]" );
if (pNode.getValue() != "option") {
EWOL_ERROR("(l " << pNode.getPos() << ") Unknown basic node='" << pNode.getValue() << "' not in : [option]" );
continue;
}
std::string valId = pNode->getAttribute("id");
std::string valIsSelected = pNode->getAttribute("select");
std::string valText = pNode->getText();
std::string valId = pNode.attributes["id"];
std::string valIsSelected = pNode.attributes["select"];
std::string valText = pNode.getText();
int32_t id = etk::string_to_int32_t(valId);
int32_t select = etk::string_to_bool(valIsSelected);
bool select = etk::string_to_bool(valIsSelected);
optionAdd(id, valText);
if (select == true) {
propertyValue.set(id);
}
EWOL_WARNING("Add option : id='" << valId << "' select='" << valIsSelected << "' text='" << valText << "'");
}
return true;

View File

@ -53,7 +53,7 @@ namespace ewol {
void optionClear();
void optionAdd(int32_t _value, std::string _name);
protected:
bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
bool loadXML(const exml::Element& _node) override;
void updateGui() override;
protected:
void onCallbackOpenMenu();

View File

@ -20,9 +20,6 @@ std::ostream& operator <<(std::ostream& _os, const enum ewol::widget::WSlider::s
return _os;
}
#undef __class__
#define __class__ "WSlider"
ewol::widget::WSlider::WSlider() :
signalStartSlide(this, "start", ""),
signalStopSlide(this, "stop", ""),

View File

@ -544,7 +544,7 @@ enum gale::context::cursor ewol::Widget::getCursor() {
return m_cursorDisplay;
}
bool ewol::Widget::loadXML(const std::shared_ptr<const exml::Element>& _node) {
bool ewol::Widget::loadXML(const exml::Element& _node) {
ewol::Object::loadXML(_node);
markToRedraw();
return true;

View File

@ -515,7 +515,7 @@ namespace ewol {
*/
virtual enum gale::context::cursor getCursor();
public:
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
virtual bool loadXML(const exml::Element& _node) override;
public:
/**
* @brief need to be call When the size of the current widget have change ==> this force the system to recalculate all the widget positions

View File

@ -145,8 +145,8 @@ void ewol::widget::SpinBase::updateGui() {
}
}
bool ewol::widget::SpinBase::loadXML(const std::shared_ptr<const exml::Element>& _node) {
if (_node == nullptr) {
bool ewol::widget::SpinBase::loadXML(const exml::Element& _node) {
if (_node.exist() == false) {
return false;
}
// parse generic properties: (we not parse the sizer property, it remove all subwidget)

View File

@ -94,7 +94,7 @@ namespace ewol {
ewol::widget::ButtonShared m_widgetButtonUp;
virtual void updateGui();
public:
virtual bool loadXML(const std::shared_ptr<const exml::Element>& _node) override;
virtual bool loadXML(const exml::Element& _node) override;
protected:
virtual void onChangePropertySpinMode();
virtual void onChangePropertyShape();