diff options
author | Andrew Dyukov <adyukov@productengine.com> | 2010-05-31 22:30:35 +0300 |
---|---|---|
committer | Andrew Dyukov <adyukov@productengine.com> | 2010-05-31 22:30:35 +0300 |
commit | 66ddb437f1eb8327ff74a26943400b9911289a15 (patch) | |
tree | 25c558801eb234c250975cd6b7f163f07784ea54 /indra/llui | |
parent | b3c1e9cd75ed228b9457afca0939a033d56680c0 (diff) |
EXT-7087 FIXED Added flashing icons for im tabs and hooked them up in code
Added new attribute image_flash to button.xml which sets an image used for button icon when button is flashing.
Pointer to this image is stored in member mImageFlash from LLButton and is used in LLButton::draw(). There are two
ways an image can flash now - by making changes in color according to flash_color attribute or by changing icon from
current to the one specified in image_flash. Second way is used only if the name of flash icon is different from
"FlashIconAbsent" which is there by default. First way is used otherwise. Used new selfmade orange icons for
flashing tabs.
--HG--
branch : product-engine
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llbutton.cpp | 30 | ||||
-rw-r--r-- | indra/llui/llbutton.h | 8 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.cpp | 8 | ||||
-rw-r--r-- | indra/llui/lltabcontainer.h | 5 |
4 files changed, 42 insertions, 9 deletions
diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 0255061b12..a8f72183fd 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -128,6 +128,7 @@ LLButton::LLButton(const LLButton::Params& p) mImageSelected(p.image_selected), mImageDisabled(p.image_disabled), mImageDisabledSelected(p.image_disabled_selected), + mImageFlash(p.image_flash), mImagePressed(p.image_pressed), mImagePressedSelected(p.image_pressed_selected), mImageHoverSelected(p.image_hover_selected), @@ -635,14 +636,24 @@ void LLButton::draw() if (mFlashing) { - LLColor4 flash_color = mFlashBgColor.get(); - use_glow_effect = TRUE; - glow_type = LLRender::BT_ALPHA; // blend the glow - - if (mNeedsHighlight) // highlighted AND flashing - glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity + // if we have icon for flashing, use it as image for button + if(flash && mImageFlash->getName() != "FlashIconAbsent") + { + // setting flash to false to avoid its further influence on glow + flash = false; + imagep = mImageFlash; + } + // else use usual flashing via flash_color else - glow_color = flash_color; + { + LLColor4 flash_color = mFlashBgColor.get(); + use_glow_effect = TRUE; + glow_type = LLRender::BT_ALPHA; // blend the glow + if (mNeedsHighlight) // highlighted AND flashing + glow_color = (glow_color*0.5f + flash_color*0.5f) % 2.0f; // average between flash and highlight colour, with sum of the opacity + else + glow_color = flash_color; + } } if (mNeedsHighlight && !imagep) @@ -1018,6 +1029,11 @@ void LLButton::setImageHoverUnselected(LLPointer<LLUIImage> image) mImageHoverUnselected = image; } +void LLButton::setImageFlash(LLPointer<LLUIImage> image) +{ + mImageFlash = image; +} + void LLButton::setImageOverlay(const std::string& image_name, LLFontGL::HAlign alignment, const LLColor4& color) { if (image_name.empty()) diff --git a/indra/llui/llbutton.h b/indra/llui/llbutton.h index a4d81ed6c3..b251c3d65d 100644 --- a/indra/llui/llbutton.h +++ b/indra/llui/llbutton.h @@ -84,6 +84,7 @@ public: image_hover_unselected, image_disabled_selected, image_disabled, + image_flash, image_pressed, image_pressed_selected, image_overlay; @@ -246,6 +247,7 @@ public: void setImageHoverUnselected(LLPointer<LLUIImage> image); void setImageDisabled(LLPointer<LLUIImage> image); void setImageDisabledSelected(LLPointer<LLUIImage> image); + void setImageFlash(LLPointer<LLUIImage> image); void setImagePressed(LLPointer<LLUIImage> image); void setCommitOnReturn(BOOL commit) { mCommitOnReturn = commit; } @@ -310,6 +312,12 @@ private: LLPointer<LLUIImage> mImagePressed; LLPointer<LLUIImage> mImagePressedSelected; + /* There are two ways an image can flash- by making changes in color according to flash_color attribute + or by changing icon from current to the one specified in image_flash. Second way is used only if + the name of flash icon is different from "FlashIconAbsent" which is there by default. First way is used + otherwise. */ + LLPointer<LLUIImage> mImageFlash; + LLUIColor mHighlightColor; LLUIColor mFlashBgColor; diff --git a/indra/llui/lltabcontainer.cpp b/indra/llui/lltabcontainer.cpp index 30fc7babae..986cfe75a1 100644 --- a/indra/llui/lltabcontainer.cpp +++ b/indra/llui/lltabcontainer.cpp @@ -197,10 +197,13 @@ static LLDefaultChildRegistry::Register<LLTabContainer> r2("tab_container"); LLTabContainer::TabParams::TabParams() : tab_top_image_unselected("tab_top_image_unselected"), tab_top_image_selected("tab_top_image_selected"), + tab_top_image_flash("tab_top_image_flash"), tab_bottom_image_unselected("tab_bottom_image_unselected"), tab_bottom_image_selected("tab_bottom_image_selected"), + tab_bottom_image_flash("tab_bottom_image_flash"), tab_left_image_unselected("tab_left_image_unselected"), - tab_left_image_selected("tab_left_image_selected") + tab_left_image_selected("tab_left_image_selected"), + tab_left_image_flash("tab_left_image_flash") {} LLTabContainer::Params::Params() @@ -879,16 +882,19 @@ void LLTabContainer::update_images(LLTabTuple* tuple, TabParams params, LLTabCon { tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_top_image_unselected)); tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_top_image_selected)); + tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_top_image_flash)); } else if (pos == LLTabContainer::BOTTOM) { tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_bottom_image_unselected)); tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_bottom_image_selected)); + tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_bottom_image_flash)); } else if (pos == LLTabContainer::LEFT) { tuple->mButton->setImageUnselected(static_cast<LLUIImage*>(params.tab_left_image_unselected)); tuple->mButton->setImageSelected(static_cast<LLUIImage*>(params.tab_left_image_selected)); + tuple->mButton->setImageFlash(static_cast<LLUIImage*>(params.tab_left_image_flash)); } } } diff --git a/indra/llui/lltabcontainer.h b/indra/llui/lltabcontainer.h index 50ec2679f6..a2dc15aaf9 100644 --- a/indra/llui/lltabcontainer.h +++ b/indra/llui/lltabcontainer.h @@ -67,10 +67,13 @@ public: { Optional<LLUIImage*> tab_top_image_unselected, tab_top_image_selected, + tab_top_image_flash, tab_bottom_image_unselected, tab_bottom_image_selected, + tab_bottom_image_flash, tab_left_image_unselected, - tab_left_image_selected; + tab_left_image_selected, + tab_left_image_flash; TabParams(); }; |