PageRenderTime 225ms CodeModel.GetById 141ms app.highlight 19ms RepoModel.GetById 62ms app.codeStats 0ms

/indra/newview/llpanelclassified.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 296 lines | 165 code | 102 blank | 29 comment | 0 complexity | 81825b2b455591d500112faaee3a8bc3 MD5 | raw file
  1/** 
  2 * @file llpanelclassified.h
  3 * @brief LLPanelClassified class definition
  4 *
  5 * $LicenseInfo:firstyear=2005&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 classified used both for the global view in the
 28// Find directory, and also for each individual user's classified in their
 29// profile.
 30#ifndef LL_LLPANELCLASSIFIED_H
 31#define LL_LLPANELCLASSIFIED_H
 32
 33#include "llavatarpropertiesprocessor.h"
 34#include "llclassifiedinfo.h"
 35#include "llfloater.h"
 36#include "llpanel.h"
 37#include "llrect.h"
 38#include "lluuid.h"
 39#include "v3dmath.h"
 40
 41class LLScrollContainer;
 42class LLTextureCtrl;
 43class LLUICtrl;
 44
 45class LLPublishClassifiedFloater : public LLFloater
 46{
 47public:
 48	LLPublishClassifiedFloater(const LLSD& key);
 49	virtual ~LLPublishClassifiedFloater();
 50
 51	/*virtual*/ BOOL postBuild();
 52
 53	void setPrice(S32 price);
 54	S32 getPrice();
 55
 56	void setPublishClickedCallback(const commit_signal_t::slot_type& cb);
 57	void setCancelClickedCallback(const commit_signal_t::slot_type& cb);
 58
 59private:
 60};
 61
 62class LLPanelClassifiedInfo : public LLPanel, public LLAvatarPropertiesObserver
 63{
 64	LOG_CLASS(LLPanelClassifiedInfo);
 65public:
 66
 67	static LLPanelClassifiedInfo* create();
 68
 69	virtual ~LLPanelClassifiedInfo();
 70
 71	/*virtual*/ void onOpen(const LLSD& key);
 72
 73	/*virtual*/ BOOL postBuild();
 74
 75	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
 76
 77	void setAvatarId(const LLUUID& avatar_id) { mAvatarId = avatar_id; }
 78
 79	LLUUID& getAvatarId() { return mAvatarId; }
 80
 81	void setSnapshotId(const LLUUID& id);
 82
 83	LLUUID getSnapshotId();
 84
 85	void setClassifiedId(const LLUUID& id) { mClassifiedId = id; }
 86
 87	LLUUID& getClassifiedId() { return mClassifiedId; }
 88
 89	void setClassifiedName(const std::string& name);
 90
 91	std::string getClassifiedName();
 92
 93	void setDescription(const std::string& desc);
 94
 95	std::string getDescription();
 96
 97	void setClassifiedLocation(const std::string& location);
 98
 99	std::string getClassifiedLocation();
100
101	void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
102
103	LLVector3d& getPosGlobal() { return mPosGlobal; }
104
105	void setParcelId(const LLUUID& id) { mParcelId = id; }
106
107	LLUUID getParcelId() { return mParcelId; }
108
109	void setSimName(const std::string& sim_name) { mSimName = sim_name; }
110
111	std::string getSimName() { return mSimName; }
112
113	void setFromSearch(bool val) { mFromSearch = val; }
114
115	bool fromSearch() { return mFromSearch; }
116
117	bool getInfoLoaded() { return mInfoLoaded; }
118
119	void setInfoLoaded(bool loaded) { mInfoLoaded = loaded; }
120
121	static void setClickThrough(
122		const LLUUID& classified_id,
123		S32 teleport,
124		S32 map,
125		S32 profile,
126		bool from_new_table);
127
128	static void sendClickMessage(
129			const std::string& type,
130			bool from_search,
131			const LLUUID& classified_id,
132			const LLUUID& parcel_id,
133			const LLVector3d& global_pos,
134			const std::string& sim_name);
135
136	void setExitCallback(const commit_callback_t& cb);
137
138	void setEditClassifiedCallback(const commit_callback_t& cb);
139
140	/*virtual*/ void reshape(S32 width, S32 height, BOOL called_from_parent = TRUE);
141
142	/*virtual*/ void draw();
143
144protected:
145
146	LLPanelClassifiedInfo();
147
148	virtual void resetData();
149
150	virtual void resetControls();
151
152	static std::string createLocationText(
153		const std::string& original_name,
154		const std::string& sim_name, 
155		const LLVector3d& pos_global);
156
157	void stretchSnapshot();
158	void sendClickMessage(const std::string& type);
159
160	LLRect getDefaultSnapshotRect();
161
162	void scrollToTop();
163
164	void onMapClick();
165	void onTeleportClick();
166	void onExit();
167
168	bool mSnapshotStreched;
169	LLRect mSnapshotRect;
170	LLTextureCtrl* mSnapshotCtrl;
171
172private:
173
174	LLUUID mAvatarId;
175	LLUUID mClassifiedId;
176	LLVector3d mPosGlobal;
177	LLUUID mParcelId;
178	std::string mSimName;
179	bool mFromSearch;
180	bool mInfoLoaded;
181
182	LLScrollContainer*		mScrollContainer;
183	LLPanel*				mScrollingPanel;
184
185	S32 mScrollingPanelMinHeight;
186	S32 mScrollingPanelWidth;
187
188	// Needed for stat tracking
189	S32 mTeleportClicksOld;
190	S32 mMapClicksOld;
191	S32 mProfileClicksOld;
192	S32 mTeleportClicksNew;
193	S32 mMapClicksNew;
194	S32 mProfileClicksNew;
195
196	typedef std::list<LLPanelClassifiedInfo*> panel_list_t;
197	static panel_list_t sAllPanels;
198};
199
200class LLPanelClassifiedEdit : public LLPanelClassifiedInfo
201{
202	LOG_CLASS(LLPanelClassifiedEdit);
203public:
204
205	static LLPanelClassifiedEdit* create();
206
207	virtual ~LLPanelClassifiedEdit();
208
209	/*virtual*/ BOOL postBuild();
210
211	void fillIn(const LLSD& key);
212
213	/*virtual*/ void onOpen(const LLSD& key);
214
215	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
216
217	/*virtual*/ BOOL isDirty() const;
218
219	/*virtual*/ void resetDirty();
220
221	void setSaveCallback(const commit_signal_t::slot_type& cb);
222
223	void setCancelCallback(const commit_signal_t::slot_type& cb);
224
225	/*virtual*/ void resetControls();
226
227	bool isNew() { return mIsNew; }
228
229	bool isNewWithErrors() { return mIsNewWithErrors; }
230
231	bool canClose();
232
233	void draw();
234
235	void stretchSnapshot();
236
237	U32 getCategory();
238
239	void setCategory(U32 category);
240
241	U32 getContentType();
242
243	void setContentType(U32 content_type);
244
245	bool getAutoRenew();
246
247	S32 getPriceForListing();
248
249protected:
250
251	LLPanelClassifiedEdit();
252
253	void sendUpdate();
254
255	void enableVerbs(bool enable);
256
257	void enableEditing(bool enable);
258
259	void showEditing(bool show);
260
261	std::string makeClassifiedName();
262
263	void setPriceForListing(S32 price);
264
265	U8 getFlags();
266
267	std::string getLocationNotice();
268
269	bool isValidName();
270
271	void notifyInvalidName();
272
273	void onSetLocationClick();
274	void onChange();
275	void onSaveClick();
276
277	void doSave();
278
279	void onPublishFloaterPublishClicked();
280
281	void onTexturePickerMouseEnter(LLUICtrl* ctrl);
282	void onTexturePickerMouseLeave(LLUICtrl* ctrl);
283
284	void onTextureSelected();
285
286private:
287	bool mIsNew;
288	bool mIsNewWithErrors;
289	bool mCanClose;
290
291	LLPublishClassifiedFloater* mPublishFloater;
292
293	commit_signal_t mSaveButtonClickedSignal;
294};
295
296#endif // LL_LLPANELCLASSIFIED_H