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