summaryrefslogtreecommitdiff
path: root/indra/newview/llavatarlistitem.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llavatarlistitem.h')
-rw-r--r--indra/newview/llavatarlistitem.h71
1 files changed, 56 insertions, 15 deletions
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index 96097bc9b5..479a4833cb 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -74,6 +74,11 @@ public:
virtual ~LLAvatarListItem();
virtual BOOL postBuild();
+
+ /**
+ * Processes notification from speaker indicator to update children when indicator's visibility is changed.
+ */
+ virtual S32 notifyParent(const LLSD& info);
virtual void onMouseLeave(S32 x, S32 y, MASK mask);
virtual void onMouseEnter(S32 x, S32 y, MASK mask);
virtual void setValue(const LLSD& value);
@@ -88,7 +93,8 @@ public:
//Show/hide profile/info btn, translating speaker indicator and avatar name coordinates accordingly
void setShowProfileBtn(bool show);
void setShowInfoBtn(bool show);
- void setSpeakingIndicatorVisible(bool visible);
+ void showSpeakingIndicator(bool show);
+ void showLastInteractionTime(bool show);
void setAvatarIconVisible(bool visible);
const LLUUID& getAvatarId() const;
@@ -97,16 +103,7 @@ public:
void onInfoBtnClick();
void onProfileBtnClick();
- void showSpeakingIndicator(bool show) { mSpeakingIndicator->setVisible(show); }
- void showInfoBtn(bool show_info_btn) {mInfoBtn->setVisible(show_info_btn); }
- void showLastInteractionTime(bool show);
-
- /**
- * This method was added to fix EXT-2364 (Items in group/ad-hoc IM participant list (avatar names) should be reshaped when adding/removing the "(Moderator)" label)
- * But this is a *HACK. The real reason of it was in incorrect logic while hiding profile/info/speaker buttons
- * *TODO: new reshape method should be provided in lieu of this one to be called when visibility if those buttons is changed
- */
- void reshapeAvatarName();
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
protected:
/**
@@ -124,6 +121,23 @@ private:
E_UNKNOWN,
} EOnlineStatus;
+ /**
+ * Enumeration of item elements in order from right to left.
+ *
+ * updateChildren() assumes that indexes are in the such order to process avatar icon easier.
+ *
+ * @see updateChildren()
+ */
+ typedef enum e_avatar_item_child {
+ ALIC_PROFILE_BUTTON,
+ ALIC_INFO_BUTTON,
+ ALIC_SPEAKER_INDICATOR,
+ ALIC_INTERACTION_TIME,
+ ALIC_NAME,
+ ALIC_ICON,
+ ALIC_COUNT,
+ } EAvatarListItemChildIndex;
+
void setNameInternal(const std::string& name, const std::string& highlight);
void onNameCache(const std::string& first_name, const std::string& last_name);
@@ -135,6 +149,26 @@ private:
typedef std::map<EItemState, LLColor4> icon_color_map_t;
static icon_color_map_t& getItemIconColorMap();
+ /**
+ * Initializes widths of all children to use them while changing visibility of any of them.
+ *
+ * @see updateChildren()
+ */
+ static void initChildrenWidths(LLAvatarListItem* self);
+
+ /**
+ * Updates position and rectangle of visible children to fit all available item's width.
+ */
+ void updateChildren();
+
+ /**
+ * Gets child view specified by index.
+ *
+ * This method implemented via switch by all EAvatarListItemChildIndex values.
+ * It is used to not store children in array or vector to avoid of increasing memory usage.
+ */
+ LLView* getItemChildView(EAvatarListItemChildIndex child_index);
+
LLTextBox* mAvatarName;
LLTextBox* mLastInteractionTime;
LLStyle::Params mAvatarNameStyle;
@@ -151,10 +185,17 @@ private:
bool mShowProfileBtn;
static bool sStaticInitialized; // this variable is introduced to improve code readability
- static S32 sIconWidth; // icon width + padding
- static S32 sInfoBtnWidth; //info btn width + padding
- static S32 sProfileBtnWidth; //profile btn width + padding
- static S32 sSpeakingIndicatorWidth; //speaking indicator width + padding
+ static S32 sLeftPadding; // padding to first left visible child (icon or name)
+ static S32 sRightNamePadding; // right padding from name to next visible child
+
+ /**
+ * Contains widths of each child specified by EAvatarListItemChildIndex
+ * including padding to the next right one.
+ *
+ * @see initChildrenWidths()
+ */
+ static S32 sChildrenWidths[ALIC_COUNT];
+
};
#endif //LL_LLAVATARLISTITEM_H