llpanelinventory.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /**
  2. * @file llpanelinventory.h
  3. * @brief LLPanelInventory class definition
  4. *
  5. * $LicenseInfo:firstyear=2002&license=viewergpl$
  6. *
  7. * Copyright (c) 2002-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. // ****************************************************************************
  33. // This class represents the panel used to view and control a particular task's
  34. // inventory.
  35. // ****************************************************************************
  36. #ifndef LL_LLPANELINVENTORY_H
  37. #define LL_LLPANELINVENTORY_H
  38. #include <string>
  39. #include <vector>
  40. #include "llinventory.h"
  41. #include "llpanel.h"
  42. #include "lluuid.h"
  43. #include "llviewerobject.h"
  44. #include "llvoinventorylistener.h"
  45. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  46. // Class LLPanelInventory
  47. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  48. class LLMenuGL;
  49. class LLFolderView;
  50. class LLFolderViewEventListener;
  51. class LLFolderViewFolder;
  52. class LLScrollableContainer;
  53. class LLViewerObject;
  54. // Utility function to hide all entries except those in the list
  55. void hideContextEntries(LLMenuGL& menu,
  56. const std::vector<std::string>& entries_to_show,
  57. const std::vector<std::string>& disabled_entries);
  58. class LLPanelInventory final : public LLPanel, public LLVOInventoryListener
  59. {
  60. protected:
  61. LOG_CLASS(LLPanelInventory);
  62. protected:
  63. void reset();
  64. void inventoryChanged(LLViewerObject* object,
  65. LLInventoryObject::object_list_t* invp, S32,
  66. void*) override;
  67. void updateInventory();
  68. // These two methods return the number of total views (inventory items and
  69. // sub-categories) created in the category.
  70. U32 createFolderViews(LLInventoryObject* inventory_root,
  71. LLInventoryObject::object_list_t& contents);
  72. U32 createViewsForCategory(LLInventoryObject::object_list_t* inventory,
  73. LLInventoryObject* parent,
  74. LLFolderViewFolder* folder);
  75. void clearContents();
  76. public:
  77. LLPanelInventory(const std::string& name, const LLRect& rect);
  78. ~LLPanelInventory() override;
  79. void refresh() override;
  80. LL_INLINE const LLUUID& getTaskUUID() { return mTaskUUID;}
  81. void removeSelectedItem();
  82. void startRenamingSelectedItem();
  83. LL_INLINE LLFolderView* getRootFolder() const { return mFolders; }
  84. LL_INLINE U32 getViewsCount() const { return mItemsCount; }
  85. void draw() override;
  86. void deleteAllChildren() override;
  87. bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
  88. EDragAndDropType cargo_type, void* cargo_data,
  89. EAcceptance* accept, std::string& tooltip) override;
  90. static void idle(void* user_data);
  91. protected:
  92. LLScrollableContainer* mScroller;
  93. LLFolderView* mFolders;
  94. LLUUID mTaskUUID;
  95. LLUUID mAttachmentUUID;
  96. U32 mItemsCount;
  97. bool mHaveInventory;
  98. bool mIsInventoryEmpty;
  99. bool mInventoryNeedsUpdate;
  100. };
  101. #endif // LL_LLPANELINVENTORY_H