PageRenderTime 393ms CodeModel.GetById 140ms app.highlight 88ms RepoModel.GetById 161ms app.codeStats 0ms

/indra/newview/llpanelpicks.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 314 lines | 181 code | 93 blank | 40 comment | 0 complexity | 8981cceb20c25b02a76522177619fe3d MD5 | raw file
  1/** 
  2 * @file llpanelpicks.h
  3 * @brief LLPanelPicks and related class definitions
  4 *
  5 * $LicenseInfo:firstyear=2009&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#ifndef LL_LLPANELPICKS_H
 28#define LL_LLPANELPICKS_H
 29
 30#include "llpanel.h"
 31#include "v3dmath.h"
 32#include "lluuid.h"
 33#include "llavatarpropertiesprocessor.h"
 34#include "llpanelavatar.h"
 35#include "llregistry.h"
 36
 37class LLAccordionCtrlTab;
 38class LLPanelProfile;
 39class LLMessageSystem;
 40class LLVector3d;
 41class LLPanelProfileTab;
 42class LLAgent;
 43class LLMenuGL;
 44class LLPickItem;
 45class LLClassifiedItem;
 46class LLFlatListView;
 47class LLPanelPickInfo;
 48class LLPanelPickEdit;
 49class LLToggleableMenu;
 50class LLPanelClassifiedInfo;
 51class LLPanelClassifiedEdit;
 52
 53// *TODO
 54// Panel Picks has been consolidated with Classifieds (EXT-2095), give LLPanelPicks
 55// and corresponding files (cpp, h, xml) a new name. (new name is TBD at the moment)
 56
 57class LLPanelPicks 
 58	: public LLPanelProfileTab
 59{
 60public:
 61	LLPanelPicks();
 62	~LLPanelPicks();
 63
 64	static void* create(void* data);
 65
 66	/*virtual*/ BOOL postBuild(void);
 67
 68	/*virtual*/ void onOpen(const LLSD& key);
 69
 70	/*virtual*/ void onClosePanel();
 71
 72	void processProperties(void* data, EAvatarProcessorType type);
 73
 74	void updateData();
 75
 76	// returns the selected pick item
 77	LLPickItem* getSelectedPickItem();
 78	LLClassifiedItem* getSelectedClassifiedItem();
 79	LLClassifiedItem* findClassifiedById(const LLUUID& classified_id);
 80
 81	//*NOTE top down approch when panel toggling is done only by 
 82	// parent panels failed to work (picks related code was in my profile panel)
 83	void setProfilePanel(LLPanelProfile* profile_panel);
 84
 85	void createNewPick();
 86	void createNewClassified();
 87
 88protected:
 89	/*virtual*/void updateButtons();
 90
 91private:
 92	void onClickDelete();
 93	void onClickTeleport();
 94	void onClickMap();
 95
 96	void onPlusMenuItemClicked(const LLSD& param);
 97	bool isActionEnabled(const LLSD& userdata) const;
 98
 99	bool isClassifiedPublished(LLClassifiedItem* c_item);
