summaryrefslogtreecommitdiff
path: root/indra/newview/llavatarlistitem.cpp
diff options
context:
space:
mode:
authorAndrew Dyukov <adyukov@productengine.com>2009-10-26 19:30:46 +0200
committerAndrew Dyukov <adyukov@productengine.com>2009-10-26 19:30:46 +0200
commitff37134a405e81899b4d9e7d07be7e3da85c8278 (patch)
treecf95274815881c1fb85b08f18f72ec7bff5a7f85 /indra/newview/llavatarlistitem.cpp
parentcc7d1c8f69880d649a9e652f74b9b5048420d669 (diff)
Implemented low task EXT-1156(Implement option to show/hide avatar icon in the friend list)
--HG-- branch : product-engine
Diffstat (limited to 'indra/newview/llavatarlistitem.cpp')
-rw-r--r--indra/newview/llavatarlistitem.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/indra/newview/llavatarlistitem.cpp b/indra/newview/llavatarlistitem.cpp
index ebc79aae48..4ecb9537ba 100644
--- a/indra/newview/llavatarlistitem.cpp
+++ b/indra/newview/llavatarlistitem.cpp
@@ -42,6 +42,7 @@
#include "llavatariconctrl.h"
#include "llbutton.h"
+S32 LLAvatarListItem::sIconWidth = 0;
LLAvatarListItem::LLAvatarListItem()
: LLPanel(),
@@ -55,6 +56,12 @@ LLAvatarListItem::LLAvatarListItem()
mOnlineStatus(E_UNKNOWN)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_avatar_list_item.xml");
+ // Remember avatar icon width including its padding from the name text box,
+ // so that we can hide and show the icon again later.
+ if (!sIconWidth)
+ {
+ sIconWidth = mAvatarName->getRect().mLeft - mAvatarIcon->getRect().mLeft;
+ }
}
LLAvatarListItem::~LLAvatarListItem()
@@ -188,6 +195,21 @@ void LLAvatarListItem::setAvatarId(const LLUUID& id, bool ignore_status_changes)
gCacheName->get(id, FALSE, boost::bind(&LLAvatarListItem::onNameCache, this, _2, _3));
}
+void LLAvatarListItem::setAvatarIconVisible(bool visible)
+{
+ // Already done? Then do nothing.
+ if (mAvatarIcon->getVisible() == (BOOL)visible)
+ return;
+
+ // Show/hide avatar icon.
+ mAvatarIcon->setVisible(visible);
+
+ // Move the avatar name horizontally by icon size + its distance from the avatar name.
+ LLRect name_rect = mAvatarName->getRect();
+ name_rect.mLeft += visible ? sIconWidth : -sIconWidth;
+ mAvatarName->setRect(name_rect);
+}
+
void LLAvatarListItem::onInfoBtnClick()
{
LLFloaterReg::showInstance("inspect_avatar", LLSD().insert("avatar_id", mAvatarId));