llpanelgroup.h

Go to the documentation of this file.
00001 
00031 #ifndef LL_LLPANELGROUP_H
00032 #define LL_LLPANELGROUP_H
00033 
00034 #include "llgroupmgr.h"
00035 #include "llpanel.h"
00036 #include "lltimer.h"
00037 
00038 struct LLOfferInfo;
00039 
00040 const S32 UPDATE_MEMBERS_PER_FRAME = 500;
00041 
00042 // Forward declares
00043 class LLPanelGroupTab;
00044 class LLTabContainerCommon;
00045 class LLAgent;
00046 
00047 class LLPanelGroupTabObserver
00048 {
00049 public:
00050         LLPanelGroupTabObserver() {};
00051         virtual ~LLPanelGroupTabObserver(){};
00052         virtual void tabChanged() = 0;
00053 };
00054 
00055 class LLPanelGroup : public LLPanel,
00056                                          public LLGroupMgrObserver, 
00057                                          public LLPanelGroupTabObserver
00058 {
00059 public:
00060         LLPanelGroup(const std::string& filename,
00061                                  const std::string& name,
00062                                  const LLUUID& group_id,
00063                                  const std::string& initial_tab_selected = std::string());
00064         virtual ~LLPanelGroup();
00065 
00066         virtual BOOL postBuild();
00067 
00068         static void onBtnOK(void*);
00069         static void onBtnCancel(void*);
00070         static void onBtnApply(void*);
00071         static void onBtnRefresh(void*);
00072         static void onClickTab(void*,bool);
00073         void handleClickTab();
00074 
00075         void setGroupID(const LLUUID& group_id);
00076         void selectTab(std::string tab_name);
00077 
00078         // Called when embedded in a floater during a close attempt.
00079         BOOL canClose();
00080         
00081         // Checks if the current tab needs to be applied, and tries to switch to the requested tab.
00082         BOOL attemptTransition();
00083         
00084         // Switches to the requested tab (will close() if requested is NULL)
00085         void transitionToTab();
00086 
00087         void updateTabVisibility();
00088 
00089         // Used by attemptTransition to query the user's response to a tab that needs to apply. 
00090         static void onNotifyCallback(S32 option, void* user_data);
00091         void handleNotifyCallback(S32 option);
00092 
00093         bool apply();
00094         void refreshData();
00095         void close();
00096         void draw();
00097 
00098         // Group manager observer trigger.
00099         virtual void changed(LLGroupChange gc);
00100 
00101         // PanelGroupTab observer trigger
00102         virtual void tabChanged();
00103 
00104         void setAllowEdit(BOOL v) { mAllowEdit = v; }
00105 
00106         void showNotice(const char* subject,
00107                                                         const char* message,
00108                                                         const bool& has_inventory,
00109                                                         const char* inventory_name,
00110                                                         LLOfferInfo* inventory_offer);
00111 protected:
00112         LLPanelGroupTab*                mCurrentTab;
00113         LLPanelGroupTab*                mRequestedTab;
00114         LLTabContainerCommon*   mTabContainer;
00115         BOOL mIgnoreTransition;
00116 
00117         LLButton* mApplyBtn;
00118 
00119         LLTimer mRefreshTimer;
00120 
00121         BOOL mForceClose;
00122 
00123         std::string mInitialTab;
00124         std::string mFilename;
00125 
00126         LLString mDefaultNeedsApplyMesg;
00127         LLString mWantApplyMesg;
00128 
00129         BOOL mAllowEdit;
00130         BOOL mShowingNotifyDialog;
00131 };
00132 
00133 class LLPanelGroupTab : public LLPanel
00134 {
00135 public:
00136         LLPanelGroupTab(const std::string& name, const LLUUID& group_id)
00137         : LLPanel(name), mGroupID(group_id), mAllowEdit(TRUE), mHasModal(FALSE) { }
00138         virtual ~LLPanelGroupTab();
00139 
00140         // Factory that returns a new LLPanelGroupFoo tab.
00141         static void* createTab(void* data);
00142 
00143         // Triggered when the tab becomes active.
00144         virtual void activate() { }
00145         
00146         // Triggered when the tab becomes inactive.
00147         virtual void deactivate() { }
00148 
00149         // Asks if something needs to be applied.
00150         // If returning true, this function should modify the message to the user.
00151         virtual bool needsApply(LLString& mesg) { return false; }
00152 
00153         // Asks if there is currently a modal dialog being shown.
00154         virtual BOOL hasModal() { return mHasModal; }
00155 
00156         // Request to apply current data.
00157         // If returning fail, this function should modify the message to the user.
00158         virtual bool apply(LLString& mesg) { return true; }
00159 
00160         // Request a cancel of changes
00161         virtual void cancel() { }
00162 
00163         // Triggered when group information changes in the group manager.
00164         virtual void update(LLGroupChange gc) { }
00165 
00166         // This is the text to be displayed when a help button is pressed.
00167         virtual LLString getHelpText() const { return mHelpText; }
00168 
00169         // Display anything returned by getHelpText
00170         static void onClickHelp(void* data);
00171         void handleClickHelp();
00172 
00173         // This just connects the help button callback.
00174         virtual BOOL postBuild();
00175 
00176         virtual BOOL isVisibleByAgent(LLAgent* agentp);
00177 
00178         void setAllowEdit(BOOL v) { mAllowEdit = v; }
00179 
00180         void addObserver(LLPanelGroupTabObserver *obs);
00181         void removeObserver(LLPanelGroupTabObserver *obs);
00182         void notifyObservers();
00183 
00184 protected:
00185         LLUUID  mGroupID;
00186         LLTabContainerCommon*   mTabContainer;
00187         LLString        mHelpText;
00188 
00189         BOOL mAllowEdit;
00190         BOOL mHasModal;
00191 
00192         typedef std::set<LLPanelGroupTabObserver*> observer_list_t;
00193         observer_list_t mObservers;
00194 };
00195 
00196 #endif // LL_LLPANELGROUP_H

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