llfloaterinventory.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. /**
  2. * @file llfloaterinventory.h
  3. * @brief Inventory floaters classes definitions.
  4. * class definition
  5. *
  6. * $LicenseInfo:firstyear=2001&license=viewergpl$
  7. *
  8. * Copyright (c) 2001-2009, Linden Research, Inc.
  9. *
  10. * Second Life Viewer Source Code
  11. * The source code in this file ("Source Code") is provided by Linden Lab
  12. * to you under the terms of the GNU General Public License, version 2.0
  13. * ("GPL"), unless you have obtained a separate licensing agreement
  14. * ("Other License"), formally executed by you and Linden Lab. Terms of
  15. * the GPL can be found in doc/GPL-license.txt in this distribution, or
  16. * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
  17. *
  18. * There are special exceptions to the terms and conditions of the GPL as
  19. * it is applied to this Source Code. View the full text of the exception
  20. * in the file doc/FLOSS-exception.txt in this software distribution, or
  21. * online at
  22. * http://secondlifegrid.net/programs/open_source/licensing/flossexception
  23. *
  24. * By copying, modifying or distributing this software, you acknowledge
  25. * that you have read and understood your obligations described above,
  26. * and agree to abide by those obligations.
  27. *
  28. * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
  29. * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
  30. * COMPLETENESS OR PERFORMANCE.
  31. * $/LicenseInfo$
  32. */
  33. #ifndef LL_LLFLOATERINVENTORY_H
  34. #define LL_LLFLOATERINVENTORY_H
  35. #include <set>
  36. #include <vector>
  37. #include "llfloater.h"
  38. #include "llinventorymodel.h"
  39. class LLCheckBoxCtrl;
  40. class LLFloaterInventory;
  41. class LLFolderView;
  42. class LLInventoryFilter;
  43. class LLInventoryPanel;
  44. class LLSaveFolderState;
  45. class LLSearchEditor;
  46. class LLSpinCtrl;
  47. class LLTabContainer;
  48. class LLFloaterInventoryFilters : public LLFloater
  49. {
  50. public:
  51. LLFloaterInventoryFilters(const std::string& name, const LLRect& rect,
  52. LLFloaterInventory* inv);
  53. bool postBuild() override;
  54. void draw() override;
  55. void onClose(bool app_quitting) override;
  56. void changeFilter(LLInventoryFilter* filter);
  57. void updateElementsFromFilter();
  58. static void onTimeAgo(LLUICtrl*, void* userdata);
  59. static void onResetFilters(void* userdata);
  60. static void onCloseBtn(void* userdata);
  61. static void selectAllTypes(void* userdata);
  62. static void selectNoTypes(void* userdata);
  63. protected:
  64. LLFloaterInventory* mInventoryView;
  65. LLInventoryFilter* mFilter;
  66. LLCheckBoxCtrl* mCheckSinceLogoff;
  67. LLCheckBoxCtrl* mCheckShowEmpty;
  68. LLCheckBoxCtrl* mCheckAnimation;
  69. LLCheckBoxCtrl* mCheckCallingcard;
  70. LLCheckBoxCtrl* mCheckClothing;
  71. LLCheckBoxCtrl* mCheckGesture;
  72. LLCheckBoxCtrl* mCheckLandmark;
  73. LLCheckBoxCtrl* mCheckMaterial;
  74. LLCheckBoxCtrl* mCheckNotecard;
  75. LLCheckBoxCtrl* mCheckObject;
  76. LLCheckBoxCtrl* mCheckScript;
  77. LLCheckBoxCtrl* mCheckSnapshot;
  78. LLCheckBoxCtrl* mCheckSound;
  79. LLCheckBoxCtrl* mCheckTexture;
  80. #if LL_MESH_ASSET_SUPPORT
  81. LLCheckBoxCtrl* mCheckMesh;
  82. #endif
  83. LLCheckBoxCtrl* mCheckSettings;
  84. LLSpinCtrl* mSpinSinceDays;
  85. LLSpinCtrl* mSpinSinceHours;
  86. bool mHasMaterial;
  87. };
  88. class LLFloaterInventory final : public LLFloater, LLInventoryObserver
  89. {
  90. friend class LLFloaterInventoryFilters;
  91. protected:
  92. LOG_CLASS(LLFloaterInventory);
  93. // Internal initialization code
  94. void init(LLInventoryModel* modelp);
  95. public:
  96. LLFloaterInventory(const std::string& name, const std::string& rect,
  97. LLInventoryModel* modelp);
  98. LLFloaterInventory(const std::string& name, const LLRect& rect,
  99. LLInventoryModel* modelp);
  100. ~LLFloaterInventory() override;
  101. void changed(U32 mask) override;
  102. bool postBuild() override;
  103. //
  104. // Misc functions
  105. //
  106. void setFilterTextFromFilter();
  107. void startSearch();
  108. // This method makes sure that an inventory floater exists, is visible and
  109. // has focus. The chosen view is returned.
  110. static LLFloaterInventory* showAgentInventory();
  111. // Return the active inventory floater if there is one. Active is defined
  112. // as the floater that is the closest to the front and is visible.
  113. static LLFloaterInventory* getActiveFloater();
  114. // This method calls showAgentInventory() if no views are visible, or hides
  115. // and destroys them all if any are visible.
  116. static void toggleVisibility(void* dummy = NULL);
  117. // Final cleanup, destroy all open inventory floaters.
  118. static void cleanup();
  119. // LLView & LLFloater functionality
  120. void onClose(bool app_quitting) override;
  121. void setVisible(bool visible) override;
  122. void draw() override;
  123. bool handleKeyHere(KEY key, MASK mask) override;
  124. bool handleDragAndDrop(S32 x, S32 y, MASK mask, bool drop,
  125. EDragAndDropType cargo_type, void* cargo_data,
  126. EAcceptance* accept,
  127. std::string& tooltip_msg) override;
  128. LL_INLINE LLInventoryPanel* getPanel() { return mActivePanel; }
  129. LL_INLINE LLInventoryPanel* getActivePanel() { return mActivePanel; }
  130. const std::string getFilterSubString();
  131. void setFilterSubString(const std::string& string);
  132. void toggleFindOptions();
  133. void updateSortControls();
  134. LL_INLINE LLFloaterInventoryFilters* getInvFilters()
  135. {
  136. return (LLFloaterInventoryFilters*)mInvFiltersHandle.get();
  137. }
  138. protected:
  139. static void onClearSearch(void* userdata);
  140. static void onSearchEdit(const std::string& search_string, void* userdata);
  141. static void onFilterSelected(void* userdata, bool);
  142. static void onSelectionChange(LLFolderView* folderp, bool user_action,
  143. void* userdata);
  144. static void onCommitLockLastOpenCheck(LLUICtrl* ctrl, void* userdata);
  145. protected:
  146. LLSearchEditor* mSearchEditor;
  147. LLTabContainer* mFilterTabs;
  148. LLHandle<LLFloater> mInvFiltersHandle;
  149. LLInventoryPanel* mActivePanel;
  150. LLInventoryPanel* mEverythingPanel;
  151. LLInventoryPanel* mRecentPanel;
  152. LLInventoryPanel* mWornPanel;
  153. LLInventoryPanel* mLastOpenPanel;
  154. LLSaveFolderState* mSavedFolderState;
  155. LLCheckBoxCtrl* mLockLastOpenCheck;
  156. LLView* mNewSettingsMenuItem;
  157. LLView* mNewMaterialMenuItem;
  158. std::string mFilterText;
  159. private:
  160. S32 mLastCount;
  161. std::string mLastCountString;
  162. // This container is used to hold all active inventory floaters. This is
  163. // here to support the inventory toggle show button.
  164. static std::vector<LLFloaterInventory*> sActiveViews;
  165. };
  166. constexpr bool TAKE_FOCUS_YES = true;
  167. constexpr bool TAKE_FOCUS_NO = false;
  168. #endif // LL_LLFLOATERINVENTORY_H