PageRenderTime 181ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llpanelmaininventory.h

https://bitbucket.org/lindenlab/viewer-beta/
C Header | 163 lines | 90 code | 28 blank | 45 comment | 0 complexity | 8e51467ac4887c3e312f6bc85afaa838 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpanelmaininventory.h
  3. * @brief llpanelmaininventory.h
  4. * class definition
  5. *
  6. * $LicenseInfo:firstyear=2001&license=viewerlgpl$
  7. * Second Life Viewer Source Code
  8. * Copyright (C) 2010, Linden Research, Inc.
  9. *
  10. * This library is free software; you can redistribute it and/or
  11. * modify it under the terms of the GNU Lesser General Public
  12. * License as published by the Free Software Foundation;
  13. * version 2.1 of the License only.
  14. *
  15. * This library is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * Lesser General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Lesser General Public
  21. * License along with this library; if not, write to the Free Software
  22. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  23. *
  24. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  25. * $/LicenseInfo$
  26. */
  27. #ifndef LL_LLPANELMAININVENTORY_H
  28. #define LL_LLPANELMAININVENTORY_H
  29. #include "llpanel.h"
  30. #include "llinventoryobserver.h"
  31. #include "lldndbutton.h"
  32. #include "llfolderview.h"
  33. class LLFolderViewItem;
  34. class LLInventoryPanel;
  35. class LLSaveFolderState;
  36. class LLFilterEditor;
  37. class LLTabContainer;
  38. class LLFloaterInventoryFinder;
  39. class LLMenuButton;
  40. class LLMenuGL;
  41. class LLToggleableMenu;
  42. class LLFloater;
  43. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  44. // Class LLPanelMainInventory
  45. //
  46. // This is a panel used to view and control an agent's inventory,
  47. // including all the fixin's (e.g. AllItems/RecentItems tabs, filter floaters).
  48. //
  49. //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  50. class LLPanelMainInventory : public LLPanel, LLInventoryObserver
  51. {
  52. public:
  53. friend class LLFloaterInventoryFinder;
  54. LLPanelMainInventory(const LLPanel::Params& p = getDefaultParams());
  55. ~LLPanelMainInventory();
  56. BOOL postBuild();
  57. virtual BOOL handleKeyHere(KEY key, MASK mask);
  58. // Inherited functionality
  59. /*virtual*/ BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
  60. EDragAndDropType cargo_type,
  61. void* cargo_data,
  62. EAcceptance* accept,
  63. std::string& tooltip_msg);
  64. /*virtual*/ void changed(U32);
  65. /*virtual*/ void draw();
  66. LLInventoryPanel* getPanel() { return mActivePanel; }
  67. LLInventoryPanel* getActivePanel() { return mActivePanel; }
  68. const LLInventoryPanel* getActivePanel() const { return mActivePanel; }
  69. const std::string& getFilterText() const { return mFilterText; }
  70. void setSelectCallback(const LLFolderView::signal_t::slot_type& cb);
  71. void onFilterEdit(const std::string& search_string );
  72. protected:
  73. //
  74. // Misc functions
  75. //
  76. void setFilterTextFromFilter();
  77. void startSearch();
  78. void toggleFindOptions();
  79. void onSelectionChange(LLInventoryPanel *panel, const std::deque<LLFolderViewItem*>& items, BOOL user_action);
  80. static BOOL filtersVisible(void* user_data);
  81. void onClearSearch();
  82. static void onFoldersByName(void *user_data);
  83. static BOOL checkFoldersByName(void *user_data);
  84. static BOOL incrementalFind(LLFolderViewItem* first_item, const char *find_text, BOOL backward);
  85. void onFilterSelected();
  86. const std::string getFilterSubString();
  87. void setFilterSubString(const std::string& string);
  88. // menu callbacks
  89. void doToSelected(const LLSD& userdata);
  90. void closeAllFolders();
  91. void newWindow();
  92. void doCreate(const LLSD& userdata);
  93. void resetFilters();
  94. void setSortBy(const LLSD& userdata);
  95. void saveTexture(const LLSD& userdata);
  96. bool isSaveTextureEnabled(const LLSD& userdata);
  97. void updateItemcountText();
  98. void onFocusReceived();
  99. private:
  100. LLFloaterInventoryFinder* getFinder();
  101. LLFilterEditor* mFilterEditor;
  102. LLTabContainer* mFilterTabs;
  103. LLHandle<LLFloater> mFinderHandle;
  104. LLInventoryPanel* mActivePanel;
  105. bool mResortActivePanel;
  106. LLSaveFolderState* mSavedFolderState;
  107. std::string mFilterText;
  108. std::string mFilterSubString;
  109. //////////////////////////////////////////////////////////////////////////////////
  110. // List Commands //
  111. protected:
  112. void initListCommandsHandlers();
  113. void updateListCommands();
  114. void onAddButtonClick();
  115. void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
  116. void onTrashButtonClick();
  117. void onClipboardAction(const LLSD& userdata);
  118. BOOL isActionEnabled(const LLSD& command_name);
  119. BOOL isActionChecked(const LLSD& userdata);
  120. void onCustomAction(const LLSD& command_name);
  121. bool handleDragAndDropToTrash(BOOL drop, EDragAndDropType cargo_type, EAcceptance* accept);
  122. /**
  123. * Set upload cost in "Upload" sub menu.
  124. */
  125. void setUploadCostIfNeeded();
  126. private:
  127. LLDragAndDropButton* mTrashButton;
  128. LLToggleableMenu* mMenuGearDefault;
  129. LLMenuGL* mMenuAdd;
  130. LLMenuButton* mGearMenuButton;
  131. bool mNeedUploadCost;
  132. // List Commands //
  133. ////////////////////////////////////////////////////////////////////////////////
  134. };
  135. #endif // LL_LLPANELMAININVENTORY_H