diff options
author | Dmitry Oleshko <doleshko@productengine.com> | 2009-11-04 16:35:48 +0200 |
---|---|---|
committer | Dmitry Oleshko <doleshko@productengine.com> | 2009-11-04 16:35:48 +0200 |
commit | 347f2614804d2b681358822c6bd018409aadde83 (patch) | |
tree | 9f6a76e0b8f9a2627d0702c5ee28655c3314d4a8 /indra/newview/llchiclet.cpp | |
parent | e634f2f42d5a7165f4cab2910f144144bc7a31d0 (diff) |
implemented a normal Sub-task (EXT-988) Change indication of unread messges in chiclets
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llchiclet.cpp')
-rw-r--r-- | indra/newview/llchiclet.cpp | 98 |
1 files changed, 43 insertions, 55 deletions
diff --git a/indra/newview/llchiclet.cpp b/indra/newview/llchiclet.cpp index 8a4650763f..594385b4ef 100644 --- a/indra/newview/llchiclet.cpp +++ b/indra/newview/llchiclet.cpp @@ -198,9 +198,38 @@ void LLChiclet::setValue(const LLSD& value) ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// -LLIMChiclet::LLIMChiclet(const LLChiclet::Params& p) +LLIMChiclet::LLIMChiclet(const LLIMChiclet::Params& p) : LLChiclet(p) +, mNewMessagesIcon(NULL) +, mCounterCtrl(NULL) +{ + // initialize an overlay icon for new messages + LLIconCtrl::Params icon_params; + icon_params.visible = false; + icon_params.image = LLUI::getUIImage(p.new_messages_icon_name); + mNewMessagesIcon = LLUICtrlFactory::create<LLIconCtrl>(icon_params); + // adjust size and position of an icon + LLRect chiclet_rect = p.rect; + LLRect overlay_icon_rect = LLRect(chiclet_rect.getWidth()/2, chiclet_rect.mTop, chiclet_rect.mRight, chiclet_rect.getHeight()/2); + // shift an icon a little bit to the right and up corner of a chiclet + overlay_icon_rect.translate(overlay_icon_rect.getWidth()/4, overlay_icon_rect.getHeight()/4); + mNewMessagesIcon->setRect(overlay_icon_rect); + addChild(mNewMessagesIcon); + + setShowCounter(false); +} + +void LLIMChiclet::setShowNewMessagesIcon(bool show) +{ + if(mNewMessagesIcon) + { + mNewMessagesIcon->setVisible(show); + } +} + +bool LLIMChiclet::getShowNewMessagesIcon() { + return mNewMessagesIcon->getVisible(); } void LLIMChiclet::onMouseDown() @@ -274,7 +303,7 @@ LLIMP2PChiclet::Params::Params() , show_speaker("show_speaker") { // *TODO Vadim: Get rid of hardcoded values. - rect(LLRect(0, 25, 45, 0)); + rect(LLRect(0, 25, 25, 0)); avatar_icon.name("avatar_icon"); avatar_icon.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_BOTTOM); @@ -293,6 +322,7 @@ LLIMP2PChiclet::Params::Params() unread_notifications.v_pad(5); unread_notifications.text_color(LLColor4::white); unread_notifications.mouse_opaque(false); + unread_notifications.visible(false); speaker.name("speaker"); speaker.rect(LLRect(45, 25, 65, 0)); @@ -303,7 +333,6 @@ LLIMP2PChiclet::Params::Params() LLIMP2PChiclet::LLIMP2PChiclet(const Params& p) : LLIMChiclet(p) , mChicletIconCtrl(NULL) -, mCounterCtrl(NULL) , mSpeakerCtrl(NULL) , mPopupMenu(NULL) { @@ -322,28 +351,14 @@ LLIMP2PChiclet::LLIMP2PChiclet(const Params& p) mSpeakerCtrl = LLUICtrlFactory::create<LLChicletSpeakerCtrl>(speaker_params); addChild(mSpeakerCtrl); + sendChildToFront(mNewMessagesIcon); setShowSpeaker(p.show_speaker); } void LLIMP2PChiclet::setCounter(S32 counter) { mCounterCtrl->setCounter(counter); - - if(getShowCounter()) - { - LLRect counter_rect = mCounterCtrl->getRect(); - LLRect required_rect = mCounterCtrl->getRequiredRect(); - bool needs_resize = required_rect.getWidth() != counter_rect.getWidth(); - - if(needs_resize) - { - counter_rect.mRight = counter_rect.mLeft + required_rect.getWidth(); - mCounterCtrl->reshape(counter_rect.getWidth(), counter_rect.getHeight()); - mCounterCtrl->setRect(counter_rect); - - onChicletSizeChanged(); - } - } + setShowNewMessagesIcon(counter); } LLRect LLIMP2PChiclet::getRequiredRect() @@ -458,7 +473,7 @@ LLAdHocChiclet::Params::Params() , avatar_icon_color("avatar_icon_color", LLColor4::green) { // *TODO Vadim: Get rid of hardcoded values. - rect(LLRect(0, 25, 45, 0)); + rect(LLRect(0, 25, 25, 0)); avatar_icon.name("avatar_icon"); avatar_icon.follows.flags(FOLLOWS_LEFT | FOLLOWS_TOP | FOLLOWS_BOTTOM); @@ -477,6 +492,8 @@ LLAdHocChiclet::Params::Params() unread_notifications.v_pad(5); unread_notifications.text_color(LLColor4::white); unread_notifications.mouse_opaque(false); + unread_notifications.visible(false); + speaker.name("speaker"); speaker.rect(LLRect(45, 25, 65, 0)); @@ -487,7 +504,6 @@ LLAdHocChiclet::Params::Params() LLAdHocChiclet::LLAdHocChiclet(const Params& p) : LLIMChiclet(p) , mChicletIconCtrl(NULL) -, mCounterCtrl(NULL) , mSpeakerCtrl(NULL) , mPopupMenu(NULL) { @@ -508,6 +524,7 @@ LLAdHocChiclet::LLAdHocChiclet(const Params& p) mSpeakerCtrl = LLUICtrlFactory::create<LLChicletSpeakerCtrl>(speaker_params); addChild(mSpeakerCtrl); + sendChildToFront(mNewMessagesIcon); setShowSpeaker(p.show_speaker); } @@ -521,22 +538,7 @@ void LLAdHocChiclet::setSessionId(const LLUUID& session_id) void LLAdHocChiclet::setCounter(S32 counter) { mCounterCtrl->setCounter(counter); - - if(getShowCounter()) - { - LLRect counter_rect = mCounterCtrl->getRect(); - LLRect required_rect = mCounterCtrl->getRequiredRect(); - bool needs_resize = required_rect.getWidth() != counter_rect.getWidth(); - - if(needs_resize) - { - counter_rect.mRight = counter_rect.mLeft + required_rect.getWidth(); - mCounterCtrl->reshape(counter_rect.getWidth(), counter_rect.getHeight()); - mCounterCtrl->setRect(counter_rect); - - onChicletSizeChanged(); - } - } + setShowNewMessagesIcon(counter); } LLRect LLAdHocChiclet::getRequiredRect() @@ -565,7 +567,7 @@ BOOL LLAdHocChiclet::handleRightMouseDown(S32 x, S32 y, MASK mask) LLIMGroupChiclet::Params::Params() : group_icon("group_icon") { - rect(LLRect(0, 25, 45, 0)); + rect(LLRect(0, 25, 25, 0)); group_icon.name("group_icon"); @@ -581,6 +583,7 @@ LLIMGroupChiclet::Params::Params() unread_notifications.font_halign(LLFontGL::HCENTER); unread_notifications.v_pad(5); unread_notifications.text_color(LLColor4::white); + unread_notifications.visible(false); speaker.name("speaker"); speaker.rect(LLRect(45, 25, 65, 0)); @@ -592,7 +595,6 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p) : LLIMChiclet(p) , LLGroupMgrObserver(LLUUID::null) , mChicletIconCtrl(NULL) -, mCounterCtrl(NULL) , mSpeakerCtrl(NULL) , mPopupMenu(NULL) { @@ -611,6 +613,7 @@ LLIMGroupChiclet::LLIMGroupChiclet(const Params& p) mSpeakerCtrl = LLUICtrlFactory::create<LLChicletSpeakerCtrl>(speaker_params); addChild(mSpeakerCtrl); + sendChildToFront(mNewMessagesIcon); setShowSpeaker(p.show_speaker); } @@ -622,22 +625,7 @@ LLIMGroupChiclet::~LLIMGroupChiclet() void LLIMGroupChiclet::setCounter(S32 counter) { mCounterCtrl->setCounter(counter); - - if(getShowCounter()) - { - LLRect counter_rect = mCounterCtrl->getRect(); - LLRect required_rect = mCounterCtrl->getRequiredRect(); - bool needs_resize = required_rect.getWidth() != counter_rect.getWidth(); - - if(needs_resize) - { - counter_rect.mRight = counter_rect.mLeft + required_rect.getWidth(); - mCounterCtrl->reshape(counter_rect.getWidth(), counter_rect.getHeight()); - mCounterCtrl->setRect(counter_rect); - - onChicletSizeChanged(); - } - } + setShowNewMessagesIcon(counter); } LLRect LLIMGroupChiclet::getRequiredRect() |