llpanelgrouproles.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLPANELGROUPROLES_H
00033 #define LL_LLPANELGROUPROLES_H
00034 
00035 #include "llpanelgroup.h"
00036 
00037 class LLNameListCtrl;
00038 class LLPanelGroupSubTab;
00039 class LLPanelGroupMembersSubTab;
00040 class LLPanelGroupRolesSubTab;
00041 class LLPanelGroupActionsSubTab;
00042 class LLScrollListCtrl;
00043 class LLScrollListItem;
00044 
00045 // Forward declare for friend usage.
00046 //virtual BOOL LLPanelGroupSubTab::postBuildSubTab(LLView*);
00047 
00048 typedef std::map<std::string,LLUUID> icon_map_t;
00049 
00050 class LLPanelGroupRoles : public LLPanelGroupTab,
00051                                                   public LLPanelGroupTabObserver
00052 {
00053 public:
00054         LLPanelGroupRoles(const std::string& name, const LLUUID& group_id);
00055         virtual ~LLPanelGroupRoles();
00056 
00057         // Allow sub tabs to ask for sibling controls.
00058         friend class LLPanelGroupMembersSubTab;
00059         friend class LLPanelGroupRolesSubTab;
00060         friend class LLPanelGroupActionsSubTab;
00061 
00062         virtual BOOL postBuild();
00063         virtual BOOL isVisibleByAgent(LLAgent* agentp);
00064 
00065         static void* createTab(void* data);
00066         static void onClickSubTab(void*,bool);
00067         void handleClickSubTab();
00068 
00069         // Checks if the current tab needs to be applied, and tries to switch to the requested tab.
00070         BOOL attemptTransition();
00071         
00072         // Switches to the requested tab (will close() if requested is NULL)
00073         void transitionToTab();
00074 
00075         // Used by attemptTransition to query the user's response to a tab that needs to apply. 
00076         static void onNotifyCallback(S32 option, void* user_data);
00077         void handleNotifyCallback(S32 option);
00078         static void onModalClose(S32 option, void* user_data);
00079 
00080         // Most of these messages are just passed on to the current sub-tab.
00081         virtual LLString getHelpText() const;
00082         virtual void activate();
00083         virtual void deactivate();
00084         virtual bool needsApply(LLString& mesg);
00085         virtual BOOL hasModal();
00086         virtual bool apply(LLString& mesg);
00087         virtual void cancel();
00088         virtual void update(LLGroupChange gc);
00089 
00090         // PanelGroupTab observer trigger
00091         virtual void tabChanged();
00092 
00093 protected:
00094         LLPanelGroupTab*                mCurrentTab;
00095         LLPanelGroupTab*                mRequestedTab;
00096         LLTabContainerCommon*   mSubTabContainer;
00097         BOOL                                    mFirstUse;
00098         BOOL                                    mIgnoreTransition;
00099 
00100         LLString                                mDefaultNeedsApplyMesg;
00101         LLString                                mWantApplyMesg;
00102 };
00103 
00104 class LLPanelGroupSubTab : public LLPanelGroupTab
00105 {
00106 public:
00107         LLPanelGroupSubTab(const std::string& name, const LLUUID& group_id);
00108         virtual ~LLPanelGroupSubTab();
00109 
00110         virtual BOOL postBuild();
00111 
00112         // This allows sub-tabs to collect child widgets from a higher level in the view hierarchy.
00113         virtual BOOL postBuildSubTab(LLView* root) { return TRUE; }
00114 
00115         static void onSearchKeystroke(LLLineEditor* caller, void* user_data);
00116         void handleSearchKeystroke(LLLineEditor* caller);
00117 
00118         static void onClickSearch(void*);
00119         void handleClickSearch();
00120         static void onClickShowAll(void*);
00121         void handleClickShowAll();
00122 
00123         virtual void setSearchFilter( const LLString& filter );
00124 
00125         virtual void activate();
00126         virtual void deactivate();
00127 
00128         // Helper functions
00129         bool matchesActionSearchFilter(std::string action);
00130         void buildActionsList(LLScrollListCtrl* ctrl,
00131                                                                  U64 allowed_by_some,
00132                                                                  U64 allowed_by_all,
00133                                                                  icon_map_t& icons,
00134                                                                  void (*commit_callback)(LLUICtrl*,void*),
00135                                                                  BOOL show_all,
00136                                                                  BOOL filter,
00137                                                                  BOOL is_owner_role);
00138         void buildActionCategory(LLScrollListCtrl* ctrl,
00139                                                                         U64 allowed_by_some,
00140                                                                         U64 allowed_by_all,
00141                                                                         LLRoleActionSet* action_set,
00142                                                                         icon_map_t& icons,
00143                                                                         void (*commit_callback)(LLUICtrl*,void*),
00144                                                                         BOOL show_all,
00145                                                                         BOOL filter,
00146                                                                         BOOL is_owner_role);
00147 
00148         void setFooterEnabled(BOOL enable);
00149 protected:
00150         LLPanel* mHeader;
00151         LLPanel* mFooter;
00152 
00153         LLLineEditor*   mSearchLineEditor;
00154         LLButton*               mSearchButton;
00155         LLButton*               mShowAllButton;
00156 
00157         LLString mSearchFilter;
00158 
00159         icon_map_t      mActionIcons;
00160 
00161         void setOthersVisible(BOOL b);
00162 };
00163 
00164 class LLPanelGroupMembersSubTab : public LLPanelGroupSubTab
00165 {
00166 public:
00167         LLPanelGroupMembersSubTab(const std::string& name, const LLUUID& group_id);
00168         virtual ~LLPanelGroupMembersSubTab();
00169 
00170         virtual BOOL postBuildSubTab(LLView* root);
00171 
00172         static void* createTab(void* data);
00173 
00174         static void onMemberSelect(LLUICtrl*, void*);
00175         void handleMemberSelect();
00176 
00177         static void onMemberDoubleClick(void*);
00178         void handleMemberDoubleClick();
00179 
00180         static void onInviteMember(void*);
00181         void handleInviteMember();
00182 
00183         static void onEjectMembers(void*);
00184         void handleEjectMembers();
00185 
00186         static void onRoleCheck(LLUICtrl* check, void* user_data);
00187         void handleRoleCheck(const LLUUID& role_id,
00188                                                  LLRoleMemberChangeType type);
00189 
00190         void applyMemberChanges();
00191         static void addOwnerCB(S32 option, void* data);
00192 
00193         virtual void activate();
00194         virtual void deactivate();
00195         virtual void cancel();
00196         virtual bool needsApply(LLString& mesg);
00197         virtual bool apply(LLString& mesg);
00198         virtual void update(LLGroupChange gc);
00199         void updateMembers();
00200 
00201         virtual void draw();
00202 
00203 protected:
00204         typedef std::map<LLUUID, LLRoleMemberChangeType> role_change_data_map_t;
00205         typedef std::map<LLUUID, role_change_data_map_t*>::iterator member_role_change_iter;
00206         typedef std::map<LLUUID, role_change_data_map_t*> member_role_changes_map_t;
00207 
00208         bool matchesSearchFilter(char* first, char* last);
00209 
00210         U64  getAgentPowersBasedOnRoleChanges(const LLUUID& agent_id);
00211         bool getRoleChangeType(const LLUUID& member_id,
00212                                                    const LLUUID& role_id,
00213                                                    LLRoleMemberChangeType& type);
00214 
00215         LLNameListCtrl*         mMembersList;
00216         LLScrollListCtrl*       mAssignedRolesList;
00217         LLScrollListCtrl*       mAllowedActionsList;
00218         LLButton*           mEjectBtn;
00219 
00220         BOOL mChanged;
00221         BOOL mPendingMemberUpdate;
00222         BOOL mHasMatch;
00223 
00224         member_role_changes_map_t mMemberRoleChangeData;
00225         U32 mNumOwnerAdditions;
00226 
00227         LLGroupMgrGroupData::member_iter mMemberProgress;
00228 };
00229 
00230 class LLPanelGroupRolesSubTab : public LLPanelGroupSubTab
00231 {
00232 public:
00233         LLPanelGroupRolesSubTab(const std::string& name, const LLUUID& group_id);
00234         virtual ~LLPanelGroupRolesSubTab();
00235 
00236         virtual BOOL postBuildSubTab(LLView* root);
00237 
00238         static void* createTab(void* data);
00239 
00240         virtual void activate();
00241         virtual void deactivate();
00242         virtual bool needsApply(LLString& mesg);
00243         virtual bool apply(LLString& mesg);
00244         virtual void cancel();
00245         bool matchesSearchFilter(std::string rolename, std::string roletitle);
00246         virtual void update(LLGroupChange gc);
00247 
00248         static void onRoleSelect(LLUICtrl*, void*);
00249         void handleRoleSelect();
00250         void buildMembersList();
00251 
00252         static void onActionCheck(LLUICtrl*, void*);
00253         void handleActionCheck(LLCheckBoxCtrl*, bool force=false);
00254         static void addActionCB(S32 option, void* data);
00255 
00256         static void onPropertiesKey(LLLineEditor*, void*);
00257 
00258         static void onDescriptionCommit(LLUICtrl*, void*);
00259 
00260         static void onMemberVisibilityChange(LLUICtrl*, void*);
00261         void handleMemberVisibilityChange(bool value);
00262 
00263         static void onCreateRole(void*);
00264         void handleCreateRole();
00265 
00266         static void onDeleteRole(void*);
00267         void handleDeleteRole();
00268 
00269         void saveRoleChanges();
00270 protected:
00271         LLSD createRoleItem(const LLUUID& role_id, 
00272                                                                  std::string name, 
00273                                                                  std::string title, 
00274                                                                  S32 members);
00275 
00276         LLScrollListCtrl* mRolesList;
00277         LLNameListCtrl* mAssignedMembersList;
00278         LLScrollListCtrl* mAllowedActionsList;
00279 
00280         LLLineEditor* mRoleName;
00281         LLLineEditor* mRoleTitle;
00282         LLTextEditor* mRoleDescription;
00283 
00284         LLCheckBoxCtrl* mMemberVisibleCheck;
00285         LLButton*       mDeleteRoleButton;
00286         LLButton*       mCreateRoleButton;
00287 
00288         LLUUID  mSelectedRole;
00289         BOOL    mHasRoleChange;
00290         std::string mRemoveEveryoneTxt;
00291 };
00292 
00293 class LLPanelGroupActionsSubTab : public LLPanelGroupSubTab
00294 {
00295 public:
00296         LLPanelGroupActionsSubTab(const std::string& name, const LLUUID& group_id);
00297         virtual ~LLPanelGroupActionsSubTab();
00298 
00299         virtual BOOL postBuildSubTab(LLView* root);
00300 
00301         static void* createTab(void* data);
00302 
00303         virtual void activate();
00304         virtual void deactivate();
00305         virtual bool needsApply(LLString& mesg);
00306         virtual bool apply(LLString& mesg);
00307         virtual void update(LLGroupChange gc);
00308 
00309         static void onActionSelect(LLUICtrl*, void*);
00310         void handleActionSelect();
00311 protected:
00312         LLScrollListCtrl*       mActionList;
00313         LLScrollListCtrl*       mActionRoles;
00314         LLNameListCtrl*         mActionMembers;
00315 
00316         LLTextEditor*   mActionDescription;
00317 };
00318 
00319 
00320 #endif // LL_LLPANELGROUPROLES_H

Generated on Thu Jul 1 06:08:58 2010 for Second Life Viewer by  doxygen 1.4.7