本文整理汇总了C++中OTMLNodePtr::children方法的典型用法代码示例。如果您正苦于以下问题:C++ OTMLNodePtr::children方法的具体用法?C++ OTMLNodePtr::children怎么用?C++ OTMLNodePtr::children使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OTMLNodePtr
的用法示例。
在下文中一共展示了OTMLNodePtr::children方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createWidgetFromOTML
UIWidgetPtr UIManager::createWidgetFromOTML(const OTMLNodePtr& widgetNode, const UIWidgetPtr& parent)
{
OTMLNodePtr originalStyleNode = getStyle(widgetNode->tag());
if(!originalStyleNode)
stdext::throw_exception(stdext::format("'%s' is not a defined style", widgetNode->tag()));
OTMLNodePtr styleNode = originalStyleNode->clone();
styleNode->merge(widgetNode);
std::string widgetType = styleNode->valueAt("__class");
// call widget creation from lua
UIWidgetPtr widget = g_lua.callGlobalField<UIWidgetPtr>(widgetType, "create");
if(parent)
parent->addChild(widget);
if(widget) {
widget->callLuaField("onCreate");
widget->setStyleFromNode(styleNode);
for(const OTMLNodePtr& childNode : styleNode->children()) {
if(!childNode->isUnique()) {
createWidgetFromOTML(childNode, widget);
styleNode->removeChild(childNode);
}
}
} else
stdext::throw_exception(stdext::format("unable to create widget of type '%s'", widgetType));
widget->callLuaField("onSetup");
return widget;
}
示例2: load
bool ParticleAffector::load(const OTMLNodePtr& node)
{
float minDelay = 0, maxDelay = 0;
float minDuration = -1, maxDuration = -1;
for(const OTMLNodePtr& childNode : node->children()) {
if(childNode->tag() == "delay") {
minDelay = childNode->value<float>();
maxDelay = childNode->value<float>();
}
else if(childNode->tag() == "min-delay")
minDelay = childNode->value<float>();
else if(childNode->tag() == "max-delay")
maxDelay = childNode->value<float>();
if(childNode->tag() == "duration") {
minDuration = childNode->value<float>();
maxDuration = childNode->value<float>();
}
else if(childNode->tag() == "min-duration")
minDuration = childNode->value<float>();
else if(childNode->tag() == "max-duration")
maxDuration = childNode->value<float>();
}
m_delay = Fw::randomRange(minDelay, maxDelay);
m_duration = Fw::randomRange(minDuration, maxDuration);
return true;
}
示例3: onStyleApply
void UIProgressRect::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
UIWidget::onStyleApply(styleName, styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "percent")
setPercent(node->value<float>());
}
}
示例4: applyStyle
void UIHorizontalLayout::applyStyle(const OTMLNodePtr& styleNode)
{
UIBoxLayout::applyStyle(styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "align-right")
setAlignRight(node->value<bool>());
}
}
示例5: load
void ParticleEffectType::load(const OTMLNodePtr& node)
{
m_node = node->clone();
for(const OTMLNodePtr& childNode : node->children()) {
if(childNode->tag() == "name")
m_name = childNode->value();
else if(childNode->tag() == "description")
m_description = childNode->value();
}
}
示例6:
std::vector<std::string> Config::getList(const std::string& key)
{
std::vector<std::string> list;
OTMLNodePtr child = m_confsDoc->get(key);
if(child) {
for(const OTMLNodePtr& subchild : child->children())
list.push_back(subchild->value());
}
return list;
}
示例7: applyStyle
void UIBoxLayout::applyStyle(const OTMLNodePtr& styleNode)
{
UILayout::applyStyle(styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "spacing")
setSpacing(node->value<int>());
else if(node->tag() == "fit-children")
setFitChildren(node->value<bool>());
}
}
示例8: onStyleApply
void UIMinimap::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
UIWidget::onStyleApply(styleName, styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "zoom")
setZoom(node->value<int>());
else if(node->tag() == "max-zoom")
setMaxZoom(node->value<int>());
else if(node->tag() == "min-zoom")
setMinZoom(node->value<int>());
}
}
示例9: push_luavalue
int push_luavalue(const OTMLNodePtr& node)
{
if(node) {
g_lua.newTable();
int currentIndex = 1;
for(const OTMLNodePtr& cnode : node->children()) {
push_otml_subnode_luavalue(cnode);
if(cnode->isUnique() && !cnode->tag().empty()) {
g_lua.setField(cnode->tag());
} else
g_lua.rawSeti(currentIndex++);
}
} else
g_lua.pushNil();
return 1;
}
示例10: unserializeOtml
void ThingType::unserializeOtml(const OTMLNodePtr& node)
{
for(const OTMLNodePtr& node2 : node->children()) {
if(node2->tag() == "opacity")
m_opacity = node2->value<float>();
else if(node2->tag() == "notprewalkable")
m_attribs.set(ThingAttrNotPreWalkable, node2->value<bool>());
else if(node2->tag() == "image")
m_customImage = node2->value();
else if(node2->tag() == "full-ground") {
if(node2->value<bool>())
m_attribs.set(ThingAttrFullGround, true);
else
m_attribs.remove(ThingAttrFullGround);
}
}
}
示例11: onStyleApply
void UIItem::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
UIWidget::onStyleApply(styleName, styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "item-id")
setItemId(node->value<int>());
else if(node->tag() == "item-count")
setItemCount(node->value<int>());
else if(node->tag() == "item-visible")
setItemVisible(node->value<bool>());
else if(node->tag() == "virtual")
setVirtual(node->value<bool>());
else if(node->tag() == "show-id")
m_showId = node->value<bool>();
}
}
示例12: onStyleApply
void UILineEdit::onStyleApply(const OTMLNodePtr& styleNode)
{
UIWidget::onStyleApply(styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "text") {
setText(node->value());
setCursorPos(m_text.length());
} else if(node->tag() == "text-hidden") {
setTextHidden(node->value<bool>());
} else if(node->tag() == "text-margin") {
m_textHorizontalMargin = node->value<int>();
} else if(node->tag() == "always-active") {
m_alwaysActive = true;
}
}
}
示例13: onStyleApply
void UILineEdit::onStyleApply(const std::string& styleName, const OTMLNodePtr& styleNode)
{
UIWidget::onStyleApply(styleName, styleNode);
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "text") {
setText(node->value());
setCursorPos(m_text.length());
} else if(node->tag() == "text-hidden")
setTextHidden(node->value<bool>());
else if(node->tag() == "text-margin")
setTextHorizontalMargin(node->value<int>());
else if(node->tag() == "always-active")
setAlwaysActive(node->value<bool>());
//else if(node->tag() == "disable-arrow-navitation")
// setArrowNavigation(node->value<bool>());
}
}
示例14: parseImageStyle
void UIWidget::parseImageStyle(const OTMLNodePtr& styleNode)
{
for(const OTMLNodePtr& node : styleNode->children()) {
if(node->tag() == "image-source")
setImageSource(stdext::resolve_path(node->value(), node->source()));
else if(node->tag() == "image-offset-x")
setImageOffsetX(node->value<int>());
else if(node->tag() == "image-offset-y")
setImageOffsetY(node->value<int>());
else if(node->tag() == "image-offset")
setImageOffset(node->value<Point>());
else if(node->tag() == "image-width")
setImageWidth(node->value<int>());
else if(node->tag() == "image-height")
setImageHeight(node->value<int>());
else if(node->tag() == "image-size")
setImageSize(node->value<Size>());
else if(node->tag() == "image-rect")
setImageRect(node->value<Rect>());
else if(node->tag() == "image-clip")
setImageClip(node->value<Rect>());
else if(node->tag() == "image-fixed-ratio")
setImageFixedRatio(node->value<bool>());
else if(node->tag() == "image-repeated")
setImageRepeated(node->value<bool>());
else if(node->tag() == "image-smooth")
setImageSmooth(node->value<bool>());
else if(node->tag() == "image-color")
setImageColor(node->value<Color>());
else if(node->tag() == "image-border-top")
setImageBorderTop(node->value<int>());
else if(node->tag() == "image-border-right")
setImageBorderRight(node->value<int>());
else if(node->tag() == "image-border-bottom")
setImageBorderBottom(node->value<int>());
else if(node->tag() == "image-border-left")
setImageBorderLeft(node->value<int>());
else if(node->tag() == "image-border")
setImageBorder(node->value<int>());
else if(node->tag() == "image-auto-resize")
setImageAutoResize(node->value<bool>());
}
}
示例15: onStyleApply
void UICheckBox::onStyleApply(const OTMLNodePtr& styleNode)
{
UIWidget::onStyleApply(styleNode);
for(OTMLNodePtr node : styleNode->children()) {
if(node->tag() == "text-offset")
m_textOffset = node->value<Point>();
else if(node->tag() == "text")
m_text = node->value();
else if(node->tag() == "box-size")
m_boxSize = node->value<Size>();
else if(node->tag() == "text-align")
m_textAlign = Fw::translateAlignment(node->value());
else if(node->tag() == "checked") {
// must be scheduled because setChecked can change the style again
g_dispatcher.addEvent(std::bind(&UICheckBox::setChecked, asUICheckBox(), node->value<bool>()));
}
}
}