예제 #1
0
void UITextEdit::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() == "shift-navigation")
            setShiftNavigation(node->value<bool>());
        else if(node->tag() == "multiline")
            setMultiline(node->value<bool>());
        else if(node->tag() == "max-length")
            setMaxLength(node->value<int>());
    }
}
예제 #2
0
void UITextEdit::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() == "shift-navigation")
            setShiftNavigation(node->value<bool>());
        else if(node->tag() == "multiline")
            setMultiline(node->value<bool>());
        else if(node->tag() == "max-length")
            setMaxLength(node->value<int>());
        else if(node->tag() == "editable")
            setEditable(node->value<bool>());
        else if(node->tag() == "selectable")
            setSelectable(node->value<bool>());
        else if(node->tag() == "selection-color")
            setSelectionColor(node->value<Color>());
        else if(node->tag() == "selection-background-color")
            setSelectionBackgroundColor(node->value<Color>());
        else if(node->tag() == "selection") {
            Point selectionRange = node->value<Point>();
            setSelection(selectionRange.x, selectionRange.y);
        }
        else if(node->tag() == "cursor-visible")
            setCursorVisible(node->value<bool>());
        else if(node->tag() == "change-cursor-image")
            setChangeCursorImage(node->value<bool>());
        else if(node->tag() == "auto-scroll")
            setAutoScroll(node->value<bool>());
    }
}