summaryrefslogtreecommitdiff
path: root/indra/newview/llpanelavatar.h
blob: 0cdcdf938b313a49879dd07efc05cfa1b4877c6c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
/** 
 * @file llpanelavatar.h
 * @brief LLPanelAvatar and related class definitions
 *
 * Copyright (c) 2004-$CurrentYear$, Linden Research, Inc.
 * $License$
 */

#ifndef LL_LLPANELAVATAR_H
#define LL_LLPANELAVATAR_H

#include "llpanel.h"
#include "v3dmath.h"
#include "lluuid.h"
#include "linked_lists.h"
#include "llwebbrowserctrl.h"

class LLButton;
class LLCheckBoxCtrl;
class LLDropTarget;
class LLInventoryItem;
class LLLineEditor;
class LLNameEditor;
class LLPanelAvatar;
class LLScrollListCtrl;
class LLTabContainerCommon;
class LLTextBox;
class LLTextEditor;
class LLTextureCtrl;
class LLUICtrl;
class LLViewerImage;
class LLViewerObject;
class LLMessageSystem;
class LLIconCtrl;
class LLWebBrowserCtrl;

enum EOnlineStatus
{
	ONLINE_STATUS_UNKNOWN = -1,
	ONLINE_STATUS_NO      = 0,
	ONLINE_STATUS_YES     = 1
};

class LLPanelAvatarFirstLife
: public LLPanel
{
public:
	LLPanelAvatarFirstLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar);
	/*virtual*/ ~LLPanelAvatarFirstLife();
	/*virtual*/ BOOL	postBuild(void);

	void enableControls(BOOL own_avatar);

protected:
	LLPanelAvatar* mPanelAvatar;
};


class LLPanelAvatarSecondLife
: public LLPanel
{
public:
	LLPanelAvatarSecondLife(const std::string& name, const LLRect &rect, LLPanelAvatar* panel_avatar );
	/*virtual*/ ~LLPanelAvatarSecondLife();

	/*virtual*/ BOOL	postBuild(void);
	/*virtual*/ void draw();

	static void onClickImage(			void *userdata);
	static void onClickFriends(			void *userdata);
	static void onDoubleClickGroup(void* userdata);
	static void onClickPublishHelp(void *userdata);

	// Clear out the controls anticipating new network data.
	void clearControls();
	void enableControls(BOOL own_avatar);
	void updateOnlineText(BOOL online, BOOL have_calling_card);
	void updatePartnerName();

	void setPartnerID(LLUUID id) { mPartnerID = id; }
	
protected:
	LLPanelAvatar* mPanelAvatar;

	LLUUID				mPartnerID;
};

// WARNING!  The order of the inheritance here matters!!  Do not change.  - KLW
class LLPanelAvatarWeb : 
	public LLPanel
#if LL_LIBXUL_ENABLED
	, public LLWebBrowserCtrlObserver
