From b5a1b8fc24b432619f172e276d869577429a7197 Mon Sep 17 00:00:00 2001 From: McCabe Maxsted Date: Sun, 15 May 2011 14:22:04 -0700 Subject: Implemented 'label_disabled' and 'label_selected_disabled' XUI for LLButton --- linden/indra/llui/llbutton.cpp | 18 ++++++++++++++++-- linden/indra/llui/llbutton.h | 6 +++++- 2 files changed, 21 insertions(+), 3 deletions(-) (limited to 'linden/indra') diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp index 702e34e..6c0891c 100644 --- a/linden/indra/llui/llbutton.cpp +++ b/linden/indra/llui/llbutton.cpp @@ -115,7 +115,9 @@ LLButton::LLButton(const std::string& name, const LLRect& rect, void *callback_data, const LLFontGL *font, const std::string& unselected_label, - const std::string& selected_label ) + const std::string& selected_label, + const std::string& disabled_label, + const std::string& disabled_selected_label) : LLUICtrl(name, rect, TRUE, NULL, NULL), mClickedCallback( click_callback ), mMouseDownCallback( NULL ), @@ -148,6 +150,8 @@ LLButton::LLButton(const std::string& name, const LLRect& rect, { mUnselectedLabel = unselected_label; mSelectedLabel = selected_label; + mDisabledLabel = disabled_label; + mDisabledSelectedLabel = disabled_selected_label; // by default, disabled color is same as enabled mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); @@ -989,6 +993,8 @@ LLXMLNodePtr LLButton::getXML(bool save_children) const node->createChild("label", TRUE)->setStringValue(getLabelUnselected()); node->createChild("label_selected", TRUE)->setStringValue(getLabelSelected()); + node->createChild("label_disabled", TRUE)->setStringValue(getLabelDisabled()); + node->createChild("label_selected_disabled", TRUE)->setStringValue(getLabelDisabledSelected()); node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); @@ -1029,6 +1035,12 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa std::string label_selected = label; node->getAttributeString("label_selected", label_selected); + std::string label_disabled = label; + node->getAttributeString("label_disabled", label_disabled); + + std::string label_disabled_selected = label; + node->getAttributeString("label_disabled_selected", label_disabled_selected); + LLFontGL* font = selectFont(node); std::string image_unselected; @@ -1070,7 +1082,9 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa parent, font, label, - label_selected); + label_selected, + label_disabled, + label_disabled_selected); node->getAttributeS32("pad_right", button->mRightHPad); node->getAttributeS32("pad_left", button->mLeftHPad); diff --git a/linden/indra/llui/llbutton.h b/linden/indra/llui/llbutton.h index 2174d95..73ac446 100644 --- a/linden/indra/llui/llbutton.h +++ b/linden/indra/llui/llbutton.h @@ -84,7 +84,9 @@ public: void *callback_data = NULL, const LLFontGL* mGLFont = NULL, const std::string& unselected_label = LLStringUtil::null, - const std::string& selected_label = LLStringUtil::null ); + const std::string& selected_label = LLStringUtil::null, + const std::string& disabled_label = LLStringUtil::null, + const std::string& disabled_selected_label = LLStringUtil::null); virtual ~LLButton(); void init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name); @@ -133,6 +135,8 @@ public: const std::string getLabelUnselected() const { return wstring_to_utf8str(mUnselectedLabel); } const std::string getLabelSelected() const { return wstring_to_utf8str(mSelectedLabel); } + const std::string getLabelDisabled() const { return wstring_to_utf8str(mDisabledLabel); } + const std::string getLabelDisabledSelected() const { return wstring_to_utf8str(mDisabledSelectedLabel); } void setImageColor(const std::string& color_control); void setImageColor(const LLColor4& c); -- cgit v1.1