diff options
Diffstat (limited to 'indra/newview/llnamelistctrl.h')
-rw-r--r-- | indra/newview/llnamelistctrl.h | 84 |
1 files changed, 62 insertions, 22 deletions
diff --git a/indra/newview/llnamelistctrl.h b/indra/newview/llnamelistctrl.h index 1b7795ddff..192a3a5afa 100644 --- a/indra/newview/llnamelistctrl.h +++ b/indra/newview/llnamelistctrl.h @@ -39,35 +39,68 @@ class LLNameListCtrl -: public LLScrollListCtrl +: public LLScrollListCtrl, protected LLInstanceTracker<LLNameListCtrl> { public: - LLNameListCtrl(const std::string& name, - const LLRect& rect, - LLUICtrlCallback callback, - void* userdata, - BOOL allow_multiple_selection, - BOOL draw_border = TRUE, - S32 name_column_index = 0, - const std::string& tooltip = LLStringUtil::null); - virtual ~LLNameListCtrl(); - - virtual LLXMLNodePtr getXML(bool save_children = true) const; - static LLView* fromXML(LLXMLNodePtr node, LLView *parent, LLUICtrlFactory *factory); - + typedef enum e_name_type + { + INDIVIDUAL, + GROUP, + SPECIAL + } ENameType; + + // provide names for enums + struct NameTypeNames : public LLInitParam::TypeValuesHelper<LLNameListCtrl::ENameType, NameTypeNames> + { + static void declareValues(); + }; + + struct NameItem : public LLInitParam::Block<NameItem, LLScrollListItem::Params> + { + Optional<std::string> name; + Optional<ENameType, NameTypeNames> target; + + NameItem() + : name("name"), + target("target", INDIVIDUAL) + {} + }; + + struct NameColumn : public LLInitParam::Choice<NameColumn> + { + Alternative<S32> column_index; + Alternative<std::string> column_name; + NameColumn() + : column_name("name_column"), + column_index("name_column_index", 0) + {} + }; + + struct Params : public LLInitParam::Block<Params, LLScrollListCtrl::Params> + { + Optional<NameColumn> name_column; + Optional<bool> allow_calling_card_drop; + Params(); + }; + +protected: + LLNameListCtrl(const Params&); + friend class LLUICtrlFactory; +public: // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. - BOOL addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM, + void addNameItem(const LLUUID& agent_id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE, std::string& suffix = LLStringUtil::null); - BOOL addNameItem(LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM); + void addNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM); - virtual LLScrollListItem* addElement(const LLSD& value, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); + /*virtual*/ LLScrollListItem* addElement(const LLSD& element, EAddPosition pos = ADD_BOTTOM, void* userdata = NULL); + LLScrollListItem* addNameItemRow(const NameItem& value, EAddPosition pos = ADD_BOTTOM, std::string& suffix = LLStringUtil::null); // Add a user to the list by name. It will be added, the name // requested from the cache, and updated as necessary. void addGroupNameItem(const LLUUID& group_id, EAddPosition pos = ADD_BOTTOM, BOOL enabled = TRUE); - void addGroupNameItem(LLScrollListItem* item, EAddPosition pos = ADD_BOTTOM); + void addGroupNameItem(NameItem& item, EAddPosition pos = ADD_BOTTOM); void removeNameItem(const LLUUID& agent_id); @@ -77,17 +110,24 @@ public: static void refreshAll(const LLUUID& id, const std::string& firstname, const std::string& lastname, BOOL is_group); - virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, + // LLView interface + /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop, EDragAndDropType cargo_type, void *cargo_data, EAcceptance *accept, std::string& tooltip_msg); + /*virtual*/ BOOL handleToolTip(S32 x, S32 y, MASK mask); void setAllowCallingCardDrop(BOOL b) { mAllowCallingCardDrop = b; } + /*virtual*/ void updateColumns(); +private: + void showInspector(const LLUUID& avatar_id, bool is_group); + static LLUUID getItemId(LLScrollListItem* item); + private: - static std::set<LLNameListCtrl*> sInstances; - S32 mNameColumnIndex; - BOOL mAllowCallingCardDrop; + S32 mNameColumnIndex; + std::string mNameColumn; + BOOL mAllowCallingCardDrop; }; #endif |