diff options
author | Jacek Antonelli | 2008-09-06 18:24:57 -0500 |
---|---|---|
committer | Jacek Antonelli | 2008-09-06 18:25:07 -0500 |
commit | 798d367d54a6c6379ad355bd8345fa40e31e7fe9 (patch) | |
tree | 1921f1708cd0240648c97bc02df2c2ab5f2fc41e /linden/indra/llui/llbutton.cpp | |
parent | Second Life viewer sources 1.20.15 (diff) | |
download | meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.zip meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.gz meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.bz2 meta-impy-798d367d54a6c6379ad355bd8345fa40e31e7fe9.tar.xz |
Second Life viewer sources 1.21.0-RC
Diffstat (limited to 'linden/indra/llui/llbutton.cpp')
-rw-r--r-- | linden/indra/llui/llbutton.cpp | 153 |
1 files changed, 83 insertions, 70 deletions
diff --git a/linden/indra/llui/llbutton.cpp b/linden/indra/llui/llbutton.cpp index 3eead67..508500a 100644 --- a/linden/indra/llui/llbutton.cpp +++ b/linden/indra/llui/llbutton.cpp | |||
@@ -39,13 +39,10 @@ | |||
39 | 39 | ||
40 | // Project includes | 40 | // Project includes |
41 | #include "llkeyboard.h" | 41 | #include "llkeyboard.h" |
42 | #include "llgl.h" | ||
43 | #include "llui.h" | 42 | #include "llui.h" |
44 | #include "lluiconstants.h" | 43 | #include "lluiconstants.h" |
45 | //#include "llcallbacklist.h" | ||
46 | #include "llresmgr.h" | 44 | #include "llresmgr.h" |
47 | #include "llcriticaldamp.h" | 45 | #include "llcriticaldamp.h" |
48 | #include "llglheaders.h" | ||
49 | #include "llfocusmgr.h" | 46 | #include "llfocusmgr.h" |
50 | #include "llwindow.h" | 47 | #include "llwindow.h" |
51 | #include "llrender.h" | 48 | #include "llrender.h" |
@@ -62,7 +59,7 @@ S32 BTN_HEIGHT = 0; | |||
62 | S32 BTN_GRID = 12; | 59 | S32 BTN_GRID = 12; |
63 | S32 BORDER_SIZE = 1; | 60 | S32 BORDER_SIZE = 1; |
64 | 61 | ||
65 | LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& control_name, void (*click_callback)(void*), void *callback_data) | 62 | LLButton::LLButton( const std::string& name, const LLRect& rect, const std::string& control_name, void (*click_callback)(void*), void *callback_data) |
66 | : LLUICtrl(name, rect, TRUE, NULL, NULL), | 63 | : LLUICtrl(name, rect, TRUE, NULL, NULL), |
67 | mClickedCallback( click_callback ), | 64 | mClickedCallback( click_callback ), |
68 | mMouseDownCallback( NULL ), | 65 | mMouseDownCallback( NULL ), |
@@ -96,10 +93,10 @@ LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& co | |||
96 | mUnselectedLabel = name; | 93 | mUnselectedLabel = name; |
97 | mSelectedLabel = name; | 94 | mSelectedLabel = name; |
98 | 95 | ||
99 | setImageUnselected("button_enabled_32x128.tga"); | 96 | setImageUnselected(std::string("button_enabled_32x128.tga")); |
100 | setImageSelected("button_enabled_selected_32x128.tga"); | 97 | setImageSelected(std::string("button_enabled_selected_32x128.tga")); |
101 | setImageDisabled("button_disabled_32x128.tga"); | 98 | setImageDisabled(std::string("button_disabled_32x128.tga")); |
102 | setImageDisabledSelected("button_disabled_32x128.tga"); | 99 | setImageDisabledSelected(std::string("button_disabled_32x128.tga")); |
103 | 100 | ||
104 | mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); | 101 | mImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); |
105 | mDisabledImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); | 102 | mDisabledImageColor = LLUI::sColorsGroup->getColor( "ButtonImageColor" ); |
@@ -108,15 +105,15 @@ LLButton::LLButton( const LLString& name, const LLRect& rect, const LLString& co | |||
108 | } | 105 | } |
109 | 106 | ||
110 | 107 | ||
111 | LLButton::LLButton(const LLString& name, const LLRect& rect, | 108 | LLButton::LLButton(const std::string& name, const LLRect& rect, |
112 | const LLString &unselected_image_name, | 109 | const std::string &unselected_image_name, |
113 | const LLString &selected_image_name, | 110 | const std::string &selected_image_name, |
114 | const LLString& control_name, | 111 | const std::string& control_name, |
115 | void (*click_callback)(void*), | 112 | void (*click_callback)(void*), |
116 | void *callback_data, | 113 | void *callback_data, |
117 | const LLFontGL *font, | 114 | const LLFontGL *font, |
118 | const LLString& unselected_label, | 115 | const std::string& unselected_label, |
119 | const LLString& selected_label ) | 116 | const std::string& selected_label ) |
120 | : LLUICtrl(name, rect, TRUE, NULL, NULL), | 117 | : LLUICtrl(name, rect, TRUE, NULL, NULL), |
121 | mClickedCallback( click_callback ), | 118 | mClickedCallback( click_callback ), |
122 | mMouseDownCallback( NULL ), | 119 | mMouseDownCallback( NULL ), |
@@ -165,8 +162,8 @@ LLButton::LLButton(const LLString& name, const LLRect& rect, | |||
165 | } | 162 | } |
166 | else | 163 | else |
167 | { | 164 | { |
168 | setImageUnselected("button_enabled_32x128.tga"); | 165 | setImageUnselected(std::string("button_enabled_32x128.tga")); |
169 | setImageDisabled("button_disabled_32x128.tga"); | 166 | setImageDisabled(std::string("button_disabled_32x128.tga")); |
170 | } | 167 | } |
171 | 168 | ||
172 | if( selected_image_name != "" ) | 169 | if( selected_image_name != "" ) |
@@ -180,19 +177,19 @@ LLButton::LLButton(const LLString& name, const LLRect& rect, | |||
180 | } | 177 | } |
181 | else | 178 | else |
182 | { | 179 | { |
183 | setImageSelected("button_enabled_selected_32x128.tga"); | 180 | setImageSelected(std::string("button_enabled_selected_32x128.tga")); |
184 | setImageDisabledSelected("button_disabled_32x128.tga"); | 181 | setImageDisabledSelected(std::string("button_disabled_32x128.tga")); |
185 | } | 182 | } |
186 | 183 | ||
187 | init(click_callback, callback_data, font, control_name); | 184 | init(click_callback, callback_data, font, control_name); |
188 | } | 185 | } |
189 | 186 | ||
190 | void LLButton::init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const LLString& control_name) | 187 | void LLButton::init(void (*click_callback)(void*), void *callback_data, const LLFontGL* font, const std::string& control_name) |
191 | { | 188 | { |
192 | mGLFont = ( font ? font : LLFontGL::sSansSerif); | 189 | mGLFont = ( font ? font : LLFontGL::sSansSerif); |
193 | 190 | ||
194 | // Hack to make sure there is space for at least one character | 191 | // Hack to make sure there is space for at least one character |
195 | if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(" ")) | 192 | if (getRect().getWidth() - (mRightHPad + mLeftHPad) < mGLFont->getWidth(std::string(" "))) |
196 | { | 193 | { |
197 | // Use old defaults | 194 | // Use old defaults |
198 | mLeftHPad = LLBUTTON_ORIG_H_PAD; | 195 | mLeftHPad = LLBUTTON_ORIG_H_PAD; |
@@ -211,6 +208,7 @@ void LLButton::init(void (*click_callback)(void*), void *callback_data, const LL | |||
211 | mHighlightColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedFgColor" ) ); | 208 | mHighlightColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedFgColor" ) ); |
212 | mUnselectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedBgColor" ) ); | 209 | mUnselectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonUnselectedBgColor" ) ); |
213 | mSelectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonSelectedBgColor" ) ); | 210 | mSelectedBgColor = ( LLUI::sColorsGroup->getColor( "ButtonSelectedBgColor" ) ); |
211 | mFlashBgColor = ( LLUI::sColorsGroup->getColor( "ButtonFlashBgColor" ) ); | ||
214 | 212 | ||
215 | mImageOverlayAlignment = LLFontGL::HCENTER; | 213 | mImageOverlayAlignment = LLFontGL::HCENTER; |
216 | mImageOverlayColor = LLColor4::white; | 214 | mImageOverlayColor = LLColor4::white; |
@@ -324,7 +322,7 @@ BOOL LLButton::handleMouseDown(S32 x, S32 y, MASK mask) | |||
324 | } | 322 | } |
325 | 323 | ||
326 | mMouseDownTimer.start(); | 324 | mMouseDownTimer.start(); |
327 | mMouseDownFrame = LLFrameTimer::getFrameCount(); | 325 | mMouseDownFrame = (S32) LLFrameTimer::getFrameCount(); |
328 | 326 | ||
329 | if (getSoundFlags() & MOUSE_DOWN) | 327 | if (getSoundFlags() & MOUSE_DOWN) |
330 | { | 328 | { |
@@ -388,7 +386,7 @@ BOOL LLButton::handleHover(S32 x, S32 y, MASK mask) | |||
388 | if (mMouseDownTimer.getStarted() && NULL != mHeldDownCallback) | 386 | if (mMouseDownTimer.getStarted() && NULL != mHeldDownCallback) |
389 | { | 387 | { |
390 | F32 elapsed = getHeldDownTime(); | 388 | F32 elapsed = getHeldDownTime(); |
391 | if( mHeldDownDelay <= elapsed && mHeldDownFrameDelay <= LLFrameTimer::getFrameCount() - mMouseDownFrame) | 389 | if( mHeldDownDelay <= elapsed && mHeldDownFrameDelay <= (S32)LLFrameTimer::getFrameCount() - mMouseDownFrame) |
392 | { | 390 | { |
393 | mHeldDownCallback( mCallbackUserData ); | 391 | mHeldDownCallback( mCallbackUserData ); |
394 | } | 392 | } |
@@ -436,7 +434,9 @@ void LLButton::draw() | |||
436 | || mToggleState; | 434 | || mToggleState; |
437 | 435 | ||
438 | BOOL use_glow_effect = FALSE; | 436 | BOOL use_glow_effect = FALSE; |
439 | if ( mNeedsHighlight || flash ) | 437 | LLColor4 glow_color = LLColor4::white; |
438 | LLRender::eBlendType glow_type = LLRender::BT_ADD_WITH_ALPHA; | ||
439 | if ( mNeedsHighlight ) | ||
440 | { | 440 | { |
441 | if (pressed) | 441 | if (pressed) |
442 | { | 442 | { |
@@ -472,6 +472,16 @@ void LLButton::draw() | |||
472 | mImagep = mImageUnselected; | 472 | mImagep = mImageUnselected; |
473 | } | 473 | } |
474 | 474 | ||
475 | if (mFlashing) | ||
476 | { | ||
477 | use_glow_effect = TRUE; | ||
478 | glow_type = LLRender::BT_ALPHA; // blend the glow | ||
479 | if (mNeedsHighlight) // highlighted AND flashing | ||
480 | glow_color = (glow_color*0.5f + mFlashBgColor*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity | ||
481 | else | ||
482 | glow_color = mFlashBgColor; | ||
483 | } | ||
484 | |||
475 | // Override if more data is available | 485 | // Override if more data is available |
476 | // HACK: Use gray checked state to mean either: | 486 | // HACK: Use gray checked state to mean either: |
477 | // enabled and tentative | 487 | // enabled and tentative |
@@ -558,7 +568,10 @@ void LLButton::draw() | |||
558 | 568 | ||
559 | if (use_glow_effect) | 569 | if (use_glow_effect) |
560 | { | 570 | { |
561 | mCurGlowStrength = lerp(mCurGlowStrength, mHoverGlowStrength, LLCriticalDamp::getInterpolant(0.05f)); | 571 | mCurGlowStrength = lerp(mCurGlowStrength, |
572 | mFlashing ? (flash? 1.0 : 0.0) | ||
573 | : mHoverGlowStrength, | ||
574 | LLCriticalDamp::getInterpolant(0.05f)); | ||
562 | } | 575 | } |
563 | else | 576 | else |
564 | { | 577 | { |
@@ -574,8 +587,8 @@ void LLButton::draw() | |||
574 | mImagep->draw(getLocalRect(), getEnabled() ? mImageColor : mDisabledImageColor ); | 587 | mImagep->draw(getLocalRect(), getEnabled() ? mImageColor : mDisabledImageColor ); |
575 | if (mCurGlowStrength > 0.01f) | 588 | if (mCurGlowStrength > 0.01f) |
576 | { | 589 | { |
577 | gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); | 590 | gGL.setSceneBlendType(glow_type); |
578 | mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); | 591 | mImagep->drawSolid(0, 0, getRect().getWidth(), getRect().getHeight(), glow_color % mCurGlowStrength); |
579 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | 592 | gGL.setSceneBlendType(LLRender::BT_ALPHA); |
580 | } | 593 | } |
581 | } | 594 | } |
@@ -584,8 +597,8 @@ void LLButton::draw() | |||
584 | mImagep->draw(0, 0, getEnabled() ? mImageColor : mDisabledImageColor ); | 597 | mImagep->draw(0, 0, getEnabled() ? mImageColor : mDisabledImageColor ); |
585 | if (mCurGlowStrength > 0.01f) | 598 | if (mCurGlowStrength > 0.01f) |
586 | { | 599 | { |
587 | gGL.setSceneBlendType(LLRender::BT_ADD_WITH_ALPHA); | 600 | gGL.setSceneBlendType(glow_type); |
588 | mImagep->drawSolid(0, 0, LLColor4(1.f, 1.f, 1.f, mCurGlowStrength)); | 601 | mImagep->drawSolid(0, 0, glow_color % mCurGlowStrength); |
589 | gGL.setSceneBlendType(LLRender::BT_ALPHA); | 602 | gGL.setSceneBlendType(LLRender::BT_ALPHA); |
590 | } | 603 | } |
591 | } | 604 | } |
@@ -670,7 +683,7 @@ void LLButton::draw() | |||
670 | // Draw label | 683 | // Draw label |
671 | if( !label.empty() ) | 684 | if( !label.empty() ) |
672 | { | 685 | { |
673 | LLWString::trim(label); | 686 | LLWStringUtil::trim(label); |
674 | 687 | ||
675 | S32 x; | 688 | S32 x; |
676 | switch( mHAlign ) | 689 | switch( mHAlign ) |
@@ -777,7 +790,7 @@ void LLButton::setLabel( const LLStringExplicit& label ) | |||
777 | } | 790 | } |
778 | 791 | ||
779 | //virtual | 792 | //virtual |
780 | BOOL LLButton::setLabelArg( const LLString& key, const LLStringExplicit& text ) | 793 | BOOL LLButton::setLabelArg( const std::string& key, const LLStringExplicit& text ) |
781 | { | 794 | { |
782 | mUnselectedLabel.setArg(key, text); | 795 | mUnselectedLabel.setArg(key, text); |
783 | mSelectedLabel.setArg(key, text); | 796 | mSelectedLabel.setArg(key, text); |
@@ -809,7 +822,7 @@ void LLButton::setImageUnselected(LLPointer<LLUIImage> image) | |||
809 | mImageUnselected = image; | 822 | mImageUnselected = image; |
810 | } | 823 | } |
811 | 824 | ||
812 | void LLButton::setImages( const LLString &image_name, const LLString &selected_name ) | 825 | void LLButton::setImages( const std::string &image_name, const std::string &selected_name ) |
813 | { | 826 | { |
814 | setImageUnselected(image_name); | 827 | setImageUnselected(image_name); |
815 | setImageSelected(selected_name); | 828 | setImageSelected(selected_name); |
@@ -846,7 +859,7 @@ void LLButton::setImageDisabledSelected(LLPointer<LLUIImage> image) | |||
846 | mDisabledImageColor.mV[VALPHA] *= 0.5f; | 859 | mDisabledImageColor.mV[VALPHA] *= 0.5f; |
847 | } | 860 | } |
848 | 861 | ||
849 | void LLButton::setDisabledImages( const LLString &image_name, const LLString &selected_name, const LLColor4& c ) | 862 | void LLButton::setDisabledImages( const std::string &image_name, const std::string &selected_name, const LLColor4& c ) |
850 | { | 863 | { |
851 | setImageDisabled(image_name); | 864 | setImageDisabled(image_name); |
852 | setImageDisabledSelected(selected_name); | 865 | setImageDisabledSelected(selected_name); |
@@ -858,7 +871,7 @@ void LLButton::setImageHoverSelected(LLPointer<LLUIImage> image) | |||
858 | mImageHoverSelected = image; | 871 | mImageHoverSelected = image; |
859 | } | 872 | } |
860 | 873 | ||
861 | void LLButton::setDisabledImages( const LLString &image_name, const LLString &selected_name) | 874 | void LLButton::setDisabledImages( const std::string &image_name, const std::string &selected_name) |
862 | { | 875 | { |
863 | LLColor4 clr = mImageColor; | 876 | LLColor4 clr = mImageColor; |
864 | clr.mV[VALPHA] *= .5f; | 877 | clr.mV[VALPHA] *= .5f; |
@@ -870,13 +883,13 @@ void LLButton::setImageHoverUnselected(LLPointer<LLUIImage> image) | |||
870 | mImageHoverUnselected = image; | 883 | mImageHoverUnselected = image; |
871 | } | 884 | } |
872 | 885 | ||
873 | void LLButton::setHoverImages( const LLString& image_name, const LLString& selected_name ) | 886 | void LLButton::setHoverImages( const std::string& image_name, const std::string& selected_name ) |
874 | { | 887 | { |
875 | setImageHoverUnselected(image_name); | 888 | setImageHoverUnselected(image_name); |
876 | setImageHoverSelected(selected_name); | 889 | setImageHoverSelected(selected_name); |
877 | } | 890 | } |
878 | 891 | ||
879 | void LLButton::setImageOverlay(const LLString &image_name, LLFontGL::HAlign alignment, const LLColor4& color) | 892 | void LLButton::setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment, const LLColor4& color) |
880 | { | 893 | { |
881 | if (image_name.empty()) | 894 | if (image_name.empty()) |
882 | { | 895 | { |
@@ -915,54 +928,54 @@ S32 round_up(S32 grid, S32 value) | |||
915 | } | 928 | } |
916 | } | 929 | } |
917 | 930 | ||
918 | void LLButton::setImageUnselected(const LLString &image_name) | 931 | void LLButton::setImageUnselected(const std::string &image_name) |
919 | { | 932 | { |
920 | setImageUnselected(LLUI::getUIImage(image_name)); | 933 | setImageUnselected(LLUI::getUIImage(image_name)); |
921 | mImageUnselectedName = image_name; | 934 | mImageUnselectedName = image_name; |
922 | } | 935 | } |
923 | 936 | ||
924 | void LLButton::setImageSelected(const LLString &image_name) | 937 | void LLButton::setImageSelected(const std::string &image_name) |
925 | { | 938 | { |
926 | setImageSelected(LLUI::getUIImage(image_name)); | 939 | setImageSelected(LLUI::getUIImage(image_name)); |
927 | mImageSelectedName = image_name; | 940 | mImageSelectedName = image_name; |
928 | } | 941 | } |
929 | 942 | ||
930 | void LLButton::setImageHoverSelected(const LLString &image_name) | 943 | void LLButton::setImageHoverSelected(const std::string &image_name) |
931 | { | 944 | { |
932 | setImageHoverSelected(LLUI::getUIImage(image_name)); | 945 | setImageHoverSelected(LLUI::getUIImage(image_name)); |
933 | mImageHoverSelectedName = image_name; | 946 | mImageHoverSelectedName = image_name; |
934 | } | 947 | } |
935 | 948 | ||
936 | void LLButton::setImageHoverUnselected(const LLString &image_name) | 949 | void LLButton::setImageHoverUnselected(const std::string &image_name) |
937 | { | 950 | { |
938 | setImageHoverUnselected(LLUI::getUIImage(image_name)); | 951 | setImageHoverUnselected(LLUI::getUIImage(image_name)); |
939 | mImageHoverUnselectedName = image_name; | 952 | mImageHoverUnselectedName = image_name; |
940 | } | 953 | } |
941 | 954 | ||
942 | void LLButton::setImageDisabled(const LLString &image_name) | 955 | void LLButton::setImageDisabled(const std::string &image_name) |
943 | { | 956 | { |
944 | setImageDisabled(LLUI::getUIImage(image_name)); | 957 | setImageDisabled(LLUI::getUIImage(image_name)); |
945 | mImageDisabledName = image_name; | 958 | mImageDisabledName = image_name; |
946 | } | 959 | } |
947 | 960 | ||
948 | void LLButton::setImageDisabledSelected(const LLString &image_name) | 961 | void LLButton::setImageDisabledSelected(const std::string &image_name) |
949 | { | 962 | { |
950 | setImageDisabledSelected(LLUI::getUIImage(image_name)); | 963 | setImageDisabledSelected(LLUI::getUIImage(image_name)); |
951 | mImageDisabledSelectedName = image_name; | 964 | mImageDisabledSelectedName = image_name; |
952 | } | 965 | } |
953 | 966 | ||
954 | void LLButton::addImageAttributeToXML(LLXMLNodePtr node, | 967 | void LLButton::addImageAttributeToXML(LLXMLNodePtr node, |
955 | const LLString& image_name, | 968 | const std::string& image_name, |
956 | const LLUUID& image_id, | 969 | const LLUUID& image_id, |
957 | const LLString& xml_tag_name) const | 970 | const std::string& xml_tag_name) const |
958 | { | 971 | { |
959 | if( !image_name.empty() ) | 972 | if( !image_name.empty() ) |
960 | { | 973 | { |
961 | node->createChild(xml_tag_name, TRUE)->setStringValue(image_name); | 974 | node->createChild(xml_tag_name.c_str(), TRUE)->setStringValue(image_name); |
962 | } | 975 | } |
963 | else if( image_id != LLUUID::null ) | 976 | else if( image_id != LLUUID::null ) |
964 | { | 977 | { |
965 | node->createChild(xml_tag_name + "_id", TRUE)->setUUIDValue(image_id); | 978 | node->createChild((xml_tag_name + "_id").c_str(), TRUE)->setUUIDValue(image_id); |
966 | } | 979 | } |
967 | } | 980 | } |
968 | 981 | ||
@@ -976,12 +989,12 @@ LLXMLNodePtr LLButton::getXML(bool save_children) const | |||
976 | node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); | 989 | node->createChild("font", TRUE)->setStringValue(LLFontGL::nameFromFont(mGLFont)); |
977 | node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); | 990 | node->createChild("halign", TRUE)->setStringValue(LLFontGL::nameFromHAlign(mHAlign)); |
978 | 991 | ||
979 | addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,"image_unselected"); | 992 | addImageAttributeToXML(node,mImageUnselectedName,mImageUnselectedID,std::string("image_unselected")); |
980 | addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,"image_selected"); | 993 | addImageAttributeToXML(node,mImageSelectedName,mImageSelectedID,std::string("image_selected")); |
981 | addImageAttributeToXML(node,mImageHoverSelectedName,mImageHoverSelectedID,"image_hover_selected"); | 994 | addImageAttributeToXML(node,mImageHoverSelectedName,mImageHoverSelectedID,std::string("image_hover_selected")); |
982 | addImageAttributeToXML(node,mImageHoverUnselectedName,mImageHoverUnselectedID,"image_hover_unselected"); | 995 | addImageAttributeToXML(node,mImageHoverUnselectedName,mImageHoverUnselectedID,std::string("image_hover_unselected")); |
983 | addImageAttributeToXML(node,mImageDisabledName,mImageDisabledID,"image_disabled"); | 996 | addImageAttributeToXML(node,mImageDisabledName,mImageDisabledID,std::string("image_disabled")); |
984 | addImageAttributeToXML(node,mImageDisabledSelectedName,mImageDisabledSelectedID,"image_disabled_selected"); | 997 | addImageAttributeToXML(node,mImageDisabledSelectedName,mImageDisabledSelectedID,std::string("image_disabled_selected")); |
985 | 998 | ||
986 | node->createChild("scale_image", TRUE)->setBoolValue(mScaleImage); | 999 | node->createChild("scale_image", TRUE)->setBoolValue(mScaleImage); |
987 | 1000 | ||
@@ -1004,40 +1017,40 @@ void clicked_help(void* data) | |||
1004 | // static | 1017 | // static |
1005 | LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) | 1018 | LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory) |
1006 | { | 1019 | { |
1007 | LLString name("button"); | 1020 | std::string name("button"); |
1008 | node->getAttributeString("name", name); | 1021 | node->getAttributeString("name", name); |
1009 | 1022 | ||
1010 | LLString label = name; | 1023 | std::string label = name; |
1011 | node->getAttributeString("label", label); | 1024 | node->getAttributeString("label", label); |
1012 | 1025 | ||
1013 | LLString label_selected = label; | 1026 | std::string label_selected = label; |
1014 | node->getAttributeString("label_selected", label_selected); | 1027 | node->getAttributeString("label_selected", label_selected); |
1015 | 1028 | ||
1016 | LLFontGL* font = selectFont(node); | 1029 | LLFontGL* font = selectFont(node); |
1017 | 1030 | ||
1018 | LLString image_unselected; | 1031 | std::string image_unselected; |
1019 | if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); | 1032 | if (node->hasAttribute("image_unselected")) node->getAttributeString("image_unselected",image_unselected); |
1020 | 1033 | ||
1021 | LLString image_selected; | 1034 | std::string image_selected; |
1022 | if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected); | 1035 | if (node->hasAttribute("image_selected")) node->getAttributeString("image_selected",image_selected); |
1023 | 1036 | ||
1024 | LLString image_hover_selected; | 1037 | std::string image_hover_selected; |
1025 | if (node->hasAttribute("image_hover_selected")) node->getAttributeString("image_hover_selected",image_hover_selected); | 1038 | if (node->hasAttribute("image_hover_selected")) node->getAttributeString("image_hover_selected",image_hover_selected); |
1026 | 1039 | ||
1027 | LLString image_hover_unselected; | 1040 | std::string image_hover_unselected; |
1028 | if (node->hasAttribute("image_hover_unselected")) node->getAttributeString("image_hover_unselected",image_hover_unselected); | 1041 | if (node->hasAttribute("image_hover_unselected")) node->getAttributeString("image_hover_unselected",image_hover_unselected); |
1029 | 1042 | ||
1030 | LLString image_disabled_selected; | 1043 | std::string image_disabled_selected; |
1031 | if (node->hasAttribute("image_disabled_selected")) node->getAttributeString("image_disabled_selected",image_disabled_selected); | 1044 | if (node->hasAttribute("image_disabled_selected")) node->getAttributeString("image_disabled_selected",image_disabled_selected); |
1032 | 1045 | ||
1033 | LLString image_disabled; | 1046 | std::string image_disabled; |
1034 | if (node->hasAttribute("image_disabled")) node->getAttributeString("image_disabled",image_disabled); | 1047 | if (node->hasAttribute("image_disabled")) node->getAttributeString("image_disabled",image_disabled); |
1035 | 1048 | ||
1036 | LLString image_overlay; | 1049 | std::string image_overlay; |
1037 | node->getAttributeString("image_overlay", image_overlay); | 1050 | node->getAttributeString("image_overlay", image_overlay); |
1038 | 1051 | ||
1039 | LLFontGL::HAlign image_overlay_alignment = LLFontGL::HCENTER; | 1052 | LLFontGL::HAlign image_overlay_alignment = LLFontGL::HCENTER; |
1040 | LLString image_overlay_alignment_string; | 1053 | std::string image_overlay_alignment_string; |
1041 | if (node->hasAttribute("image_overlay_alignment")) | 1054 | if (node->hasAttribute("image_overlay_alignment")) |
1042 | { | 1055 | { |
1043 | node->getAttributeString("image_overlay_alignment", image_overlay_alignment_string); | 1056 | node->getAttributeString("image_overlay_alignment", image_overlay_alignment_string); |
@@ -1049,7 +1062,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa | |||
1049 | LLRect(), | 1062 | LLRect(), |
1050 | image_unselected, | 1063 | image_unselected, |
1051 | image_selected, | 1064 | image_selected, |
1052 | "", | 1065 | LLStringUtil::null, |
1053 | NULL, | 1066 | NULL, |
1054 | parent, | 1067 | parent, |
1055 | font, | 1068 | font, |
@@ -1063,15 +1076,15 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa | |||
1063 | node->getAttributeBOOL("toggle", is_toggle); | 1076 | node->getAttributeBOOL("toggle", is_toggle); |
1064 | button->setIsToggle(is_toggle); | 1077 | button->setIsToggle(is_toggle); |
1065 | 1078 | ||
1066 | if(image_hover_selected != LLString::null) button->setImageHoverSelected(image_hover_selected); | 1079 | if(image_hover_selected != LLStringUtil::null) button->setImageHoverSelected(image_hover_selected); |
1067 | 1080 | ||
1068 | if(image_hover_unselected != LLString::null) button->setImageHoverUnselected(image_hover_unselected); | 1081 | if(image_hover_unselected != LLStringUtil::null) button->setImageHoverUnselected(image_hover_unselected); |
1069 | 1082 | ||
1070 | if(image_disabled_selected != LLString::null) button->setImageDisabledSelected(image_disabled_selected ); | 1083 | if(image_disabled_selected != LLStringUtil::null) button->setImageDisabledSelected(image_disabled_selected ); |
1071 | 1084 | ||
1072 | if(image_disabled != LLString::null) button->setImageDisabled(image_disabled); | 1085 | if(image_disabled != LLStringUtil::null) button->setImageDisabled(image_disabled); |
1073 | 1086 | ||
1074 | if(image_overlay != LLString::null) button->setImageOverlay(image_overlay, image_overlay_alignment); | 1087 | if(image_overlay != LLStringUtil::null) button->setImageOverlay(image_overlay, image_overlay_alignment); |
1075 | 1088 | ||
1076 | if (node->hasAttribute("halign")) | 1089 | if (node->hasAttribute("halign")) |
1077 | { | 1090 | { |
@@ -1097,7 +1110,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa | |||
1097 | 1110 | ||
1098 | if (node->hasAttribute("help_url")) | 1111 | if (node->hasAttribute("help_url")) |
1099 | { | 1112 | { |
1100 | LLString help_url; | 1113 | std::string help_url; |
1101 | node->getAttributeString("help_url",help_url); | 1114 | node->getAttributeString("help_url",help_url); |
1102 | button->setHelpURLCallback(help_url); | 1115 | button->setHelpURLCallback(help_url); |
1103 | } | 1116 | } |
@@ -1107,7 +1120,7 @@ LLView* LLButton::fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *fa | |||
1107 | return button; | 1120 | return button; |
1108 | } | 1121 | } |
1109 | 1122 | ||
1110 | void LLButton::setHelpURLCallback(const LLString &help_url) | 1123 | void LLButton::setHelpURLCallback(const std::string &help_url) |
1111 | { | 1124 | { |
1112 | mHelpURL = help_url; | 1125 | mHelpURL = help_url; |
1113 | setClickedCallback(clicked_help,this); | 1126 | setClickedCallback(clicked_help,this); |