diff options
author | Mike Antipov <mantipov@productengine.com> | 2010-01-11 18:39:15 +0200 |
---|---|---|
committer | Mike Antipov <mantipov@productengine.com> | 2010-01-11 18:39:15 +0200 |
commit | 1bdae78926d11389ac6f4ca8daae3bf50ba7ceda (patch) | |
tree | 2f64d528dc790df88944850cd70831f08190ab18 /indra/newview/llavatarlistitem.h | |
parent | 8be80d14c199773001a1a22bce89f55bdf22af54 (diff) |
Work on low task EXT-3456 (Code Improvements: Improve LLAvatarListItem to show/hide its buttons properly)
Initial implementation:
* implemented common functionality to update Avatar List Item children positions & size (for name) depend on children visibility
* added its usage whereve visibility of child view is changed
* removed direct changing of "info button" visibility in Avatar List when Avatar List Item is added
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llavatarlistitem.h')
-rw-r--r-- | indra/newview/llavatarlistitem.h | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/indra/newview/llavatarlistitem.h b/indra/newview/llavatarlistitem.h index 96097bc9b5..688197810e 100644 --- a/indra/newview/llavatarlistitem.h +++ b/indra/newview/llavatarlistitem.h @@ -98,7 +98,6 @@ public: void onProfileBtnClick(); void showSpeakingIndicator(bool show) { mSpeakingIndicator->setVisible(show); } - void showInfoBtn(bool show_info_btn) {mInfoBtn->setVisible(show_info_btn); } void showLastInteractionTime(bool show); /** @@ -124,6 +123,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 +151,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; @@ -155,6 +191,17 @@ private: 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 |