llpanelavatar.h

Go to the documentation of this file.
00001 
00032 #ifndef LL_LLPANELAVATAR_H
00033 #define LL_LLPANELAVATAR_H
00034 
00035 #include "llpanel.h"
00036 #include "v3dmath.h"
00037 #include "lluuid.h"
00038 #include "llwebbrowserctrl.h"
00039 
00040 class LLButton;
00041 class LLCheckBoxCtrl;
00042 class LLDropTarget;
00043 class LLInventoryItem;
00044 class LLLineEditor;
00045 class LLNameEditor;
00046 class LLPanelAvatar;
00047 class LLScrollListCtrl;
00048 class LLTabContainer;
00049 class LLTextBox;
00050 class LLTextEditor;
00051 class LLTextureCtrl;
00052 class LLUICtrl;
00053 class LLViewerImage;
00054 class LLViewerObject;
00055 class LLMessageSystem;
00056 class LLIconCtrl;
00057 class LLWebBrowserCtrl;
00058 
00059 enum EOnlineStatus
00060 {
00061         ONLINE_STATUS_NO      = 0,
00062         ONLINE_STATUS_YES     = 1
00063 };
00064 
00065 // Base class for all sub-tabs inside the avatar profile.  Many of these
00066 // panels need to keep track of the parent panel (to get the avatar id)
00067 // and only request data from the database when they are first drawn. JC
00068 class LLPanelAvatarTab : public LLPanel
00069 {
00070 public:
00071         LLPanelAvatarTab(const std::string& name, const LLRect &rect, 
00072                 LLPanelAvatar* panel_avatar);
00073 
00074         // Calls refresh() once per frame when panel is visible
00075         /*virtual*/ void draw();
00076 
00077         LLPanelAvatar* getPanelAvatar() const { return mPanelAvatar; }
00078 
00079         void setDataRequested(bool requested) { mDataRequested = requested; }
00080         bool isDataRequested() const              { return mDataRequested; }
00081 
00082         // If the data for this tab has not yet been requested,
00083         // send the request.  Used by tabs that are filled in only
00084         // when they are first displayed.
00085         // type is one of "avatarnotesrequest", "avatarpicksrequest",
00086         // or "avatarclassifiedsrequest"
00087         void sendAvatarProfileRequestIfNeeded(const char* method);
00088 
00089 private:
00090         LLPanelAvatar* mPanelAvatar;
00091         bool mDataRequested;
00092 };
00093 
00094 
00095 class LLPanelAvatarFirstLife : public LLPanelAvatarTab
00096 {
00097 public:
00098         LLPanelAvatarFirstLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar);
00099 
00100         /*virtual*/ BOOL postBuild(void);
00101 
00102         void enableControls(BOOL own_avatar);
00103 };
00104 
00105 
00106 class LLPanelAvatarSecondLife
00107 : public LLPanelAvatarTab
00108 {
00109 public:
00110         LLPanelAvatarSecondLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar );
00111 
00112         /*virtual*/ BOOL postBuild(void);
00113         /*virtual*/ void refresh();
00114 
00115         static void onClickImage(                       void *userdata);
00116         static void onClickFriends(                     void *userdata);
00117         static void onDoubleClickGroup(void* userdata);
00118         static void onClickPublishHelp(void *userdata);
00119         static void onClickPartnerHelp(void *userdata);
00120         static void onClickPartnerHelpLoadURL(S32 option, void* userdata);
00121         static void onClickPartnerInfo(void *userdata);
00122 
00123         // Clear out the controls anticipating new network data.
00124         void clearControls();
00125         void enableControls(BOOL own_avatar);
00126         void updateOnlineText(BOOL online, BOOL have_calling_card);
00127         void updatePartnerName();
00128 
00129         void setPartnerID(LLUUID id) { mPartnerID = id; }
00130         
00131 private:
00132         LLUUID                          mPartnerID;
00133 };
00134 
00135 
00136 // WARNING!  The order of the inheritance here matters!!  Do not change.  - KLW
00137 class LLPanelAvatarWeb : 
00138         public LLPanelAvatarTab
00139         , public LLWebBrowserCtrlObserver
00140 {
00141 public:
00142         LLPanelAvatarWeb(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
00143         /*virtual*/ ~LLPanelAvatarWeb();
00144         /*virtual*/ BOOL        postBuild(void);
00145 
00146         void enableControls(BOOL own_avatar);
00147 
00148         void setWebURL(std::string url);
00149 
00150         void load();
00151         void load(std::string url);
00152         static void onClickLoad(void* data);
00153         static void onClickOpen(void* data);
00154         static void onCommitURL(LLUICtrl* ctrl, void* data);
00155         static void onClickWebProfileHelp(void *);
00156 
00157         // browser observer impls
00158         virtual void onStatusTextChange( const EventType& eventIn );
00159         virtual void onLocationChange( const EventType& eventIn );
00160 
00161 private:
00162         std::string                     mURL;
00163         LLWebBrowserCtrl*       mWebBrowser;
00164 };
00165 
00166 
00167 class LLPanelAvatarAdvanced : public LLPanelAvatarTab
00168 {
00169 public:
00170         LLPanelAvatarAdvanced(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
00171 
00172         /*virtual*/ BOOL        postBuild(void);
00173 
00174         void enableControls(BOOL own_avatar);
00175         void setWantSkills(U32 want_to_mask, const std::string& want_to_text,
00176                                            U32 skills_mask, const std::string& skills_text,
00177                                            const std::string& languages_text);
00178         void getWantSkills(U32* want_to_mask, std::string& want_to_text,
00179                                            U32* skills_mask, std::string& skills_text,
00180                                            std::string& languages_text);
00181 
00182 private:
00183         S32                                     mWantToCount;
00184         S32                                     mSkillsCount;
00185         LLCheckBoxCtrl          *mWantToCheck[8];
00186         LLLineEditor            *mWantToEdit;
00187         LLCheckBoxCtrl          *mSkillsCheck[8];
00188         LLLineEditor            *mSkillsEdit;
00189 };
00190 
00191 
00192 class LLPanelAvatarNotes : public LLPanelAvatarTab
00193 {
00194 public:
00195         LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
00196 
00197         /*virtual*/ BOOL        postBuild(void);
00198 
00199         /*virtual*/ void refresh();
00200 
00201         void clearControls();
00202 
00203         static void onCommitNotes(LLUICtrl* field, void* userdata);
00204 };
00205 
00206 
00207 class LLPanelAvatarClassified : public LLPanelAvatarTab
00208 {
00209 public:
00210         LLPanelAvatarClassified(const LLString& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
00211 
00212         /*virtual*/ BOOL postBuild(void);
00213 
00214         /*virtual*/ void refresh();
00215 
00216         // If can close, return TRUE.  If cannot close, pop save/discard dialog
00217         // and return FALSE.
00218         BOOL canClose();
00219 
00220         void apply();
00221 
00222         BOOL titleIsValid();
00223 
00224         // Delete all the classified sub-panels from the tab container
00225         void deleteClassifiedPanels();
00226 
00227         // Unpack the outline of classified for this avatar (count, names, but not
00228         // actual data).
00229         void processAvatarClassifiedReply(LLMessageSystem* msg, void**);
00230 
00231 private:
00232         static void onClickNew(void* data);
00233         static void onClickDelete(void* data);
00234 
00235         static void callbackDelete(S32 option, void* data);
00236         static void callbackNew(S32 option, void* data);
00237 };
00238 
00239 
00240 class LLPanelAvatarPicks : public LLPanelAvatarTab
00241 {
00242 public:
00243         LLPanelAvatarPicks(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
00244 
00245         /*virtual*/ BOOL        postBuild(void);
00246 
00247         /*virtual*/ void refresh();
00248 
00249         // Delete all the pick sub-panels from the tab container
00250         void deletePickPanels();
00251 
00252         // Unpack the outline of picks for this avatar (count, names, but not
00253         // actual data).
00254         void processAvatarPicksReply(LLMessageSystem* msg, void**);
00255         void processAvatarClassifiedReply(LLMessageSystem* msg, void**);
00256 
00257 private:
00258         static void onClickNew(void* data);
00259         static void onClickDelete(void* data);
00260 
00261         static void callbackDelete(S32 option, void* data);
00262 };
00263 
00264 
00265 class LLPanelAvatar : public LLPanel
00266 {
00267 public:
00268         LLPanelAvatar(const std::string& name, const LLRect &rect, BOOL allow_edit);
00269         /*virtual*/ ~LLPanelAvatar();
00270 
00271         /*virtual*/ BOOL        postBuild(void);
00272 
00273         // If can close, return TRUE.  If cannot close, pop save/discard dialog
00274         // and return FALSE.
00275         BOOL canClose();
00276 
00277         void setAvatar(LLViewerObject *avatarp);
00278 
00279         // Fill in the avatar ID and handle some field fill-in, as well as 
00280         // button enablement.
00281         // Pass one of the ONLINE_STATUS_foo constants above.
00282         void setAvatarID(const LLUUID &avatar_id, const LLString &name, EOnlineStatus online_status);
00283 
00284         void setOnlineStatus(EOnlineStatus online_status);
00285 
00286         const LLUUID& getAvatarID() const { return mAvatarID; }
00287         
00288         void resetGroupList();
00289 
00290         void sendAvatarStatisticsRequest();
00291 
00292         void sendAvatarPropertiesRequest();
00293         void sendAvatarPropertiesUpdate();
00294 
00295         void sendAvatarNotesRequest();
00296         void sendAvatarNotesUpdate();
00297 
00298         void sendAvatarPicksRequest();
00299 
00300         void selectTab(S32 tabnum);
00301         void selectTabByName(std::string tab_name);
00302 
00303         BOOL haveData() { return mHaveProperties && mHaveStatistics; }
00304         BOOL isEditable() const { return mAllowEdit; }
00305 
00306         static void processAvatarPropertiesReply(LLMessageSystem *msg, void **);
00307         static void processAvatarInterestsReply(LLMessageSystem *msg, void **);
00308         static void processAvatarGroupsReply(LLMessageSystem* msg, void**);
00309         static void processAvatarNotesReply(LLMessageSystem *msg, void **);
00310         static void processAvatarPicksReply(LLMessageSystem *msg, void **);
00311         static void processAvatarClassifiedReply(LLMessageSystem *msg, void **);
00312 
00313         static void onClickTrack(       void *userdata);
00314         static void onClickIM(          void *userdata);
00315         static void onClickOfferTeleport(       void *userdata);
00316         static void onClickPay( void *userdata);
00317         static void onClickAddFriend(void* userdata);
00318         static void onClickOK(          void *userdata);
00319         static void onClickCancel(      void *userdata);
00320         static void onClickKick(        void *userdata);
00321         static void onClickFreeze(      void *userdata);
00322         static void onClickUnfreeze(void *userdata);
00323         static void onClickCSR(         void *userdata);
00324         static void onClickMute(        void *userdata);
00325 
00326 private:
00327         void enableOKIfReady();
00328 
00329         static void finishKick(S32 option, const LLString& text, void* userdata);
00330         static void finishFreeze(S32 option, const LLString& text, void* userdata);
00331         static void finishUnfreeze(S32 option, const LLString& text, void* userdata);
00332 
00333         static void showProfileCallback(S32 option, void *userdata);
00334 
00335         static  void*   createPanelAvatar(void* data);
00336         static  void*   createFloaterAvatarInfo(void*   data);
00337         static  void*   createPanelAvatarSecondLife(void*       data);
00338         static  void*   createPanelAvatarWeb(void*      data);
00339         static  void*   createPanelAvatarInterests(void*        data);
00340         static  void*   createPanelAvatarPicks(void*    data);
00341         static  void*   createPanelAvatarClassified(void*       data);
00342         static  void*   createPanelAvatarFirstLife(void*        data);
00343         static  void*   createPanelAvatarNotes(void*    data);
00344 
00345 public:
00346         LLPanelAvatarSecondLife*        mPanelSecondLife;
00347         LLPanelAvatarAdvanced*          mPanelAdvanced;
00348         LLPanelAvatarClassified*        mPanelClassified;
00349         LLPanelAvatarPicks*                     mPanelPicks;
00350         LLPanelAvatarNotes*                     mPanelNotes;
00351         LLPanelAvatarFirstLife*         mPanelFirstLife;
00352         LLPanelAvatarWeb*                       mPanelWeb;
00353 
00354         LLDropTarget*                           mDropTarget;
00355 
00356         // Teen users are not allowed to see or enter data into the first life page,
00357         // or their own about/interests text entry fields.
00358         static BOOL sAllowFirstLife;
00359         
00360 private:
00361         LLUUID                                          mAvatarID;                      // for which avatar is this window?
00362         BOOL                                            mIsFriend;                      // Are we friends?
00363         BOOL                                            mHaveProperties;
00364         BOOL                                            mHaveStatistics;
00365         // only update note if data received from database and
00366         // note is changed from database version
00367         bool                                            mHaveNotes;
00368         std::string                                     mLastNotes;
00369         LLTabContainer*         mTab;
00370         BOOL                                            mAllowEdit;
00371 
00372         typedef std::list<LLPanelAvatar*> panel_list_t;
00373         static panel_list_t sAllPanels;
00374 };
00375 
00376 // helper funcs
00377 void add_left_label(LLPanel *panel, const LLString& name, S32 y);
00378 
00379 
00380 #endif // LL_LLPANELAVATAR_H

Generated on Fri May 16 08:33:49 2008 for SecondLife by  doxygen 1.5.5