本文整理汇总了C++中LLXMLNodePtr::hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ LLXMLNodePtr::hasAttribute方法的具体用法?C++ LLXMLNodePtr::hasAttribute怎么用?C++ LLXMLNodePtr::hasAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LLXMLNodePtr
的用法示例。
在下文中一共展示了LLXMLNodePtr::hasAttribute方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getBevelFromAttribute
BOOL LLViewBorder::getBevelFromAttribute(LLXMLNodePtr node, LLViewBorder::EBevel& bevel_style)
{
if (node->hasAttribute("bevel_style"))
{
std::string bevel_string;
node->getAttributeString("bevel_style", bevel_string);
LLStringUtil::toLower(bevel_string);
if (bevel_string == "none")
{
bevel_style = LLViewBorder::BEVEL_NONE;
}
else if (bevel_string == "in")
{
bevel_style = LLViewBorder::BEVEL_IN;
}
else if (bevel_string == "out")
{
bevel_style = LLViewBorder::BEVEL_OUT;
}
else if (bevel_string == "bright")
{
bevel_style = LLViewBorder::BEVEL_BRIGHT;
}
return TRUE;
}
return FALSE;
}
示例2: getXML
// virtual
LLXMLNodePtr LLSpinCtrl::getXML(bool save_children) const
{
LLXMLNodePtr node = LLUICtrl::getXML();
node->setName(LL_SPIN_CTRL_TAG);
node->createChild("decimal_digits", TRUE)->setIntValue(mPrecision);
if (mLabelBox)
{
node->createChild("label", TRUE)->setStringValue(mLabelBox->getText());
node->createChild("label_width", TRUE)->setIntValue(mLabelBox->getRect().getWidth());
if (node->hasAttribute("font"))
{
node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mFontGL));
}
}
node->createChild("initial_val", TRUE)->setFloatValue(mInitialValue);
node->createChild("min_val", TRUE)->setFloatValue(mMinValue);
node->createChild("max_val", TRUE)->setFloatValue(mMaxValue);
node->createChild("increment", TRUE)->setFloatValue(mIncrement);
addColorXML(node, mTextEnabledColor, "text_enabled_color", "LabelTextColor");
addColorXML(node, mTextDisabledColor, "text_disabled_color", "LabelDisabledColor");
return node;
}
示例3: selectQuadrant
EJoystickQuadrant LLJoystick::selectQuadrant(LLXMLNodePtr node)
{
EJoystickQuadrant quadrant = JQ_RIGHT;
if (node->hasAttribute("quadrant"))
{
std::string quadrant_name;
node->getAttributeString("quadrant", quadrant_name);
quadrant = quadrantFromName(quadrant_name);
}
return quadrant;
}
示例4: initPanelXML
BOOL LLLayoutPanel::initPanelXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string orientation_string;
node->getAttributeString("orientation", orientation_string);
if (orientation_string == "horizontal")
{
mOrientation = LLLayoutStack::HORIZONTAL;
}
else if (orientation_string == "vertical")
{
mOrientation = LLLayoutStack::VERTICAL;
}
if(node->hasAttribute("min_dim"))
node->getAttributeS32("min_dim", mMinDim);
else if(mOrientation == LLLayoutStack::HORIZONTAL)
node->getAttributeS32("min_width", mMinDim);
else if(mOrientation == LLLayoutStack::VERTICAL)
node->getAttributeS32("min_height", mMinDim);
node->getAttributeS32("expanded_min_dim", mExpandedMinDim);
BOOL auto_resize = mAutoResize;
BOOL user_resize = mUserResize;
node->getAttributeBOOL("auto_resize", auto_resize);
node->getAttributeBOOL("user_resize", user_resize);
mAutoResize = auto_resize;
mUserResize = user_resize;
bool ret = LLPanel::initPanelXML(node,parent,factory);
// panels initialized as hidden should not start out partially visible
if (!getVisible())
{
mVisibleAmt = 0.f;
}
setFollowsNone();
return ret;
}
示例5: fromXML
// static
LLView* LLComboBox::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("combo_box");
node->getAttributeString("name", name);
std::string label("");
node->getAttributeString("label", label);
LLRect rect;
createRect(node, rect, parent, LLRect());
BOOL allow_text_entry = FALSE;
node->getAttributeBOOL("allow_text_entry", allow_text_entry);
S32 max_chars = 20;
node->getAttributeS32("max_chars", max_chars);
LLUICtrlCallback callback = NULL;
LLComboBox* combo_box = new LLComboBox(name,
rect,
label,
callback,
NULL);
combo_box->setAllowTextEntry(allow_text_entry, max_chars);
combo_box->initFromXML(node, parent);
const std::string& contents = node->getValue();
if (contents.find_first_not_of(" \n\t") != contents.npos)
{
llerrs << "Legacy combo box item format used! Please convert to <combo_item> tags!" << llendl;
}
else
{
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
if (child->hasName("combo_item"))
{
std::string label = child->getTextContents();
std::string value = label;
child->getAttributeString("value", value);
LLScrollListItem * item=combo_box->add(label, LLSD(value) );
if(item && child->hasAttribute("tool_tip"))
{
std::string tool_tip = label;
child->getAttributeString("tool_tip", tool_tip);
item->setToolTip(tool_tip);
}
}
}
}
// if providing user text entry or descriptive label
// don't select an item under the hood
if (!combo_box->acceptsTextInput() && combo_box->mLabel.empty())
{
combo_box->selectFirstItem();
}
return combo_box;
}
示例6: fromXML
LLView* LLNameListCtrl::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory)
{
std::string name("name_list");
node->getAttributeString("name", name);
LLRect rect;
createRect(node, rect, parent, LLRect());
BOOL multi_select = FALSE;
node->getAttributeBOOL("multi_select", multi_select);
BOOL draw_border = TRUE;
node->getAttributeBOOL("draw_border", draw_border);
BOOL draw_heading = FALSE;
node->getAttributeBOOL("draw_heading", draw_heading);
S32 name_column_index = 0;
node->getAttributeS32("name_column_index", name_column_index);
LLUICtrlCallback callback = NULL;
LLNameListCtrl* name_list = new LLNameListCtrl(name,
rect,
callback,
NULL,
multi_select,
draw_border,
name_column_index);
name_list->setDisplayHeading(draw_heading);
if (node->hasAttribute("heading_height"))
{
S32 heading_height;
node->getAttributeS32("heading_height", heading_height);
name_list->setHeadingHeight(heading_height);
}
BOOL allow_calling_card_drop = FALSE;
if (node->getAttributeBOOL("allow_calling_card_drop", allow_calling_card_drop))
{
name_list->setAllowCallingCardDrop(allow_calling_card_drop);
}
name_list->setScrollListParameters(node);
name_list->initFromXML(node, parent);
LLSD columns;
S32 index = 0;
S32 total_static = 0;
LLXMLNodePtr child;
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
{
if (child->hasName("column"))
{
std::string labelname("");
child->getAttributeString("label", labelname);
std::string columnname(labelname);
child->getAttributeString("name", columnname);
BOOL columndynamicwidth = FALSE;
child->getAttributeBOOL("dynamicwidth", columndynamicwidth);
std::string sortname(columnname);
child->getAttributeString("sort", sortname);
S32 columnwidth = -1;
if (child->hasAttribute("relwidth"))
{
F32 columnrelwidth = 0.f;
child->getAttributeF32("relwidth", columnrelwidth);
columns[index]["relwidth"] = columnrelwidth;
}
else
{
child->getAttributeS32("width", columnwidth);
columns[index]["width"] = columnwidth;
}
LLFontGL::HAlign h_align = LLFontGL::LEFT;
h_align = LLView::selectFontHAlign(child);
if(!columndynamicwidth) total_static += llmax(0, columnwidth);
columns[index]["name"] = columnname;
columns[index]["label"] = labelname;
columns[index]["halign"] = (S32)h_align;
columns[index]["dynamicwidth"] = columndynamicwidth;
columns[index]["sort"] = sortname;
index++;
}
}
name_list->setTotalStaticColumnWidth(total_static);
name_list->setColumnHeadings(columns);
for (child = node->getFirstChild(); child.notNull(); child = child->getNextSibling())
//.........这里部分代码省略.........