llinventorybridge.h 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811
  1. /**
  2. * @file llinventorybridge.h
  3. * @brief Implementation of the Inventory-Folder-View-Bridge classes.
  4. *
  5. * $LicenseInfo:firstyear=2001&license=viewergpl$
  6. *
  7. * Copyright (c) 2001-2009, Linden Research, Inc.
  8. *
  9. * Second Life Viewer Source Code
  10. * The source code in this file ("Source Code") is provided by Linden Lab
  11. * to you under the terms of the GNU General Public License, version 2.0
  12. * ("GPL"), unless you have obtained a separate licensing agreement
  13. * ("Other License"), formally executed by you and Linden Lab. Terms of
  14. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  15. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  16. *
  17. * There are special exceptions to the terms and conditions of the GPL as
  18. * it is applied to this Source Code. View the full text of the exception
  19. * in the file doc/FLOSS-exception.txt in this software distribution, or
  20. * online at
  21. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  22. *
  23. * By copying, modifying or distributing this software, you acknowledge
  24. * that you have read and understood your obligations described above,
  25. * and agree to abide by those obligations.
  26. *
  27. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  28. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  29. * COMPLETENESS OR PERFORMANCE.
  30. * $/LicenseInfo$
  31. */
  32. #ifndef LL_LLINVENTORYBRIDGE_H
  33. #define LL_LLINVENTORYBRIDGE_H
  34. #include <vector>
  35. #include "llavatartracker.h"
  36. #include "llfolderview.h"
  37. #include "llinventorymodel.h"
  38. #include "llviewerwearable.h"
  39. class LLInventoryModel;
  40. class LLLandmark;
  41. // The "Restore to Last Position" feature is no more supported in SL and was
  42. // never implemented in OpenSim... In SL, it also relies on having rez rights
  43. // at position 0,0 in the sim, which is rarely the case in mainland regions...
  44. #define LL_RESTORE_TO_WORLD 0
  45. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46. // Class LLInvFVBridge (& its derived classes)
  47. //
  48. // Short for Inventory-Folder-View-Bridge. This is an
  49. // implementation class to be able to view inventory items.
  50. //
  51. // You'll want to call LLInvItemFVELister::createBridge() to actually create
  52. // an instance of this class. This helps encapsulate the
  53. // funcationality a bit. (except for folders, you can create those
  54. // manually...)
  55. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  56. class LLInvFVBridge : public LLFolderViewEventListener
  57. {
  58. protected:
  59. LOG_CLASS(LLInvFVBridge);
  60. public:
  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. const LLUUID& uuid,
  68. U32 flags = 0x00);
  69. ~LLInvFVBridge() override = default;
  70. LL_INLINE const LLUUID& getUUID() const override { return mUUID; }
  71. LL_INLINE virtual const LLUUID& getThumbnailUUID() const
  72. {
  73. return LLUUID::null;
  74. }
  75. LL_INLINE virtual const std::string& getPrefix() { return LLStringUtil::null; }
  76. LL_INLINE virtual void restoreItem() {}
  77. #if LL_RESTORE_TO_WORLD
  78. LL_INLINE virtual void restoreToWorld() {}
  79. #endif
  80. // LLFolderViewEventListener methods
  81. const std::string& getName() const override;
  82. LL_INLINE const std::string& getDisplayName() const override
  83. {
  84. return getName();
  85. }
  86. LL_INLINE PermissionMask getPermissionMask() const override
  87. {
  88. return PERM_ALL; // Folders have full perms
  89. }
  90. LL_INLINE LLFolderType::EType getPreferredType() const override
  91. {
  92. return LLFolderType::FT_NONE;
  93. }
  94. // NOTE: folders do not have a creation date
  95. LL_INLINE time_t getCreationDate() const override { return 0; }
  96. LL_INLINE LLFontGL::StyleFlags getLabelStyle() const override
  97. {
  98. return LLFontGL::NORMAL;
  99. }
  100. LL_INLINE std::string getLabelSuffix() const override { return LLStringUtil::null; }
  101. LL_INLINE void openItem() override {}
  102. LL_INLINE void previewItem() override { openItem(); }
  103. void showProperties() override;
  104. LL_INLINE virtual bool isMultiPreviewAllowed() const { return true; }
  105. LL_INLINE bool isItemRenameable() const override { return true; }
  106. bool isItemRemovable() override;
  107. bool isItemMovable() override;
  108. void removeBatch(std::vector<LLFolderViewEventListener*>& batch) override;
  109. LL_INLINE void move(LLFolderViewEventListener*) override
  110. {
  111. }
  112. LL_INLINE bool isItemCopyable() const override { return false; }
  113. LL_INLINE bool copyToClipboard() const override { return false; }
  114. bool cutToClipboard() const override;
  115. bool isClipboardPasteable() const override;
  116. virtual bool isClipboardPasteableAsLink() const;
  117. LL_INLINE void pasteFromClipboard() override {}
  118. LL_INLINE void pasteLinkFromClipboard() override {}
  119. void getClipboardEntries(bool show_asset_id,
  120. std::vector<std::string>& items,
  121. std::vector<std::string>& disabled_items,
  122. U32 flags);
  123. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  124. bool startDrag(EDragAndDropType* type, LLUUID* id) const override;
  125. LL_INLINE bool dragOrDrop(MASK, bool, EDragAndDropType, void*,
  126. std::string&) override
  127. {
  128. return false;
  129. }
  130. LL_INLINE LLInventoryType::EType getInventoryType() const override
  131. {
  132. return mInvType;
  133. }
  134. LL_INLINE S32 getSubType() const override
  135. {
  136. return mSubType;
  137. }
  138. // LLInvFVBridge functionality
  139. LL_INLINE virtual void clearDisplayName() {}
  140. //MK
  141. ////protected:
  142. //mk
  143. LLInvFVBridge(LLInventoryPanel* inv_panelp, const LLUUID& uuid)
  144. : mInventoryPanel(inv_panelp),
  145. mUUID(uuid),
  146. mInvType(LLInventoryType::IT_NONE)
  147. {
  148. }
  149. LLInventoryObject* getInventoryObject() const;
  150. bool isInTrash() const;
  151. bool isInLostAndFound() const;
  152. bool isInCOF() const;
  153. bool isInMarketplace() const;
  154. // Is this obj or its baseobj in the trash ?
  155. bool isLinkedObjectInTrash() const;
  156. // Is this a linked obj whose baseobj is not in inventory ?
  157. bool isLinkedObjectMissing() const;
  158. // Returns true if the item is in agent inventory. If false, it must be
  159. // lost or in the inventory library.
  160. bool isAgentInventory() const;
  161. LL_INLINE virtual bool isItemPermissive() const { return false; }
  162. static void changeItemParent(LLInventoryModel* model,
  163. LLViewerInventoryItem* item,
  164. const LLUUID& new_parent,
  165. bool restamp);
  166. static void changeCategoryParent(LLInventoryModel* model,
  167. LLViewerInventoryCategory* item,
  168. const LLUUID& new_parent,
  169. bool restamp);
  170. void removeBatchNoCheck(std::vector<LLFolderViewEventListener*>& batch);
  171. void purgeItem(LLInventoryModel* model, const LLUUID& uuid);
  172. protected:
  173. LLInventoryPanel* mInventoryPanel;
  174. LLUUID mUUID; // item id
  175. LLInventoryType::EType mInvType;
  176. S32 mSubType;
  177. };
  178. class LLItemBridge : public LLInvFVBridge
  179. {
  180. protected:
  181. LOG_CLASS(LLItemBridge);
  182. public:
  183. LLItemBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  184. : LLInvFVBridge(inventory, uuid)
  185. {
  186. }
  187. void performAction(LLFolderView* folderp, LLInventoryModel* modelp,
  188. const std::string& action) override;
  189. void selectItem() override;
  190. void restoreItem() override;
  191. #if LL_RESTORE_TO_WORLD
  192. void restoreToWorld() override;
  193. #endif
  194. virtual void gotoItem(LLFolderView* folderp);
  195. LLUIImagePtr getIcon() const override;
  196. const std::string& getDisplayName() const override;
  197. std::string getLabelSuffix() const override;
  198. PermissionMask getPermissionMask() const override;
  199. time_t getCreationDate() const override;
  200. bool isItemRenameable() const override;
  201. bool renameItem(const std::string& new_name) override;
  202. bool removeItem() override;
  203. bool isItemCopyable() const override;
  204. bool copyToClipboard() const override;
  205. LL_INLINE bool isUpToDate() const override { return true; }
  206. LL_INLINE bool hasChildren() const override { return false; }
  207. // Override for LLInvFVBridge
  208. LL_INLINE void clearDisplayName() override { mDisplayName.clear(); }
  209. LLViewerInventoryItem* getItem() const;
  210. const LLUUID& getThumbnailUUID() const override;
  211. protected:
  212. bool isItemPermissive() const override;
  213. static void buildDisplayName(LLInventoryItem* item, std::string& name);
  214. mutable std::string mDisplayName;
  215. };
  216. class LLFolderBridge : public LLInvFVBridge
  217. {
  218. friend class LLInvFVBridge;
  219. protected:
  220. LOG_CLASS(LLFolderBridge);
  221. public:
  222. ~LLFolderBridge() override;
  223. bool dragItemIntoFolder(LLInventoryItem* inv_item,
  224. bool drop, std::string& tooltip_msg);
  225. bool dragCategoryIntoFolder(LLInventoryCategory* inv_category,
  226. bool drop, std::string& tooltip_msg);
  227. void performAction(LLFolderView* folder, LLInventoryModel* model,
  228. const std::string& action) override;
  229. void openItem() override;
  230. bool isItemRenameable() const override;
  231. LL_INLINE void selectItem() override {}
  232. void restoreItem() override;
  233. LLFolderType::EType getPreferredType() const override;
  234. LLUIImagePtr getIcon() const override;
  235. std::string getLabelSuffix() const override;
  236. LLFontGL::StyleFlags getLabelStyle() const override;
  237. const LLUUID& getThumbnailUUID() const override;
  238. bool renameItem(const std::string& new_name) override;
  239. bool removeItem() override;
  240. void pasteFromClipboard() override;
  241. void pasteLinkFromClipboard() override;
  242. bool isClipboardPasteableAsLink() const override;
  243. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  244. bool hasChildren() const override;
  245. bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type,
  246. void* cargo_data, std::string& tooltip_msg) override;
  247. bool isItemRemovable() override;
  248. bool isItemMovable() override;
  249. bool isUpToDate() const override;
  250. bool isItemCopyable() const override;
  251. bool copyToClipboard() const override;
  252. LLViewerInventoryCategory* getCategory() const;
  253. protected:
  254. LLFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  255. : LLInvFVBridge(inventory, uuid),
  256. mCallingCards(false),
  257. mWearables(false)
  258. {
  259. }
  260. bool checkFolderForContentsOfType(LLInventoryModel* model,
  261. LLInventoryCollectFunctor& typeToCheck);
  262. void modifyOutfit(bool append, bool replace);
  263. public:
  264. static LLFolderBridge* sSelf;
  265. static void staticFolderOptionsMenu();
  266. void folderOptionsMenu(U32 flags = FIRST_SELECTED_ITEM);
  267. private:
  268. bool mCallingCards;
  269. bool mWearables;
  270. LLMenuGL* mMenu;
  271. std::vector<std::string> mItems;
  272. std::vector<std::string> mDisabledItems;
  273. };
  274. // DEPRECATED
  275. class LLScriptBridge final : public LLItemBridge
  276. {
  277. friend class LLInvFVBridge;
  278. protected:
  279. LOG_CLASS(LLScriptBridge);
  280. public:
  281. LLUIImagePtr getIcon() const;
  282. protected:
  283. LLScriptBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  284. : LLItemBridge(inventory, uuid)
  285. {
  286. }
  287. };
  288. class LLTextureBridge final : public LLItemBridge
  289. {
  290. friend class LLInvFVBridge;
  291. protected:
  292. LOG_CLASS(LLTextureBridge);
  293. public:
  294. const std::string& getPrefix() override;
  295. LLUIImagePtr getIcon() const override;
  296. void openItem() override;
  297. protected:
  298. LL_INLINE LLTextureBridge(LLInventoryPanel* inventory, const LLUUID& uuid,
  299. LLInventoryType::EType type)
  300. : LLItemBridge(inventory, uuid), mInvType(type)
  301. {
  302. }
  303. protected:
  304. LLInventoryType::EType mInvType;
  305. };
  306. class LLSoundBridge final : public LLItemBridge
  307. {
  308. friend class LLInvFVBridge;
  309. protected:
  310. LOG_CLASS(LLSoundBridge);
  311. public:
  312. const std::string& getPrefix() override;
  313. LLUIImagePtr getIcon() const override;
  314. void openItem() override;
  315. void previewItem() override;
  316. void performAction(LLFolderView* folder, LLInventoryModel* model,
  317. const std::string& action) override;
  318. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  319. protected:
  320. LLSoundBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  321. : LLItemBridge(inventory, uuid)
  322. {
  323. }
  324. };
  325. class LLLandmarkBridge final : public LLItemBridge
  326. {
  327. friend class LLInvFVBridge;
  328. protected:
  329. LOG_CLASS(LLLandmarkBridge);
  330. public:
  331. const std::string& getPrefix() override;
  332. void performAction(LLFolderView* folder, LLInventoryModel* model,
  333. const std::string& action) override;
  334. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  335. LLUIImagePtr getIcon() const override;
  336. void openItem() override;
  337. void showOnMap(LLLandmark* landmark);
  338. protected:
  339. LLLandmarkBridge(LLInventoryPanel* inventory,
  340. const LLUUID& uuid, U32 flags = 0x00)
  341. : LLItemBridge(inventory, uuid)
  342. {
  343. mVisited = (flags & LLInventoryItem::II_FLAGS_LANDMARK_VISITED) != 0;
  344. }
  345. protected:
  346. bool mVisited;
  347. };
  348. class LLCallingCardBridge;
  349. class LLCallingCardObserver final : public LLFriendObserver
  350. {
  351. public:
  352. LLCallingCardObserver(LLCallingCardBridge* bridge)
  353. : mBridgep(bridge)
  354. {
  355. }
  356. ~LLCallingCardObserver() override
  357. {
  358. mBridgep = NULL;
  359. }
  360. void changed(U32 mask) override;
  361. protected:
  362. LLCallingCardBridge* mBridgep;
  363. };
  364. class LLCallingCardBridge final : public LLItemBridge
  365. {
  366. friend class LLInvFVBridge;
  367. protected:
  368. LOG_CLASS(LLCallingCardBridge);
  369. public:
  370. const std::string& getPrefix() override;
  371. std::string getLabelSuffix() const override;
  372. //const std::string& getDisplayName() const override;
  373. LLUIImagePtr getIcon() const override;
  374. void performAction(LLFolderView* folder, LLInventoryModel* model,
  375. const std::string& action) override;
  376. void openItem() override;
  377. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  378. //void renameItem(const std::string& new_name) override;
  379. //bool removeItem() override;
  380. bool dragOrDrop(MASK mask, bool drop, EDragAndDropType cargo_type,
  381. void* cargo_data, std::string& tooltip_msg) override;
  382. void refreshFolderViewItem();
  383. protected:
  384. LLCallingCardBridge(LLInventoryPanel* inventory, const LLUUID& uuid);
  385. ~LLCallingCardBridge() override;
  386. protected:
  387. LLCallingCardObserver* mObserver;
  388. };
  389. class LLNotecardBridge final : public LLItemBridge
  390. {
  391. friend class LLInvFVBridge;
  392. protected:
  393. LOG_CLASS(LLNotecardBridge);
  394. public:
  395. const std::string& getPrefix() override;
  396. LLUIImagePtr getIcon() const override;
  397. void openItem() override;
  398. protected:
  399. LLNotecardBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  400. : LLItemBridge(inventory, uuid)
  401. {
  402. }
  403. };
  404. class LLGestureBridge final : public LLItemBridge
  405. {
  406. friend class LLInvFVBridge;
  407. protected:
  408. LOG_CLASS(LLGestureBridge);
  409. public:
  410. const std::string& getPrefix() override;
  411. LLUIImagePtr getIcon() const override;
  412. // Only suffix for gesture items, not task items, because only
  413. // gestures in your inventory can be active.
  414. LLFontGL::StyleFlags getLabelStyle() const override;
  415. std::string getLabelSuffix() const override;
  416. void performAction(LLFolderView* folder, LLInventoryModel* model,
  417. const std::string& action) override;
  418. void openItem() override;
  419. bool removeItem() override;
  420. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  421. protected:
  422. LLGestureBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  423. : LLItemBridge(inventory, uuid)
  424. {
  425. }
  426. };
  427. class LLAnimationBridge final : public LLItemBridge
  428. {
  429. friend class LLInvFVBridge;
  430. protected:
  431. LOG_CLASS(LLAnimationBridge);
  432. public:
  433. const std::string& getPrefix() override;
  434. void performAction(LLFolderView* folder, LLInventoryModel* model,
  435. const std::string& action) override;
  436. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  437. LLUIImagePtr getIcon() const override;
  438. void openItem() override;
  439. protected:
  440. LLAnimationBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  441. : LLItemBridge(inventory, uuid)
  442. {
  443. }
  444. };
  445. class LLObjectBridge final : public LLItemBridge
  446. {
  447. friend class LLInvFVBridge;
  448. protected:
  449. LOG_CLASS(LLObjectBridge);
  450. public:
  451. const std::string& getPrefix() override;
  452. LLUIImagePtr getIcon() const override;
  453. void performAction(LLFolderView* folder, LLInventoryModel* model,
  454. const std::string& action) override;
  455. void openItem() override;
  456. LLFontGL::StyleFlags getLabelStyle() const override;
  457. std::string getLabelSuffix() const override;
  458. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  459. bool isItemRemovable() override;
  460. bool renameItem(const std::string& new_name) override;
  461. protected:
  462. LLObjectBridge(LLInventoryPanel* inventory, const LLUUID& uuid,
  463. LLInventoryType::EType type, U32 flags)
  464. : LLItemBridge(inventory, uuid), mInvType(type)
  465. {
  466. mAttachPt = (flags & 0xff); // low bye of inventory flags
  467. mIsMultiObject = (flags & LLInventoryItem::II_FLAGS_OBJECT_HAS_MULTIPLE_ITEMS) != 0;
  468. }
  469. protected:
  470. U32 mAttachPt;
  471. LLInventoryType::EType mInvType;
  472. bool mIsMultiObject;
  473. };
  474. class LLLSLTextBridge final : public LLItemBridge
  475. {
  476. friend class LLInvFVBridge;
  477. protected:
  478. LOG_CLASS(LLLSLTextBridge);
  479. public:
  480. const std::string& getPrefix() override;
  481. LLUIImagePtr getIcon() const override;
  482. void openItem() override;
  483. protected:
  484. LLLSLTextBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  485. : LLItemBridge(inventory, uuid)
  486. {
  487. }
  488. };
  489. class LLWearableBridge final : public LLItemBridge
  490. {
  491. friend class LLInvFVBridge;
  492. protected:
  493. LOG_CLASS(LLWearableBridge);
  494. public:
  495. LLUIImagePtr getIcon() const override;
  496. void performAction(LLFolderView* folder, LLInventoryModel* model,
  497. const std::string& action) override;
  498. void openItem() override;
  499. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  500. LLFontGL::StyleFlags getLabelStyle() const override;
  501. std::string getLabelSuffix() const override;
  502. bool isItemRemovable() override;
  503. bool renameItem(const std::string& new_name) override;
  504. // Access to wearOnAvatar() from menu:
  505. static void onWearOnAvatar(void* userdata);
  506. static bool canWearOnAvatar(void* userdata);
  507. static void onWearOnAvatarArrived(LLViewerWearable* wearable,
  508. void* userdata);
  509. void wearOnAvatar(bool replace = true);
  510. // Access to editOnAvatar() from menu:
  511. static bool canEditOnAvatar(void* userdata);
  512. static void onEditOnAvatar(void* userdata);
  513. void editOnAvatar();
  514. static bool canRemoveFromAvatar(void* userdata);
  515. static void onRemoveFromAvatar(void* userdata);
  516. static void onRemoveFromAvatarArrived(LLViewerWearable* wearable,
  517. void* userdata);
  518. protected:
  519. LLWearableBridge(LLInventoryPanel* inventory,
  520. const LLUUID& uuid,
  521. LLAssetType::EType asset_type,
  522. LLInventoryType::EType inv_type,
  523. LLWearableType::EType wearable_type)
  524. : LLItemBridge(inventory, uuid),
  525. mAssetType(asset_type),
  526. mInvType(inv_type),
  527. mWearableType(wearable_type)
  528. {
  529. }
  530. protected:
  531. LLAssetType::EType mAssetType;
  532. LLInventoryType::EType mInvType;
  533. LLWearableType::EType mWearableType;
  534. };
  535. class LLLinkItemBridge final : public LLItemBridge
  536. {
  537. friend class LLInvFVBridge;
  538. protected:
  539. LOG_CLASS(LLLinkItemBridge);
  540. public:
  541. const std::string& getPrefix() override;
  542. LLUIImagePtr getIcon() const override;
  543. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  544. protected:
  545. LLLinkItemBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  546. : LLItemBridge(inventory, uuid)
  547. {
  548. }
  549. };
  550. class LLLinkFolderBridge final : public LLItemBridge
  551. {
  552. friend class LLInvFVBridge;
  553. protected:
  554. LOG_CLASS(LLLinkFolderBridge);
  555. public:
  556. const std::string& getPrefix() override;
  557. LLUIImagePtr getIcon() const override;
  558. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  559. void performAction(LLFolderView* folder, LLInventoryModel* model,
  560. const std::string& action) override;
  561. void gotoItem(LLFolderView* folder) override;
  562. protected:
  563. LLLinkFolderBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  564. : LLItemBridge(inventory, uuid)
  565. {
  566. }
  567. const LLUUID& getFolderID() const;
  568. };
  569. #if LL_MESH_ASSET_SUPPORT
  570. class LLMeshBridge final : public LLItemBridge
  571. {
  572. friend class LLInvFVBridge;
  573. protected:
  574. LOG_CLASS(LLMeshBridge);
  575. public:
  576. const std::string& getPrefix() override;
  577. LLUIImagePtr getIcon() const override;
  578. void openItem() override;
  579. void previewItem() override;
  580. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  581. void performAction(LLFolderView* folder, LLInventoryModel* model,
  582. const std::string& action) override;
  583. protected:
  584. LLMeshBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  585. : LLItemBridge(inventory, uuid)
  586. {
  587. }
  588. };
  589. #endif
  590. class LLSettingsBridge final : public LLItemBridge
  591. {
  592. friend class LLInvFVBridge;
  593. protected:
  594. LOG_CLASS(LLSettingsBridge);
  595. public:
  596. const std::string& getPrefix() override;
  597. LLUIImagePtr getIcon() const override;
  598. LLFontGL::StyleFlags getLabelStyle() const override;
  599. bool isMultiPreviewAllowed() const override { return false; }
  600. void openItem() override;
  601. void previewItem() override;
  602. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  603. void performAction(LLFolderView* folder, LLInventoryModel* model,
  604. const std::string& action) override;
  605. protected:
  606. LLSettingsBridge(LLInventoryPanel* inventory, const LLUUID& uuid, U32 type)
  607. : LLItemBridge(inventory, uuid),
  608. mSettingsType(type)
  609. {
  610. }
  611. protected:
  612. U32 mSettingsType;
  613. };
  614. class LLMaterialBridge final : public LLItemBridge
  615. {
  616. friend class LLInvFVBridge;
  617. protected:
  618. LOG_CLASS(LLMaterialBridge);
  619. public:
  620. const std::string& getPrefix() override;
  621. LLUIImagePtr getIcon() const override;
  622. bool isMultiPreviewAllowed() const override { return false; }
  623. void openItem() override;
  624. void previewItem() override;
  625. void buildContextMenu(LLMenuGL& menu, U32 flags) override;
  626. void performAction(LLFolderView* folder, LLInventoryModel* model,
  627. const std::string& action) override;
  628. protected:
  629. LLMaterialBridge(LLInventoryPanel* inventory, const LLUUID& uuid)
  630. : LLItemBridge(inventory, uuid)
  631. {
  632. }
  633. };
  634. class LLFindWearables final : public LLInventoryCollectFunctor
  635. {
  636. public:
  637. LLFindWearables() = default;
  638. bool operator()(LLInventoryCategory* cat,
  639. LLInventoryItem* item) override;
  640. };
  641. // Moves items from an in-world object's "Contents" folder to a specified
  642. // folder in agent inventory.
  643. // Also used in llfloateropenobject.cpp.
  644. bool 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. // Sets menu entries state according to on entries_to_show and disabled_entries
  650. // Also used in llpanelinventory.cpp.
  651. void set_menu_entries_state(LLMenuGL& menu,
  652. const std::vector<std::string>& entries_to_show,
  653. const std::vector<std::string>& disabled_entries);
  654. #endif // LL_LLINVENTORYBRIDGE_H