llpanelgrouproles.h
上传用户:king477883
上传日期:2021-03-01
资源大小:9553k
文件大小:8k
源码类别:

游戏引擎

开发平台:

C++ Builder

  1. /** 
  2.  * @file llpanelgrouproles.h
  3.  * @brief Panel for roles information about a particular group.
  4.  *
  5.  * $LicenseInfo:firstyear=2006&license=viewergpl$
  6.  * 
  7.  * Copyright (c) 2006-2010, Linden Research, Inc.
  8.  * 
  9.  * Second Life Viewer Source Code
  10.  * The source code in this file ("Source Code") is provided by Linden Lab
  11.  * to you under the terms of the GNU General Public License, version 2.0
  12.  * ("GPL"), unless you have obtained a separate licensing agreement
  13.  * ("Other License"), formally executed by you and Linden Lab.  Terms of
  14.  * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15.  * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16.  * 
  17.  * There are special exceptions to the terms and conditions of the GPL as
  18.  * it is applied to this Source Code. View the full text of the exception
  19.  * in the file doc/FLOSS-exception.txt in this software distribution, or
  20.  * online at
  21.  * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22.  * 
  23.  * By copying, modifying or distributing this software, you acknowledge
  24.  * that you have read and understood your obligations described above,
  25.  * and agree to abide by those obligations.
  26.  * 
  27.  * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28.  * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29.  * COMPLETENESS OR PERFORMANCE.
  30.  * $/LicenseInfo$
  31.  */
  32. #ifndef LL_LLPANELGROUPROLES_H
  33. #define LL_LLPANELGROUPROLES_H
  34. #include "llpanelgroup.h"
  35. class LLFilterEditor;
  36. class LLNameListCtrl;
  37. class LLPanelGroupSubTab;
  38. class LLPanelGroupMembersSubTab;
  39. class LLPanelGroupRolesSubTab;
  40. class LLPanelGroupActionsSubTab;
  41. class LLScrollListCtrl;
  42. class LLScrollListItem;
  43. class LLTextEditor;
  44. // Forward declare for friend usage.
  45. //virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*);
  46. typedef std::map<std::string,std::string> icon_map_t;
  47. class LLPanelGroupRoles : public LLPanelGroupTab
  48. {
  49. public:
  50. LLPanelGroupRoles();
  51. virtual ~LLPanelGroupRoles();
  52. // Allow sub tabs to ask for sibling controls.
  53. friend class LLPanelGroupMembersSubTab;
  54. friend class LLPanelGroupRolesSubTab;
  55. friend class LLPanelGroupActionsSubTab;
  56. virtual BOOL postBuild();
  57. virtual BOOL isVisibleByAgent(LLAgent* agentp);
  58. void handleClickSubTab();
  59. // Checks if the current tab needs to be applied, and tries to switch to the requested tab.
  60. BOOL attemptTransition();
  61. // Switches to the requested tab (will close() if requested is NULL)
  62. void transitionToTab();
  63. // Used by attemptTransition to query the user's response to a tab that needs to apply. 
  64. bool handleNotifyCallback(const LLSD& notification, const LLSD& response);
  65. bool onModalClose(const LLSD& notification, const LLSD& response);
  66. // Most of these messages are just passed on to the current sub-tab.
  67. virtual void activate();
  68. virtual void deactivate();
  69. virtual bool needsApply(std::string& mesg);
  70. virtual BOOL hasModal();
  71. virtual bool apply(std::string& mesg);
  72. virtual void cancel();
  73. virtual void update(LLGroupChange gc);
  74. virtual void setGroupID(const LLUUID& id);
  75. protected:
  76. LLPanelGroupTab* mCurrentTab;
  77. LLPanelGroupTab* mRequestedTab;
  78. LLTabContainer* mSubTabContainer;
  79. BOOL mFirstUse;
  80. BOOL mIgnoreTransition;
  81. std::string mDefaultNeedsApplyMesg;
  82. std::string mWantApplyMesg;
  83. };
  84. class LLPanelGroupSubTab : public LLPanelGroupTab
  85. {
  86. public:
  87. LLPanelGroupSubTab();
  88. virtual ~LLPanelGroupSubTab();
  89. virtual BOOL postBuild();
  90. // This allows sub-tabs to collect child widgets from a higher level in the view hierarchy.
  91. virtual BOOL postBuildSubTab(LLView* root);
  92. virtual void setSearchFilter( const std::string& filter );
  93. virtual void activate();
  94. virtual void deactivate();
  95. // Helper functions
  96. bool matchesActionSearchFilter(std::string action);
  97. void setFooterEnabled(BOOL enable);
  98. virtual void setGroupID(const LLUUID& id);
  99. protected:
  100. void buildActionsList(LLScrollListCtrl* ctrl,
  101.  U64 allowed_by_some,
  102.  U64 allowed_by_all,
  103.     LLUICtrl::commit_callback_t commit_callback,
  104.  BOOL show_all,
  105.  BOOL filter,
  106.  BOOL is_owner_role);
  107. void buildActionCategory(LLScrollListCtrl* ctrl,
  108. U64 allowed_by_some,
  109. U64 allowed_by_all,
  110. LLRoleActionSet* action_set,
  111. LLUICtrl::commit_callback_t commit_callback,
  112. BOOL show_all,
  113. BOOL filter,
  114. BOOL is_owner_role);
  115. protected:
  116. LLPanel* mHeader;
  117. LLPanel* mFooter;
  118. LLFilterEditor* mSearchEditor;
  119. std::string mSearchFilter;
  120. icon_map_t mActionIcons;
  121. bool mActivated;
  122. void setOthersVisible(BOOL b);
  123. };
  124. class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
  125. {
  126. public:
  127. LLPanelGroupMembersSubTab();
  128. virtual ~LLPanelGroupMembersSubTab();
  129. virtual BOOL postBuildSubTab(LLView* root);
  130. static void onMemberSelect(LLUICtrl*, void*);
  131. void handleMemberSelect();
  132. static void onMemberDoubleClick(void*);
  133. void handleMemberDoubleClick();
  134. static void onInviteMember(void*);
  135. void handleInviteMember();
  136. static void onEjectMembers(void*);
  137. void handleEjectMembers();
  138. void sendEjectNotifications(const LLUUID& group_id, const std::vector<LLUUID>& selected_members);
  139. static void onRoleCheck(LLUICtrl* check, void* user_data);
  140. void handleRoleCheck(const LLUUID& role_id,
  141.  LLRoleMemberChangeType type);
  142. void applyMemberChanges();
  143. bool addOwnerCB(const LLSD& notification, const LLSD& response);
  144. virtual void activate();
  145. virtual void deactivate();
  146. virtual void cancel();
  147. virtual bool needsApply(std::string& mesg);
  148. virtual bool apply(std::string& mesg);
  149. virtual void update(LLGroupChange gc);
  150. void updateMembers();
  151. virtual void draw();
  152. virtual void setGroupID(const LLUUID& id);
  153. protected:
  154. typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;
  155. typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
  156. bool matchesSearchFilter(const std::string& fullname);
  157. U64  getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id);
  158. bool getRoleChangeType(const LLUUID& member_id,
  159.    const LLUUID& role_id,
  160.    LLRoleMemberChangeType& type);
  161. LLNameListCtrl* mMembersList;
  162. LLScrollListCtrl* mAssignedRolesList;
  163. LLScrollListCtrl* mAllowedActionsList;
  164. LLButton*           mEjectBtn;
  165. BOOL mChanged;
  166. BOOL mPendingMemberUpdate;
  167. BOOL mHasMatch;
  168. member_role_changes_map_t mMemberRoleChangeData;
  169. U32 mNumOwnerAdditions;
  170. LLGroupMgrGroupData::member_list_t::iterator mMemberProgress;
  171. };
  172. class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
  173. {
  174. public:
  175. LLPanelGroupRolesSubTab();
  176. virtual ~LLPanelGroupRolesSubTab();
  177. virtual BOOL postBuildSubTab(LLView* root);
  178. virtual void activate();
  179. virtual void deactivate();
  180. virtual bool needsApply(std::string& mesg);
  181. virtual bool apply(std::string& mesg);
  182. virtual void cancel();
  183. bool matchesSearchFilter(std::string rolename, std::string roletitle);
  184. virtual void update(LLGroupChange gc);
  185. static void onRoleSelect(LLUICtrl*, void*);
  186. void handleRoleSelect();
  187. void buildMembersList();
  188. static void onActionCheck(LLUICtrl*, void*);
  189. bool addActionCB(const LLSD& notification, const LLSD& response, LLCheckBoxCtrl* check);
  190. static void onPropertiesKey(LLLineEditor*, void*);
  191. static void onDescriptionCommit(LLUICtrl*, void*);
  192. static void onDescriptionFocus(LLFocusableElement*, void*);
  193. static void onMemberVisibilityChange(LLUICtrl*, void*);
  194. void handleMemberVisibilityChange(bool value);
  195. static void onCreateRole(void*);
  196. void handleCreateRole();
  197. static void onDeleteRole(void*);
  198. void handleDeleteRole();
  199. void saveRoleChanges();
  200. protected:
  201. void handleActionCheck(LLUICtrl* ctrl, bool force);
  202. LLSD createRoleItem(const LLUUID& role_id, std::string name, std::string title, S32 members);
  203. LLScrollListCtrl* mRolesList;
  204. LLNameListCtrl* mAssignedMembersList;
  205. LLScrollListCtrl* mAllowedActionsList;
  206. LLLineEditor* mRoleName;
  207. LLLineEditor* mRoleTitle;
  208. LLTextEditor* mRoleDescription;
  209. LLCheckBoxCtrl* mMemberVisibleCheck;
  210. LLButton*       mDeleteRoleButton;
  211. LLButton*       mCreateRoleButton;
  212. LLUUID mSelectedRole;
  213. BOOL mHasRoleChange;
  214. std::string mRemoveEveryoneTxt;
  215. };
  216. class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab
  217. {
  218. public:
  219. LLPanelGroupActionsSubTab();
  220. virtual ~LLPanelGroupActionsSubTab();
  221. virtual BOOL postBuildSubTab(LLView* root);
  222. virtual void activate();
  223. virtual void deactivate();
  224. virtual bool needsApply(std::string& mesg);
  225. virtual bool apply(std::string& mesg);
  226. virtual void update(LLGroupChange gc);
  227. void handleActionSelect();
  228. protected:
  229. LLScrollListCtrl* mActionList;
  230. LLScrollListCtrl* mActionRoles;
  231. LLNameListCtrl* mActionMembers;
  232. LLTextEditor* mActionDescription;
  233. };
  234. #endif // LL_LLPANELGROUPROLES_H