PageRenderTime 39ms CodeModel.GetById 2ms app.highlight 29ms RepoModel.GetById 1ms app.codeStats 1ms

/indra/newview/llpanelpick.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 264 lines | 96 code | 61 blank | 107 comment | 0 complexity | f5e298fe7cada642b97f5625be786e02 MD5 | raw file
  1/** 
  2 * @file llpanelpick.h
  3 * @brief LLPanelPick class definition
  4 *
  5 * $LicenseInfo:firstyear=2004&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27// Display of a "Top Pick" used both for the global top picks in the 
 28// Find directory, and also for each individual user's picks in their
 29// profile.
 30
 31#ifndef LL_LLPANELPICK_H
 32#define LL_LLPANELPICK_H
 33
 34#include "llpanel.h"
 35#include "llremoteparcelrequest.h"
 36#include "llavatarpropertiesprocessor.h"
 37
 38class LLIconCtrl;
 39class LLTextureCtrl;
 40class LLScrollContainer;
 41class LLMessageSystem;
 42class LLAvatarPropertiesObserver;
 43
 44/**
 45 * Panel for displaying Pick Information - snapshot, name, description, etc.
 46 */
 47class LLPanelPickInfo : public LLPanel, public LLAvatarPropertiesObserver, LLRemoteParcelInfoObserver
 48{
 49	LOG_CLASS(LLPanelPickInfo);
 50public:
 51	
 52	// Creates new panel
 53	static LLPanelPickInfo* create();
 54
 55	virtual ~LLPanelPickInfo();
 56
 57	/**
 58	 * Initializes panel properties
 59	 *
 60	 * By default Pick will be created for current Agent location.
 61	 * Use setPickData to change Pick properties.
 62	 */
 63	/*virtual*/ void onOpen(const LLSD& key);
 64
 65	/*virtual*/ BOOL postBuild();
 66
 67	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
 68
 69	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
 70
 71	/**
 72	 * Sends remote parcel info request to resolve parcel name from its ID.
 73	 */
 74	void sendParcelInfoRequest();
 75
 76	/**
 77	 * Sets "Back" button click callback
 78	 */
 79	virtual void setExitCallback(const commit_callback_t& cb);
 80
 81	/**
 82	 * Sets "Edit" button click callback
 83	 */
 84	virtual void setEditPickCallback(const commit_callback_t& cb);
 85
 86	//This stuff we got from LLRemoteParcelObserver, in the last one we intentionally do nothing
 87	/*virtual*/ void processParcelInfo(const LLParcelData& parcel_data);
 88	/*virtual*/ void setParcelID(const LLUUID& parcel_id) { mParcelId = parcel_id; }
 89	/*virtual*/ void setErrorStatus(U32 status, const std::string& reason) {};
 90
 91protected:
 92
 93	LLPanelPickInfo();
 94	
 95	/**
 96	 * Resets Pick information
 97	 */
 98	virtual void resetData();
 99
100	/**
101	 * Resets UI controls (visibility, values)
102	 */
103	virtual void resetControls();
104
105	/** 
106	* "Location text" is actually the owner name, the original
107	* name that owner gave the parcel, and the location.
108	*/
109	static std::string createLocationText(
110		const std::string& owner_name, 
111		const std::string& original_name,
112		const std::string& sim_name, 
113		const LLVector3d& pos_global);
114
115	virtual void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
116	virtual LLUUID& getAvatarId() { return mAvatarId; }
117
118	/**
119	 * Sets snapshot id.
120	 *
121	 * Will mark snapshot control as valid if id is not null.
122	 * Will mark snapshot control as invalid if id is null. If null id is a valid value,
123	 * you have to manually mark snapshot is valid.
124	 */
125	virtual void setSnapshotId(const LLUUID& id);
126	
127	virtual void setPickId(const LLUUID& id) { mPickId = id; }
128	virtual LLUUID& getPickId() { return mPickId; }
129	
130	virtual void setPickName(const std::string& name);
131	
132	virtual void setPickDesc(const std::string& desc);
133	
134	virtual void setPickLocation(const std::string& location);
135	
136	virtual void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
137	virtual LLVector3d& getPosGlobal() { return mPosGlobal; }
138
139	/**
140	 * Callback for "Map" button, opens Map
141	 */
142	void onClickMap();
143
144	/**
145	 * Callback for "Teleport" button, teleports user to Pick location.
146	 */
147	void onClickTeleport();
148
149	void onClickBack();
150
151protected:
152
153	S32						mScrollingPanelMinHeight;
154	S32						mScrollingPanelWidth;
155	LLScrollContainer*		mScrollContainer;
156	LLPanel*				mScrollingPanel;
157	LLTextureCtrl*			mSnapshotCtrl;
158
159	LLUUID mAvatarId;
160	LLVector3d mPosGlobal;
161	LLUUID mParcelId;
162	LLUUID mPickId;
163	LLUUID mRequestedId;
164};
165
166/**
167 * Panel for creating/editing Pick.
168 */
169class LLPanelPickEdit : public LLPanelPickInfo
170{
171	LOG_CLASS(LLPanelPickEdit);
172public:
173
174	/**
175	 * Creates new panel
176	 */
177	static LLPanelPickEdit* create();
178
179	/*virtual*/ ~LLPanelPickEdit();
180
181	/*virtual*/ void onOpen(const LLSD& key);
182
183	virtual void setPickData(const LLPickData* pick_data);
184
185	/*virtual*/ BOOL postBuild();
186
187	/**
188	 * Sets "Save" button click callback
189	 */
190	virtual void setSaveCallback(const commit_callback_t& cb);
191
192	/**
193	 * Sets "Cancel" button click callback
194	 */
195	virtual void setCancelCallback(const commit_callback_t& cb);
196
197	/**
198	 * Resets panel and all cantrols to unedited state
199	 */
200	/*virtual*/ void resetDirty();
201
202	/**
203	 * Returns true if any of Pick properties was changed by user.
204	 */
205	/*virtual*/ BOOL isDirty() const;
206
207	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
208
209protected:
210
211	LLPanelPickEdit();
212
213	/**
214	 * Sends Pick properties to server.
215	 */
216	void sendUpdate();
217
218	/**
219	 * Called when snapshot image changes.
220	 */
221	void onSnapshotChanged();
222	
223	/**
224	 * Callback for Pick snapshot, name and description changed event.
225	 */
226	void onPickChanged(LLUICtrl* ctrl);
227
228	/*virtual*/ void resetData();
229
230	/**
231	 * Enables/disables "Save" button
232	 */
233	void enableSaveButton(bool enable);
234
235	/**
236	 * Callback for "Set Location" button click
237	 */
238	void onClickSetLocation();
239
240	/**
241	 * Callback for "Save" button click
242	 */
243	void onClickSave();
244
245	std::string getLocationNotice();
246
247protected:
248
249	bool mLocationChanged;
250	bool mNeedData;
251	bool mNewPick;
252
253private:
254
255	void initTexturePickerMouseEvents();
256        void onTexturePickerMouseEnter(LLUICtrl* ctrl);
257	void onTexturePickerMouseLeave(LLUICtrl* ctrl);
258
259private:
260
261	LLIconCtrl* text_icon;
262};
263
264#endif // LL_LLPANELPICK_H