100
101	void onListCommit(const LLFlatListView* f_list);
102	void onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab);
103
104	//------------------------------------------------
105	// Callbacks which require panel toggling
106	//------------------------------------------------
107	void onClickPlusBtn();
108	void onClickInfo();
109	void onPanelPickClose(LLPanel* panel);
110	void onPanelPickSave(LLPanel* panel);
111	void onPanelClassifiedSave(LLPanelClassifiedEdit* panel);
112	void onPanelClassifiedClose(LLPanelClassifiedInfo* panel);
113	void openPickEdit(const LLSD& params);
114	void onPanelPickEdit();
115	void onPanelClassifiedEdit();
116	void editClassified(const LLUUID&  classified_id);
117	void onClickMenuEdit();
118
119	bool onEnableMenuItem(const LLSD& user_data);
120
121	void openPickInfo();
122	void openClassifiedInfo();
123	void openClassifiedInfo(const LLSD& params);
124	void openClassifiedEdit(const LLSD& params);
125	friend class LLPanelProfile;
126
127	void showAccordion(const std::string& name, bool show);
128
129	void buildPickPanel();
130
131	bool callbackDeletePick(const LLSD& notification, const LLSD& response);
132	bool callbackDeleteClassified(const LLSD& notification, const LLSD& response);
133	bool callbackTeleport(const LLSD& notification, const LLSD& response);
134
135
136	virtual void onDoubleClickPickItem(LLUICtrl* item);
137	virtual void onDoubleClickClassifiedItem(LLUICtrl* item);
138	virtual void onRightMouseUpItem(LLUICtrl* item, S32 x, S32 y, MASK mask);
139
140	LLPanelProfile* getProfilePanel();
141
142	void createPickInfoPanel();
143	void createPickEditPanel();
144	void createClassifiedInfoPanel();
145	void createClassifiedEditPanel(LLPanelClassifiedEdit** panel);
146
147	LLMenuGL* mPopupMenu;
148	LLPanelProfile* mProfilePanel;
149	LLPanelPickInfo* mPickPanel;
150	LLFlatListView* mPicksList;
151	LLFlatListView* mClassifiedsList;
152	LLPanelPickInfo* mPanelPickInfo;
153	LLPanelClassifiedInfo* mPanelClassifiedInfo;
154	LLPanelPickEdit* mPanelPickEdit;
155	LLToggleableMenu* mPlusMenu;
156	LLUICtrl* mNoItemsLabel;
157
158	// <classified_id, edit_panel>
159	typedef std::map<LLUUID, LLPanelClassifiedEdit*> panel_classified_edit_map_t;
160
161	// This map is needed for newly created classifieds. The purpose of panel is to
162	// sit in this map and listen to LLPanelClassifiedEdit::processProperties callback.
163	panel_classified_edit_map_t mEditClassifiedPanels;
164
165	LLAccordionCtrlTab* mPicksAccTab;
166	LLAccordionCtrlTab* mClassifiedsAccTab;
167
168	//true if picks list is empty after processing picks
169	bool mNoPicks;
170	//true if classifieds list is empty after processing classifieds
171	bool mNoClassifieds;
172};
173
174class LLPickItem : public LLPanel, public LLAvatarPropertiesObserver
175{
176public:
177
178	LLPickItem();
179
180	static LLPickItem* create();
181
182	void init(LLPickData* pick_data);
183
184	void setPickName(const std::string& name);
185
186	void setPickDesc(const std::string& descr);
187
188	void setPickId(const LLUUID& id);
189
190	void setCreatorId(const LLUUID& id) {mCreatorID = id;};
191
192	void setSnapshotId(const LLUUID& id) {mSnapshotID = id;};
193
194	void setNeedData(bool need){mNeedData = need;};
195
196	const LLUUID& getPickId(); 
197
198	const std::string& getPickName();
199
200	const LLUUID& getCreatorId();
201
202	const LLUUID& getSnapshotId();
203
204	const LLVector3d& getPosGlobal();
205
206	const std::string getDescription();
207
208	const std::string& getSimName() { return mSimName; }
209
210	const std::string& getUserName() { return mUserName; }
211
212	const std::string& getOriginalName() { return mOriginalName; }
213
214	const std::string& getPickDesc() { return mPickDescription; }
215
216	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
217
218	void update();
219
220	~LLPickItem();
221
222	/*virtual*/ BOOL postBuild();
223
224	/** setting on/off background icon to indicate selected state */
225	/*virtual*/ void setValue(const LLSD& value);
226
227protected:
228
229	LLUUID mPickID;
230	LLUUID mCreatorID;
231	LLUUID mParcelID;
232	LLUUID mSnapshotID;
233	LLVector3d mPosGlobal;
234	bool mNeedData;
235
236	std::string mPickName;
237	std::string mUserName;
238	std::string mOriginalName;
239	std::string mPickDescription;
240	std::string mSimName;
241};
242
243class LLClassifiedItem : public LLPanel, public LLAvatarPropertiesObserver
244{
245public:
246
247	LLClassifiedItem(const LLUUID& avatar_id, const LLUUID& classified_id);
248	
249	virtual ~LLClassifiedItem();
250
251	/*virtual*/ void processProperties(void* data, EAvatarProcessorType type);
252
253	/*virtual*/ BOOL postBuild();
254
255	/*virtual*/ void setValue(const LLSD& value);
256
257	void fillIn(LLPanelClassifiedEdit* panel);
258
259	LLUUID getAvatarId() {return mAvatarId;}
260	
261	void setAvatarId(const LLUUID& avatar_id) {mAvatarId = avatar_id;}
262
263	LLUUID getClassifiedId() {return mClassifiedId;}
264
265	void setClassifiedId(const LLUUID& classified_id) {mClassifiedId = classified_id;}
266
267	void setPosGlobal(const LLVector3d& pos) { mPosGlobal = pos; }
268
269	const LLVector3d getPosGlobal() { return mPosGlobal; }
270
271	void setLocationText(const std::string location) { mLocationText = location; }
272
273	std::string getLocationText() { return mLocationText; }
274
275	void setClassifiedName (const std::string& name);
276
277	std::string getClassifiedName() { return getChild<LLUICtrl>("name")->getValue().asString(); }
278
279	void setDescription(const std::string& desc);
280
281	std::string getDescription() { return getChild<LLUICtrl>("description")->getValue().asString(); }
282
283	void setSnapshotId(const LLUUID& snapshot_id);
284
285	LLUUID getSnapshotId();
286
287	void setCategory(U32 cat) { mCategory = cat; }
288
289	U32 getCategory() { return mCategory; }
290
291	void setContentType(U32 ct) { mContentType = ct; }
292
293	U32 getContentType() { return mContentType; }
294
295	void setAutoRenew(U32 renew) { mAutoRenew = renew; }
296
297	bool getAutoRenew() { return mAutoRenew; }
298
299	void setPriceForListing(S32 price) { mPriceForListing = price; }
300
301	S32 getPriceForListing() { return mPriceForListing; }
302
303private:
304	LLUUID mAvatarId;
305	LLUUID mClassifiedId;
306	LLVector3d mPosGlobal;
307	std::string mLocationText;
308	U32 mCategory;
309	U32 mContentType;
310	bool mAutoRenew;
311	S32 mPriceForListing;
312};
313
314#endif // LL_LLPANELPICKS_H