当前位置: 首页>>代码示例>>C++>>正文


C++ OTMLNodePtr::children方法代码示例

本文整理汇总了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;
}
开发者ID:Xenioz,项目名称:otclient,代码行数:33,代码来源:uimanager.cpp

示例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;
}
开发者ID:Cayan,项目名称:otclient,代码行数:30,代码来源:particleaffector.cpp

示例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>());
    }
}
开发者ID:JoseEduardo,项目名称:otclient,代码行数:9,代码来源:uiprogressrect.cpp

示例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>());
    }
}
开发者ID:JoseEduardo,项目名称:otclient,代码行数:9,代码来源:uihorizontallayout.cpp

示例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();
    }
}
开发者ID:JoseEduardo,项目名称:otclient,代码行数:10,代码来源:particleeffect.cpp

示例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;
}
开发者ID:JoseEduardo,项目名称:otclient,代码行数:10,代码来源:config.cpp

示例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>());
    }
}
开发者ID:Xenioz,项目名称:otclient,代码行数:11,代码来源:uiboxlayout.cpp

示例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>());
    }
}
开发者ID:Cadyan,项目名称:otclient,代码行数:12,代码来源:uiminimap.cpp

示例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;
}
开发者ID:HeberPcL,项目名称:otclient,代码行数:16,代码来源:luavaluecasts.cpp

示例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);
        }
    }
}
开发者ID:JoseEduardo,项目名称:otclient,代码行数:17,代码来源:thingtype.cpp

示例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>();
    }
}
开发者ID:Ablankzin,项目名称:otclient,代码行数:17,代码来源:uiitem.cpp

示例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;
        }
    }
}
开发者ID:brun123,项目名称:otclient,代码行数:17,代码来源:uilineedit.cpp

示例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>());
    }
}
开发者ID:AndreFaramir,项目名称:otclient,代码行数:18,代码来源:uilineedit.cpp

示例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>());
    }
}
开发者ID:JoseEduardo,项目名称:otclient,代码行数:43,代码来源:uiwidgetimage.cpp

示例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>()));
        }
    }
}
开发者ID:brun123,项目名称:otclient,代码行数:19,代码来源:uicheckbox.cpp


注:本文中的OTMLNodePtr::children方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。