#endif
{
public:
	LLPanelAvatarWeb(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
	/*virtual*/ ~LLPanelAvatarWeb();
	/*virtual*/ BOOL	postBuild(void);

	void enableControls(BOOL own_avatar);

	void setWebURL(std::string url);

	void load();
	void load(std::string url);
	static void onClickLoad(void* data);
	static void onClickOpen(void* data);
	static void onCommitURL(LLUICtrl* ctrl, void* data);
	static void onClickWebProfileHelp(void *);

#if LL_LIBXUL_ENABLED
	// browser observer impls
	virtual void onStatusTextChange( const EventType& eventIn );
	virtual void onLocationChange( const EventType& eventIn );
#endif

protected:
	LLPanelAvatar*		mPanelAvatar;
	std::string			mURL;
	LLWebBrowserCtrl*	mWebBrowser;
};

class LLPanelAvatarAdvanced : public LLPanel
{
public:
	LLPanelAvatarAdvanced(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
	/*virtual*/ ~LLPanelAvatarAdvanced();
	/*virtual*/ BOOL	postBuild(void);

	void enableControls(BOOL own_avatar);
	void setWantSkills(U32 want_to_mask, const std::string& want_to_text,
					   U32 skills_mask, const std::string& skills_text,
					   const std::string& languages_text);
	void getWantSkills(U32* want_to_mask, std::string& want_to_text,
					   U32* skills_mask, std::string& skills_text,
					   std::string& languages_text);

protected:
	LLPanelAvatar*		mPanelAvatar;
	S32					mWantToCount;
	S32					mSkillsCount;
	LLCheckBoxCtrl		*mWantToCheck[8];
	LLLineEditor		*mWantToEdit;
	LLCheckBoxCtrl		*mSkillsCheck[8];
	LLLineEditor		*mSkillsEdit;
};


class LLPanelAvatarNotes : public LLPanel
{
public:
	LLPanelAvatarNotes(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
	/*virtual*/ ~LLPanelAvatarNotes();
	/*virtual*/ BOOL	postBuild(void);

	void enableControls(BOOL own_avatar);

	static void onCommitNotes(LLUICtrl* field, void* userdata);

protected:
	LLPanelAvatar* mPanelAvatar;
};


class LLPanelAvatarClassified : public LLPanel
{
public:
	LLPanelAvatarClassified(const LLString& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
	/*virtual*/ ~LLPanelAvatarClassified();

	/*virtual*/ BOOL	postBuild(void);
	/*virtual*/ void draw();

	void refresh();

	void apply();
	void enableControls(BOOL own_avatar);

	BOOL titleIsValid();

	// Delete all the classified sub-panels from the tab container
	void deleteClassifiedPanels();

	// Unpack the outline of classified for this avatar (count, names, but not
	// actual data).
	void processAvatarClassifiedReply(LLMessageSystem* msg, void**);

private:
	static void onClickNew(void* data);
	static void onClickDelete(void* data);

	static void callbackDelete(S32 option, void* data);
	static void callbackNew(S32 option, void* data);

private:
	LLPanelAvatar* mPanelAvatar;
};

class LLPanelAvatarPicks : public LLPanel
{
public:
	LLPanelAvatarPicks(const std::string& name, const LLRect& rect, LLPanelAvatar* panel_avatar);
	/*virtual*/ ~LLPanelAvatarPicks();

	/*virtual*/ BOOL	postBuild(void);
	/*virtual*/ void draw();

	void refresh();

	void enableControls(BOOL own_avatar);

	// Delete all the pick sub-panels from the tab container
	void deletePickPanels();

	// Unpack the outline of picks for this avatar (count, names, but not
	// actual data).
	void processAvatarPicksReply(LLMessageSystem* msg, void**);
	void processAvatarClassifiedReply(LLMessageSystem* msg, void**);

private:
	static void onClickNew(void* data);
	static void onClickDelete(void* data);

	static void callbackDelete(S32 option, void* data);

private:
	LLPanelAvatar* mPanelAvatar;
};


class LLPanelAvatar : public LLPanel
{
public:
	LLPanelAvatar(const std::string& name, const LLRect &rect, BOOL allow_edit);
	/*virtual*/ ~LLPanelAvatar();

	/*virtual*/ BOOL	postBuild(void);

	void setAvatar(LLViewerObject *avatarp);

	// Fill in the avatar ID and handle some field fill-in, as well as 
	// button enablement.
	// Pass one of the ONLINE_STATUS_foo constants above.
	void setAvatarID(const LLUUID &avatar_id, const LLString &name, EOnlineStatus online_status);

	const LLUUID& getAvatarID() const { return mAvatarID; }

	void disableRate();
	
	void resetGroupList();

	void sendAvatarStatisticsRequest();

	void sendAvatarPropertiesRequest();
	void sendAvatarPropertiesUpdate();

	void sendAvatarNotesRequest();
	void sendAvatarNotesUpdate();

	void sendAvatarPicksRequest();

	void selectTab(S32 tabnum);
	void selectTabByName(std::string tab_name);

	BOOL haveData() { return mHaveProperties && mHaveStatistics; }

	static void processAvatarPropertiesReply(LLMessageSystem *msg, void **);
	static void processAvatarInterestsReply(LLMessageSystem *msg, void **);
	static void processAvatarGroupsReply(LLMessageSystem* msg, void**);
	static void processAvatarStatisticsReply(LLMessageSystem *msg, void **);
	static void processAvatarNotesReply(LLMessageSystem *msg, void **);
	static void processAvatarPicksReply(LLMessageSystem *msg, void **);
	static void processAvatarClassifiedReply(LLMessageSystem *msg, void **);

	static void onClickTrack(	void *userdata);
	static void onClickIM(		void *userdata);
	static void onClickOfferTeleport(	void *userdata);
	static void onClickPay(	void *userdata);
	static void onClickRate(	void *userdata);
	static void onClickOK(		void *userdata);
	static void onClickCancel(	void *userdata);
	static void onClickKick(	void *userdata);
	static void onClickFreeze(	void *userdata);
	static void onClickUnfreeze(void *userdata);
	static void onClickCSR(		void *userdata);
	static void onClickMute(	void *userdata);
	static void onClickAddFriend(void* data);

	static void finishKick(S32 option, const LLString& text, void* userdata);
	static void finishFreeze(S32 option, const LLString& text, void* userdata);
	static void finishUnfreeze(S32 option, const LLString& text, void* userdata);

	static void showProfileCallback(S32 option, void *userdata);

	// Teen users are not allowed to see or enter data into the first life page,
	// or their own about/interests text entry fields.
	static BOOL sAllowFirstLife;

	static	void*	createPanelAvatar(void*	data);
	static	void*	createFloaterAvatarInfo(void*	data);
	static	void*	createPanelAvatarSecondLife(void*	data);
	static	void*	createPanelAvatarWeb(void*	data);
	static	void*	createPanelAvatarInterests(void*	data);
	static	void*	createPanelAvatarPicks(void*	data);
	static	void*	createPanelAvatarClassified(void*	data);
	static	void*	createPanelAvatarFirstLife(void*	data);
	static	void*	createPanelAvatarNotes(void*	data);

public:
	LLPanelAvatarSecondLife*	mPanelSecondLife;
	LLPanelAvatarAdvanced*		mPanelAdvanced;
	LLPanelAvatarClassified*	mPanelClassified;
	LLPanelAvatarPicks*			mPanelPicks;
	LLPanelAvatarNotes*			mPanelNotes;
	LLPanelAvatarFirstLife*		mPanelFirstLife;
	LLPanelAvatarWeb*			mPanelWeb;

	LLDropTarget* 				mDropTarget;
	
protected:
	void						enableOKIfReady();
	LLUUID						mAvatarID;			// for which avatar is this window?
	BOOL						mIsFriend;			// Are we friends?
	BOOL						mHaveProperties;
	BOOL						mHaveStatistics;
	LLTabContainerCommon*		mTab;
	BOOL						mAllowEdit;
	BOOL						mDisableRate;

	static LLLinkedList<LLPanelAvatar> sAllPanels;
};

// helper funcs
void add_left_label(LLPanel *panel, const LLString& name, S32 y);


#endif // LL_LLPANELAVATAR_H