PageRenderTime 72ms CodeModel.GetById 2ms app.highlight 61ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/newview/llinventorybridge.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 658 lines | 499 code | 71 blank | 88 comment | 0 complexity | d25fa8a4183dde2aad46228ff0879757 MD5 | raw file
  1/** 
  2 * @file llinventorybridge.h
  3 * @brief Implementation of the Inventory-Folder-View-Bridge classes.
  4 *
  5 * $LicenseInfo:firstyear=2001&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_LLINVENTORYBRIDGE_H
 28#define LL_LLINVENTORYBRIDGE_H
 29
 30#include "llcallingcard.h"
 31#include "llfloaterproperties.h"
 32#include "llfoldervieweventlistener.h"
 33#include "llinventorymodel.h"
 34#include "llinventoryobserver.h"
 35#include "llviewercontrol.h"
 36#include "llwearable.h"
 37
 38class LLInventoryPanel;
 39class LLInventoryModel;
 40class LLMenuGL;
 41class LLCallingCardObserver;
 42class LLViewerJointAttachment;
 43
 44
 45typedef std::vector<std::string> menuentry_vec_t;
 46
 47//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 48// Class LLInvFVBridge
 49//
 50// Short for Inventory-Folder-View-Bridge. This is an
 51// implementation class to be able to view inventory items.
 52//
 53// You'll want to call LLInvItemFVELister::createBridge() to actually create
 54// an instance of this class. This helps encapsulate the
 55// functionality a bit. (except for folders, you can create those
 56// manually...)
 57//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 58class LLInvFVBridge : public LLFolderViewEventListener
 59{
 60public:
 61	// This method is a convenience function which creates the correct
 62	// type of bridge based on some basic information
 63	static LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
 64									   LLAssetType::EType actual_asset_type,
 65									   LLInventoryType::EType inv_type,
 66									   LLInventoryPanel* inventory,
 67									   LLFolderView* root,
 68									   const LLUUID& uuid,
 69									   U32 flags = 0x00);
 70	virtual ~LLInvFVBridge() {}
 71
 72	bool canShare() const;
 73	bool canListOnMarketplace() const;
 74	bool canListOnMarketplaceNow() const;
 75
 76	//--------------------------------------------------------------------
 77	// LLInvFVBridge functionality
 78	//--------------------------------------------------------------------
 79	virtual const LLUUID& getUUID() const { return mUUID; }
 80	virtual void clearDisplayName() {}
 81	virtual void restoreItem() {}
 82	virtual void restoreToWorld() {}
 83
 84	//--------------------------------------------------------------------
 85	// Inherited LLFolderViewEventListener functions
 86	//--------------------------------------------------------------------
 87	virtual const std::string& getName() const;
 88	virtual const std::string& getDisplayName() const;
 89	virtual PermissionMask getPermissionMask() const;
 90	virtual LLFolderType::EType getPreferredType() const;
 91	virtual time_t getCreationDate() const;
 92	virtual LLFontGL::StyleFlags getLabelStyle() const { return LLFontGL::NORMAL; }
 93	virtual std::string getLabelSuffix() const { return LLStringUtil::null; }
 94	virtual void openItem() {}
 95	virtual void closeItem() {}
 96	virtual void previewItem() {openItem();}
 97	virtual void showProperties();
 98	virtual BOOL isItemRenameable() const { return TRUE; }
 99	//virtual BOOL renameItem(const std::string& new_name) {}
100	virtual BOOL isItemRemovable() const;
101	virtual BOOL isItemMovable() const;
102	virtual BOOL isItemInTrash() const;
103	virtual BOOL isLink() const;
104	//virtual BOOL removeItem() = 0;
105	virtual void removeBatch(LLDynamicArray<LLFolderViewEventListener*>& batch);
106	virtual void move(LLFolderViewEventListener* new_parent_bridge) {}
107	virtual BOOL isItemCopyable() const { return FALSE; }
108	virtual BOOL copyToClipboard() const { return FALSE; }
109	virtual void cutToClipboard();
110	virtual BOOL isClipboardPasteable() const;
111	virtual BOOL isClipboardPasteableAsLink() const;
112	virtual void pasteFromClipboard() {}
113	virtual void pasteLinkFromClipboard() {}
114	void getClipboardEntries(bool show_asset_id, menuentry_vec_t &items, 
115							 menuentry_vec_t &disabled_items, U32 flags);
116	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
117	virtual BOOL startDrag(EDragAndDropType* type, LLUUID* id) const;
118	virtual BOOL dragOrDrop(MASK mask, BOOL drop,
119							EDragAndDropType cargo_type,
120							void* cargo_data,
121							std::string& tooltip_msg) { return FALSE; }
122	virtual LLInventoryType::EType getInventoryType() const { return mInvType; }
123	virtual LLWearableType::EType getWearableType() const { return LLWearableType::WT_NONE; }
124
125	//--------------------------------------------------------------------
126	// Convenience functions for adding various common menu options.
127	//--------------------------------------------------------------------
128protected:
129	virtual void addTrashContextMenuOptions(menuentry_vec_t &items,
130											menuentry_vec_t &disabled_items);
131	virtual void addDeleteContextMenuOptions(menuentry_vec_t &items,
132											 menuentry_vec_t &disabled_items);
133	virtual void addOpenRightClickMenuOption(menuentry_vec_t &items);
134	virtual void addOutboxContextMenuOptions(U32 flags,
135											 menuentry_vec_t &items,
136											 menuentry_vec_t &disabled_items);
137protected:
138	LLInvFVBridge(LLInventoryPanel* inventory, LLFolderView* root, const LLUUID& uuid);
139
140	LLInventoryObject* getInventoryObject() const;
141	LLInventoryModel* getInventoryModel() const;
142	
143	BOOL isLinkedObjectInTrash() const; // Is this obj or its baseobj in the trash?
144	BOOL isLinkedObjectMissing() const; // Is this a linked obj whose baseobj is not in inventory?
145
146	BOOL isAgentInventory() const; // false if lost or in the inventory library
147	BOOL isCOFFolder() const; // true if COF or descendent of
148	BOOL isInboxFolder() const; // true if COF or descendent of marketplace inbox
149	BOOL isOutboxFolder() const; // true if COF or descendent of marketplace outbox
150	BOOL isOutboxFolderDirectParent() const;
151	const LLUUID getOutboxFolder() const;
152
153	virtual BOOL isItemPermissive() const;
154	static void changeItemParent(LLInventoryModel* model,
155								 LLViewerInventoryItem* item,
156								 const LLUUID& new_parent,
157								 BOOL restamp);
158	static void changeCategoryParent(LLInventoryModel* model,
159									 LLViewerInventoryCategory* item,
160									 const LLUUID& new_parent,
161									 BOOL restamp);
162	void removeBatchNoCheck(LLDynamicArray<LLFolderViewEventListener*>& batch);
163protected:
164	LLHandle<LLPanel> mInventoryPanel;
165	LLFolderView* mRoot;
166	const LLUUID mUUID;	// item id
167	LLInventoryType::EType mInvType;
168	BOOL mIsLink;
169	void purgeItem(LLInventoryModel *model, const LLUUID &uuid);
170};
171
172//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
173// Class LLInvFVBridgeBuilder
174//
175// This class intended to build Folder View Bridge via LLInvFVBridge::createBridge.
176// It can be overridden with another way of creation necessary Inventory-Folder-View-Bridge.
177//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
178class LLInventoryFVBridgeBuilder
179{
180public:
181 	virtual ~LLInventoryFVBridgeBuilder() {}
182	virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
183										LLAssetType::EType actual_asset_type,
184										LLInventoryType::EType inv_type,
185										LLInventoryPanel* inventory,
186										LLFolderView* root,
187										const LLUUID& uuid,
188										U32 flags = 0x00) const;
189};
190
191class LLItemBridge : public LLInvFVBridge
192{
193public:
194	LLItemBridge(LLInventoryPanel* inventory, 
195				 LLFolderView* root,
196				 const LLUUID& uuid) :
197		LLInvFVBridge(inventory, root, uuid) {}
198
199	virtual void performAction(LLInventoryModel* model, std::string action);
200	virtual void selectItem();
201	virtual void restoreItem();
202	virtual void restoreToWorld();
203	virtual void gotoItem();
204	virtual LLUIImagePtr getIcon() const;
205	virtual const std::string& getDisplayName() const;
206	virtual std::string getLabelSuffix() const;
207	virtual LLFontGL::StyleFlags getLabelStyle() const;
208	virtual PermissionMask getPermissionMask() const;
209	virtual time_t getCreationDate() const;
210	virtual BOOL isItemRenameable() const;
211	virtual BOOL renameItem(const std::string& new_name);
212	virtual BOOL removeItem();
213	virtual BOOL isItemCopyable() const;
214	virtual BOOL copyToClipboard() const;
215	virtual BOOL hasChildren() const { return FALSE; }
216	virtual BOOL isUpToDate() const { return TRUE; }
217
218	/*virtual*/ void clearDisplayName() { mDisplayName.clear(); }
219
220	LLViewerInventoryItem* getItem() const;
221
222protected:
223	BOOL confirmRemoveItem(const LLSD& notification, const LLSD& response);
224	virtual BOOL isItemPermissive() const;
225	static void buildDisplayName(LLInventoryItem* item, std::string& name);
226
227	mutable std::string mDisplayName;
228};
229
230class LLFolderBridge : public LLInvFVBridge
231{
232public:
233	LLFolderBridge(LLInventoryPanel* inventory, 
234				   LLFolderView* root,
235				   const LLUUID& uuid) :
236		LLInvFVBridge(inventory, root, uuid),
237		mCallingCards(FALSE),
238		mWearables(FALSE)
239	{}
240		
241	BOOL dragItemIntoFolder(LLInventoryItem* inv_item, BOOL drop, std::string& tooltip_msg);
242	BOOL dragCategoryIntoFolder(LLInventoryCategory* inv_category, BOOL drop, std::string& tooltip_msg);
243
244	virtual void performAction(LLInventoryModel* model, std::string action);
245	virtual void openItem();
246	virtual void closeItem();
247	virtual BOOL isItemRenameable() const;
248	virtual void selectItem();
249	virtual void restoreItem();
250
251	virtual LLFolderType::EType getPreferredType() const;
252	virtual LLUIImagePtr getIcon() const;
253	virtual LLUIImagePtr getOpenIcon() const;
254	static LLUIImagePtr getIcon(LLFolderType::EType preferred_type);
255
256	virtual BOOL renameItem(const std::string& new_name);
257
258	virtual BOOL removeItem();
259	BOOL removeSystemFolder();
260	bool removeItemResponse(const LLSD& notification, const LLSD& response);
261
262	virtual void pasteFromClipboard();
263	virtual void pasteLinkFromClipboard();
264	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
265	virtual BOOL hasChildren() const;
266	virtual BOOL dragOrDrop(MASK mask, BOOL drop,
267							EDragAndDropType cargo_type,
268							void* cargo_data,
269							std::string& tooltip_msg);
270
271	virtual BOOL isItemRemovable() const;
272	virtual BOOL isItemMovable() const ;
273	virtual BOOL isUpToDate() const;
274	virtual BOOL isItemCopyable() const;
275	virtual BOOL isClipboardPasteable() const;
276	virtual BOOL isClipboardPasteableAsLink() const;
277	virtual BOOL copyToClipboard() const;
278	
279	static void createWearable(LLFolderBridge* bridge, LLWearableType::EType type);
280
281	LLViewerInventoryCategory* getCategory() const;
282	LLHandle<LLFolderBridge> getHandle() { mHandle.bind(this); return mHandle; }
283
284protected:
285	void buildContextMenuBaseOptions(U32 flags);
286	void buildContextMenuFolderOptions(U32 flags);
287
288	//--------------------------------------------------------------------
289	// Menu callbacks
290	//--------------------------------------------------------------------
291	static void pasteClipboard(void* user_data);
292	static void createNewCategory(void* user_data);
293	static void createNewShirt(void* user_data);
294	static void createNewPants(void* user_data);
295	static void createNewShoes(void* user_data);
296	static void createNewSocks(void* user_data);
297	static void createNewJacket(void* user_data);
298	static void createNewSkirt(void* user_data);
299	static void createNewGloves(void* user_data);
300	static void createNewUndershirt(void* user_data);
301	static void createNewUnderpants(void* user_data);
302	static void createNewShape(void* user_data);
303	static void createNewSkin(void* user_data);
304	static void createNewHair(void* user_data);
305	static void createNewEyes(void* user_data);
306
307	BOOL checkFolderForContentsOfType(LLInventoryModel* model, LLInventoryCollectFunctor& typeToCheck);
308
309	void modifyOutfit(BOOL append);
310	void determineFolderType();
311
312	menuentry_vec_t getMenuItems() { return mItems; } // returns a copy of current menu items
313
314	void dropToFavorites(LLInventoryItem* inv_item);
315	void dropToOutfit(LLInventoryItem* inv_item, BOOL move_is_into_current_outfit);
316
317	//--------------------------------------------------------------------
318	// Messy hacks for handling folder options
319	//--------------------------------------------------------------------
320public:
321	static LLHandle<LLFolderBridge> sSelf;
322	static void staticFolderOptionsMenu();
323
324private:
325	BOOL				mCallingCards;
326	BOOL				mWearables;
327	menuentry_vec_t		mItems;
328	menuentry_vec_t		mDisabledItems;
329	LLRootHandle<LLFolderBridge> mHandle;
330};
331
332class LLTextureBridge : public LLItemBridge
333{
334public:
335	LLTextureBridge(LLInventoryPanel* inventory, 
336					LLFolderView* root,
337					const LLUUID& uuid, 
338					LLInventoryType::EType type) :
339		LLItemBridge(inventory, root, uuid)
340	{
341		mInvType = type;
342	}
343	virtual LLUIImagePtr getIcon() const;
344	virtual void openItem();
345	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
346	virtual void performAction(LLInventoryModel* model, std::string action);
347	bool canSaveTexture(void);
348};
349
350class LLSoundBridge : public LLItemBridge
351{
352public:
353 	LLSoundBridge(LLInventoryPanel* inventory, 
354				  LLFolderView* root,
355				  const LLUUID& uuid) :
356		LLItemBridge(inventory, root, uuid) {}
357	virtual void openItem();
358	virtual void previewItem();
359	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
360	static void openSoundPreview(void*);
361};
362
363class LLLandmarkBridge : public LLItemBridge
364{
365public:
366 	LLLandmarkBridge(LLInventoryPanel* inventory, 
367					 LLFolderView* root,
368					 const LLUUID& uuid, 
369					 U32 flags = 0x00);
370	virtual void performAction(LLInventoryModel* model, std::string action);
371	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
372	virtual LLUIImagePtr getIcon() const;
373	virtual void openItem();
374protected:
375	BOOL mVisited;
376};
377
378class LLCallingCardBridge : public LLItemBridge
379{
380public:
381	LLCallingCardBridge(LLInventoryPanel* inventory, 
382						LLFolderView* folder,
383						const LLUUID& uuid );
384	~LLCallingCardBridge();
385	virtual std::string getLabelSuffix() const;
386	//virtual const std::string& getDisplayName() const;
387	virtual LLUIImagePtr getIcon() const;
388	virtual void performAction(LLInventoryModel* model, std::string action);
389	virtual void openItem();
390	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
391	virtual BOOL dragOrDrop(MASK mask, BOOL drop,
392							EDragAndDropType cargo_type,
393							void* cargo_data,
394							std::string& tooltip_msg);
395	void refreshFolderViewItem();
396protected:
397	LLCallingCardObserver* mObserver;
398};
399
400class LLNotecardBridge : public LLItemBridge
401{
402public:
403	LLNotecardBridge(LLInventoryPanel* inventory, 
404					 LLFolderView* root,
405					 const LLUUID& uuid) :
406		LLItemBridge(inventory, root, uuid) {}
407	virtual void openItem();
408};
409
410class LLGestureBridge : public LLItemBridge
411{
412public:
413	LLGestureBridge(LLInventoryPanel* inventory, 
414					LLFolderView* root,
415					const LLUUID& uuid) :
416		LLItemBridge(inventory, root, uuid) {}
417	// Only suffix for gesture items, not task items, because only
418	// gestures in your inventory can be active.
419	virtual LLFontGL::StyleFlags getLabelStyle() const;
420	virtual std::string getLabelSuffix() const;
421	virtual void performAction(LLInventoryModel* model, std::string action);
422	virtual void openItem();
423	virtual BOOL removeItem();
424	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
425	static void playGesture(const LLUUID& item_id);
426};
427
428class LLAnimationBridge : public LLItemBridge
429{
430public:
431	LLAnimationBridge(LLInventoryPanel* inventory, 
432					  LLFolderView* root, 
433					  const LLUUID& uuid) :
434		LLItemBridge(inventory, root, uuid) {}
435	virtual void performAction(LLInventoryModel* model, std::string action);
436	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
437	virtual void openItem();
438};
439
440class LLObjectBridge : public LLItemBridge
441{
442public:
443	LLObjectBridge(LLInventoryPanel* inventory, 
444				   LLFolderView* root, 
445				   const LLUUID& uuid, 
446				   LLInventoryType::EType type, 
447				   U32 flags);
448	virtual LLUIImagePtr	getIcon() const;
449	virtual void			performAction(LLInventoryModel* model, std::string action);
450	virtual void			openItem();
451	virtual std::string getLabelSuffix() const;
452	virtual void			buildContextMenu(LLMenuGL& menu, U32 flags);
453	virtual BOOL renameItem(const std::string& new_name);
454	LLInventoryObject* getObject() const;
455protected:
456	static LLUUID sContextMenuItemID;  // Only valid while the context menu is open.
457	U32 mAttachPt;
458	BOOL mIsMultiObject;
459};
460
461class LLLSLTextBridge : public LLItemBridge
462{
463public:
464	LLLSLTextBridge(LLInventoryPanel* inventory, 
465					LLFolderView* root, 
466					const LLUUID& uuid ) :
467		LLItemBridge(inventory, root, uuid) {}
468	virtual void openItem();
469};
470
471class LLWearableBridge : public LLItemBridge
472{
473public:
474	LLWearableBridge(LLInventoryPanel* inventory, 
475					 LLFolderView* root, 
476					 const LLUUID& uuid, 
477					 LLAssetType::EType asset_type, 
478					 LLInventoryType::EType inv_type, 
479					 LLWearableType::EType wearable_type);
480	virtual LLUIImagePtr getIcon() const;
481	virtual void	performAction(LLInventoryModel* model, std::string action);
482	virtual void	openItem();
483	virtual void	buildContextMenu(LLMenuGL& menu, U32 flags);
484	virtual std::string getLabelSuffix() const;
485	virtual BOOL renameItem(const std::string& new_name);
486	virtual LLWearableType::EType getWearableType() const { return mWearableType; }
487
488	static void		onWearOnAvatar( void* userdata );	// Access to wearOnAvatar() from menu
489	static BOOL		canWearOnAvatar( void* userdata );
490	static void		onWearOnAvatarArrived( LLWearable* wearable, void* userdata );
491	void			wearOnAvatar();
492
493	static void		onWearAddOnAvatarArrived( LLWearable* wearable, void* userdata );
494	void			wearAddOnAvatar();
495
496	static BOOL		canEditOnAvatar( void* userdata );	// Access to editOnAvatar() from menu
497	static void		onEditOnAvatar( void* userdata );
498	void			editOnAvatar();
499
500	static BOOL		canRemoveFromAvatar( void* userdata );
501	static void		onRemoveFromAvatar( void* userdata );
502	static void		onRemoveFromAvatarArrived( LLWearable* wearable, 	void* userdata );
503	static void 	removeItemFromAvatar(LLViewerInventoryItem *item);
504	static void 	removeAllClothesFromAvatar();
505	void			removeFromAvatar();
506protected:
507	LLAssetType::EType mAssetType;
508	LLWearableType::EType  mWearableType;
509};
510
511class LLLinkItemBridge : public LLItemBridge
512{
513public:
514	LLLinkItemBridge(LLInventoryPanel* inventory, 
515					 LLFolderView* root,
516					 const LLUUID& uuid) :
517		LLItemBridge(inventory, root, uuid) {}
518	virtual const std::string& getPrefix() { return sPrefix; }
519	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
520protected:
521	static std::string sPrefix;
522};
523
524class LLLinkFolderBridge : public LLItemBridge
525{
526public:
527	LLLinkFolderBridge(LLInventoryPanel* inventory, 
528					   LLFolderView* root,
529					   const LLUUID& uuid) :
530		LLItemBridge(inventory, root, uuid) {}
531	virtual const std::string& getPrefix() { return sPrefix; }
532	virtual LLUIImagePtr getIcon() const;
533	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
534	virtual void performAction(LLInventoryModel* model, std::string action);
535	virtual void gotoItem();
536protected:
537	const LLUUID &getFolderID() const;
538	static std::string sPrefix;
539};
540
541
542class LLMeshBridge : public LLItemBridge
543{
544	friend class LLInvFVBridge;
545public:
546	virtual LLUIImagePtr getIcon() const;
547	virtual void openItem();
548	virtual void previewItem();
549	virtual void buildContextMenu(LLMenuGL& menu, U32 flags);
550
551protected:
552	LLMeshBridge(LLInventoryPanel* inventory, 
553		     LLFolderView* root,
554		     const LLUUID& uuid) :
555                       LLItemBridge(inventory, root, uuid) {}
556};
557
558
559//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
560// Class LLInvFVBridgeAction
561//
562// This is an implementation class to be able to 
563// perform action to view inventory items.
564//
565//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
566class LLInvFVBridgeAction
567{
568public:
569	// This method is a convenience function which creates the correct
570	// type of bridge action based on some basic information.
571	static LLInvFVBridgeAction* createAction(LLAssetType::EType asset_type,
572											 const LLUUID& uuid,
573											 LLInventoryModel* model);
574	static void doAction(LLAssetType::EType asset_type,
575						 const LLUUID& uuid, LLInventoryModel* model);
576	static void doAction(const LLUUID& uuid, LLInventoryModel* model);
577
578	virtual void doIt() {};
579	virtual ~LLInvFVBridgeAction() {} // need this because of warning on OSX
580protected:
581	LLInvFVBridgeAction(const LLUUID& id, LLInventoryModel* model) :
582		mUUID(id), mModel(model) {}
583	LLViewerInventoryItem* getItem() const;
584protected:
585	const LLUUID& mUUID; // item id
586	LLInventoryModel* mModel;
587};
588
589class LLMeshBridgeAction: public LLInvFVBridgeAction
590{
591	friend class LLInvFVBridgeAction;
592public:
593	virtual void	doIt() ;
594	virtual ~LLMeshBridgeAction(){}
595protected:
596	LLMeshBridgeAction(const LLUUID& id,LLInventoryModel* model):LLInvFVBridgeAction(id,model){}
597
598};
599
600
601//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
602// Recent Inventory Panel related classes
603//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
604
605// Overridden version of the Inventory-Folder-View-Bridge for Folders
606class LLRecentItemsFolderBridge : public LLFolderBridge
607{
608	friend class LLInvFVBridgeAction;
609public:
610	// Creates context menu for Folders related to Recent Inventory Panel.
611	// Uses base logic and than removes from visible items "New..." menu items.
612	LLRecentItemsFolderBridge(LLInventoryType::EType type,
613							  LLInventoryPanel* inventory,
614							  LLFolderView* root,
615							  const LLUUID& uuid) :
616		LLFolderBridge(inventory, root, uuid)
617	{
618		mInvType = type;
619	}
620	/*virtual*/ void buildContextMenu(LLMenuGL& menu, U32 flags);
621};
622
623// Bridge builder to create Inventory-Folder-View-Bridge for Recent Inventory Panel
624class LLRecentInventoryBridgeBuilder : public LLInventoryFVBridgeBuilder
625{
626public:
627	// Overrides FolderBridge for Recent Inventory Panel.
628	// It use base functionality for bridges other than FolderBridge.
629	virtual LLInvFVBridge* createBridge(LLAssetType::EType asset_type,
630		LLAssetType::EType actual_asset_type,
631		LLInventoryType::EType inv_type,
632		LLInventoryPanel* inventory,
633		LLFolderView* root,
634		const LLUUID& uuid,
635		U32 flags = 0x00) const;
636};
637
638void rez_attachment(LLViewerInventoryItem* item, 
639					LLViewerJointAttachment* attachment,
640					bool replace = false);
641
642// Move items from an in-world object's "Contents" folder to a specified
643// folder in agent inventory.
644BOOL move_inv_category_world_to_agent(const LLUUID& object_id, 
645									  const LLUUID& category_id,
646									  BOOL drop,
647									  void (*callback)(S32, void*) = NULL,
648									  void* user_data = NULL);
649
650// Utility function to hide all entries except those in the list
651// Can be called multiple times on the same menu (e.g. if multiple items
652// are selected).  If "append" is false, then only common enabled items
653// are set as enabled.
654void hide_context_entries(LLMenuGL& menu, 
655						  const menuentry_vec_t &entries_to_show, 
656						  const menuentry_vec_t &disabled_entries);
657
658#endif // LL_LLINVENTORYBRIDGE_H