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.h66
1 files changed, 50 insertions, 16 deletions
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h
index 96097bc9b5..868ee546d4 100644
--- a/indra/newview/llavatarlistitem.h
+++ b/indra/newview/llavatarlistitem.h
@@ -88,7 +88,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,17 +98,6 @@ 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();
-
protected:
/**
* Contains indicator to show voice activity.
@@ -124,6 +114,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 +142,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 +178,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