// static LLView* LLJoystickAgentSlide::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { std::string name("button"); node->getAttributeString("name", name); std::string image_unselected; if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); std::string image_selected; if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected); EJoystickQuadrant quad = JQ_ORIGIN; if (node->hasAttribute("quadrant")) quad = selectQuadrant(node); LLJoystickAgentSlide *button = new LLJoystickAgentSlide(name, LLRect(), image_unselected, image_selected, quad); if (node->hasAttribute("halign")) { LLFontGL::HAlign halign = selectFontHAlign(node); button->setHAlign(halign); } if (node->hasAttribute("scale_image")) { BOOL needsScale = FALSE; node->getAttributeBOOL("scale_image",needsScale); button->setScaleImage( needsScale ); } button->initFromXML(node, parent); return button; }
// static LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) { std::string name("button"); node->getAttributeString("name", name); std::string label = name; node->getAttributeString("label", label); std::string label_selected = label; node->getAttributeString("label_selected", label_selected); LLFontGL* font = selectFont(node); std::string image_unselected; if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); std::string image_selected; if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected); std::string image_hover_selected; if (node->hasAttribute("image_hover_selected")) node->getAttributeString("image_hover_selected",image_hover_selected); std::string image_hover_unselected; if (node->hasAttribute("image_hover_unselected")) node->getAttributeString("image_hover_unselected",image_hover_unselected); std::string image_disabled_selected; if (node->hasAttribute("image_disabled_selected")) node->getAttributeString("image_disabled_selected",image_disabled_selected); std::string image_disabled; if (node->hasAttribute("image_disabled")) node->getAttributeString("image_disabled",image_disabled); std::string image_overlay; node->getAttributeString("image_overlay", image_overlay); LLFontGL::HAlign image_overlay_alignment = LLFontGL::HCENTER; std::string image_overlay_alignment_string; if (node->hasAttribute("image_overlay_alignment")) { node->getAttributeString("image_overlay_alignment", image_overlay_alignment_string); image_overlay_alignment = LLFontGL::hAlignFromName(image_overlay_alignment_string); } LLButton *button = new LLButton(name, LLRect(), image_unselected, image_selected, LLStringUtil::null, NULL, parent, font, label, label_selected); node->getAttributeS32("pad_right", button->mRightHPad); node->getAttributeS32("pad_left", button->mLeftHPad); BOOL is_toggle = button->getIsToggle(); node->getAttributeBOOL("toggle", is_toggle); button->setIsToggle(is_toggle); if(image_hover_selected != LLStringUtil::null) button->setImageHoverSelected(image_hover_selected); if(image_hover_unselected != LLStringUtil::null) button->setImageHoverUnselected(image_hover_unselected); if(image_disabled_selected != LLStringUtil::null) button->setImageDisabledSelected(image_disabled_selected ); if(image_disabled != LLStringUtil::null) button->setImageDisabled(image_disabled); if(image_overlay != LLStringUtil::null) button->setImageOverlay(image_overlay, image_overlay_alignment); if (node->hasAttribute("halign")) { LLFontGL::HAlign halign = selectFontHAlign(node); button->setHAlign(halign); } if (node->hasAttribute("scale_image")) { BOOL needsScale = FALSE; node->getAttributeBOOL("scale_image",needsScale); button->setScaleImage( needsScale ); } if(label.empty()) { button->setLabelUnselected(node->getTextContents()); } if (label_selected.empty()) { button->setLabelSelected(node->getTextContents()); } if (node->hasAttribute("help_url")) { std::string help_url; node->getAttributeString("help_url",help_url); button->setHelpURLCallback(help_url); } button->initFromXML(node, parent); return button; }