PageRenderTime 13ms CodeModel.GetById 1ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llfloaterfriends.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 140 lines | 71 code | 21 blank | 48 comment | 0 complexity | 9bb3e7bf3bab08b6787182815c5a2f6f MD5 | raw file
  1/** 
  2 * @file llfloaterfriends.h
  3 * @author Phoenix
  4 * @date 2005-01-13
  5 * @brief Declaration of class for displaying the local agent's friends.
  6 *
  7 * $LicenseInfo:firstyear=2005&license=viewerlgpl$
  8 * Second Life Viewer Source Code
  9 * Copyright (C) 2010, Linden Research, Inc.
 10 * 
 11 * This library is free software; you can redistribute it and/or
 12 * modify it under the terms of the GNU Lesser General Public
 13 * License as published by the Free Software Foundation;
 14 * version 2.1 of the License only.
 15 * 
 16 * This library is distributed in the hope that it will be useful,
 17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 19 * Lesser General Public License for more details.
 20 * 
 21 * You should have received a copy of the GNU Lesser General Public
 22 * License along with this library; if not, write to the Free Software
 23 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 24 * 
 25 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 26 * $/LicenseInfo$
 27 */
 28
 29#ifndef LL_LLFLOATERFRIENDS_H
 30#define LL_LLFLOATERFRIENDS_H
 31
 32#include "llpanel.h"
 33#include "llstring.h"
 34#include "lluuid.h"
 35#include "lltimer.h"
 36#include "llcallingcard.h"
 37
 38class LLFriendObserver;
 39class LLRelationship;
 40class LLScrollListItem;
 41class LLScrollListCtrl;
 42
 43/** 
 44 * @class LLPanelFriends
 45 * @brief An instance of this class is used for displaying your friends
 46 * and gives you quick access to all agents which a user relationship.
 47 *
 48 * @sa LLFloater
 49 */
 50class LLPanelFriends : public LLPanel, public LLEventTimer
 51{
 52public:
 53	LLPanelFriends();
 54	virtual ~LLPanelFriends();
 55
 56	/** 
 57	 * @brief This method either creates or brings to the front the
 58	 * current instantiation of this floater. There is only once since
 59	 * you can currently only look at your local friends.
 60	 */
 61	virtual BOOL tick();
 62
 63	/** 
 64	 * @brief This method is called in response to the LLAvatarTracker
 65	 * sending out a changed() message.
 66	 */
 67	void updateFriends(U32 changed_mask);
 68
 69	virtual BOOL postBuild();
 70
 71	// *HACK Made public to remove friends from LLAvatarIconCtrl context menu
 72	static bool handleRemove(const LLSD& notification, const LLSD& response);
 73
 74private:
 75
 76	enum FRIENDS_COLUMN_ORDER
 77	{
 78		LIST_ONLINE_STATUS,
 79		LIST_FRIEND_NAME,
 80		LIST_VISIBLE_ONLINE,
 81		LIST_VISIBLE_MAP,
 82		LIST_EDIT_MINE,
 83		LIST_EDIT_THEIRS,
 84		LIST_FRIEND_UPDATE_GEN
 85	};
 86
 87	// protected members
 88	typedef std::map<LLUUID, S32> rights_map_t;
 89	void refreshNames(U32 changed_mask);
 90	BOOL refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies);
 91	BOOL refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies);
 92	void refreshUI();
 93	void refreshRightsChangeList();
 94	void applyRightsToFriends();
 95	BOOL addFriend(const LLUUID& agent_id);	
 96	BOOL updateFriendItem(const LLUUID& agent_id, const LLRelationship* relationship);
 97
 98	typedef enum 
 99	{
100		GRANT,
101		REVOKE
102	} EGrantRevoke;
103	void confirmModifyRights(rights_map_t& ids, EGrantRevoke command);
104	void sendRightsGrant(rights_map_t& ids);
105
106	// return empty vector if nothing is selected
107	std::vector<LLUUID> getSelectedIDs();
108
109	// callback methods
110	static void onSelectName(LLUICtrl* ctrl, void* user_data);
111	static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
112	static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
113	static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
114	static void onMaximumSelect();
115
116	static void onClickIM(void* user_data);
117	static void onClickProfile(void* user_data);
118	static void onClickAddFriend(void* user_data);
119	static void onClickRemove(void* user_data);
120
121	static void onClickOfferTeleport(void* user_data);
122	static void onClickPay(void* user_data);
123
124	static void onClickModifyStatus(LLUICtrl* ctrl, void* user_data);
125
126	bool modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights);
127
128private:
129	// member data
130	LLFriendObserver* mObserver;
131	LLUUID mAddFriendID;
132	std::string mAddFriendName;
133	LLScrollListCtrl* mFriendsList;
134	BOOL mShowMaxSelectWarning;
135	BOOL mAllowRightsChange;
136	S32 mNumRightsChanged;
137};
138
139
140#endif // LL_LLFLOATERFRIENDS_H