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

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