CHUI-283: Now the speaker/info icon positions are set based upon visibility.'

meow-7.2.2
Gilbert Gonzales 2012-09-21 15:27:46 -07:00
parent 59a6a23ee0
commit 6dd2bf36c5
3 changed files with 22 additions and 5 deletions

View File

@ -366,7 +366,7 @@ BOOL LLConversationViewParticipant::postBuild()
sStaticInitialized = true;
}
computeLabelRightPadding();
updateChildren();
return LLFolderViewItem::postBuild();
}
@ -432,14 +432,14 @@ void LLConversationViewParticipant::onInfoBtnClick()
void LLConversationViewParticipant::onMouseEnter(S32 x, S32 y, MASK mask)
{
mInfoBtn->setVisible(true);
computeLabelRightPadding();
updateChildren();
LLFolderViewItem::onMouseEnter(x, y, mask);
}
void LLConversationViewParticipant::onMouseLeave(S32 x, S32 y, MASK mask)
{
mInfoBtn->setVisible(false);
computeLabelRightPadding();
updateChildren();
LLFolderViewItem::onMouseEnter(x, y, mask);
}
@ -463,12 +463,14 @@ void LLConversationViewParticipant::initChildrenWidths(LLConversationViewPartici
llassert(index == 0);
}
void LLConversationViewParticipant::computeLabelRightPadding()
void LLConversationViewParticipant::updateChildren()
{
mLabelPaddingRight = DEFAULT_LABEL_PADDING_RIGHT;
LLView* control;
S32 ctrl_width;
LLRect controlRect;
//Cycles through controls starting from right to left
for (S32 i = 0; i < ALIC_COUNT; ++i)
{
control = getItemChildView((EAvatarListItemChildIndex)i);
@ -476,9 +478,22 @@ void LLConversationViewParticipant::computeLabelRightPadding()
// skip invisible views
if (!control->getVisible()) continue;
//Get current pos/dimensions
controlRect = control->getRect();
ctrl_width = sChildrenWidths[i]; // including space between current & left controls
// accumulate the amount of space taken by the controls
mLabelPaddingRight += ctrl_width;
//Reposition visible controls in case adjacent controls to the right are hidden.
controlRect.setLeftTopAndSize(
getLocalRect().getWidth() - mLabelPaddingRight,
controlRect.mTop,
controlRect.getWidth(),
controlRect.getHeight());
//Sets the new position
control->setShape(controlRect);
}
}

View File

@ -127,7 +127,7 @@ private:
static bool sStaticInitialized; // this variable is introduced to improve code readability
static S32 sChildrenWidths[ALIC_COUNT];
static void initChildrenWidths(LLConversationViewParticipant* self);
void computeLabelRightPadding();
void updateChildren();
LLView* getItemChildView(EAvatarListItemChildIndex child_view_index);
};

View File

@ -19,7 +19,9 @@
follows="left"
height="20"
default_icon_name="Generic_Person"
layout="topleft"
left="50"
top="2"
width="20" />
<info_button
follows="right"