/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. #ifndef LL_LLFLOATERFRIENDS_H
  29. #define LL_LLFLOATERFRIENDS_H
  30. #include "llpanel.h"
  31. #include "llstring.h"
  32. #include "lluuid.h"
  33. #include "lltimer.h"
  34. #include "llcallingcard.h"
  35. class LLFriendObserver;
  36. class LLRelationship;
  37. class LLScrollListItem;
  38. class LLScrollListCtrl;
  39. /**
  40. * @class LLPanelFriends
  41. * @brief An instance of this class is used for displaying your friends
  42. * and gives you quick access to all agents which a user relationship.
  43. *
  44. * @sa LLFloater
  45. */
  46. class LLPanelFriends : public LLPanel, public LLEventTimer
  47. {
  48. public:
  49. LLPanelFriends();
  50. virtual ~LLPanelFriends();
  51. /**
  52. * @brief This method either creates or brings to the front the
  53. * current instantiation of this floater. There is only once since
  54. * you can currently only look at your local friends.
  55. */
  56. virtual BOOL tick();
  57. /**
  58. * @brief This method is called in response to the LLAvatarTracker
  59. * sending out a changed() message.
  60. */
  61. void updateFriends(U32 changed_mask);
  62. virtual BOOL postBuild();
  63. // *HACK Made public to remove friends from LLAvatarIconCtrl context menu
  64. static bool handleRemove(const LLSD& notification, const LLSD& response);
  65. private:
  66. enum FRIENDS_COLUMN_ORDER
  67. {
  68. LIST_ONLINE_STATUS,
  69. LIST_FRIEND_NAME,
  70. LIST_VISIBLE_ONLINE,
  71. LIST_VISIBLE_MAP,
  72. LIST_EDIT_MINE,
  73. LIST_EDIT_THEIRS,
  74. LIST_FRIEND_UPDATE_GEN
  75. };
  76. // protected members
  77. typedef std::map<LLUUID, S32> rights_map_t;
  78. void refreshNames(U32 changed_mask);
  79. BOOL refreshNamesSync(const LLAvatarTracker::buddy_map_t & all_buddies);
  80. BOOL refreshNamesPresence(const LLAvatarTracker::buddy_map_t & all_buddies);
  81. void refreshUI();
  82. void refreshRightsChangeList();
  83. void applyRightsToFriends();
  84. BOOL addFriend(const LLUUID& agent_id);
  85. BOOL updateFriendItem(const LLUUID& agent_id, const LLRelationship* relationship);
  86. typedef enum
  87. {
  88. GRANT,
  89. REVOKE
  90. } EGrantRevoke;
  91. void confirmModifyRights(rights_map_t& ids, EGrantRevoke command);
  92. void sendRightsGrant(rights_map_t& ids);
  93. // return empty vector if nothing is selected
  94. std::vector<LLUUID> getSelectedIDs();
  95. // callback methods
  96. static void onSelectName(LLUICtrl* ctrl, void* user_data);
  97. static bool callbackAddFriend(const LLSD& notification, const LLSD& response);
  98. static bool callbackAddFriendWithMessage(const LLSD& notification, const LLSD& response);
  99. static void onPickAvatar(const std::vector<std::string>& names, const std::vector<LLUUID>& ids);
  100. static void onMaximumSelect();
  101. static void onClickIM(void* user_data);
  102. static void onClickProfile(void* user_data);
  103. static void onClickAddFriend(void* user_data);
  104. static void onClickRemove(void* user_data);
  105. static void onClickOfferTeleport(void* user_data);
  106. static void onClickPay(void* user_data);
  107. static void onClickModifyStatus(LLUICtrl* ctrl, void* user_data);
  108. bool modifyRightsConfirmation(const LLSD& notification, const LLSD& response, rights_map_t* rights);
  109. private:
  110. // member data
  111. LLFriendObserver* mObserver;
  112. LLUUID mAddFriendID;
  113. std::string mAddFriendName;
  114. LLScrollListCtrl* mFriendsList;
  115. BOOL mShowMaxSelectWarning;
  116. BOOL mAllowRightsChange;
  117. S32 mNumRightsChanged;
  118. };
  119. #endif // LL_LLFLOATERFRIENDS_H