/indra/newview/llcofwearables.h

https://bitbucket.org/lindenlab/viewer-beta/ · C++ Header · 138 lines · 69 code · 35 blank · 34 comment · 0 complexity · 76cfca59243494eacefc2419a126d68f MD5 · raw file

  1. /**
  2. * @file llcofwearables.h
  3. * @brief LLCOFWearables displayes wearables from the current outfit split into three lists (attachments, clothing and body parts)
  4. *
  5. * $LicenseInfo:firstyear=2010&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_LLCOFWEARABLES_H
  27. #define LL_LLCOFWEARABLES_H
  28. // llui
  29. #include "llflatlistview.h"
  30. #include "llpanel.h"
  31. #include "llappearancemgr.h"
  32. #include "llinventorymodel.h"
  33. class LLAccordionCtrl;
  34. class LLAccordionCtrlTab;
  35. class LLListContextMenu;
  36. class LLPanelClothingListItem;
  37. class LLPanelBodyPartsListItem;
  38. class LLPanelDeletableWearableListItem;
  39. class LLCOFWearables : public LLPanel
  40. {
  41. public:
  42. /**
  43. * Represents a collection of callbacks assigned to inventory panel item's buttons
  44. */
  45. class LLCOFCallbacks
  46. {
  47. public:
  48. LLCOFCallbacks() {};
  49. virtual ~LLCOFCallbacks() {};
  50. typedef boost::function<void ()> cof_callback_t;
  51. cof_callback_t mAddWearable;
  52. cof_callback_t mMoveWearableCloser;
  53. cof_callback_t mMoveWearableFurther;
  54. cof_callback_t mEditWearable;
  55. cof_callback_t mDeleteWearable;
  56. };
  57. LLCOFWearables();
  58. virtual ~LLCOFWearables();
  59. /*virtual*/ BOOL postBuild();
  60. LLUUID getSelectedUUID();
  61. bool getSelectedUUIDs(uuid_vec_t& selected_ids);
  62. LLPanel* getSelectedItem();
  63. void getSelectedItems(std::vector<LLPanel*>& selected_items) const;
  64. /* Repopulate the COF wearables list if the COF category has been changed since the last refresh */
  65. void refresh();
  66. void clear();
  67. LLAssetType::EType getExpandedAccordionAssetType();
  68. LLAssetType::EType getSelectedAccordionAssetType();
  69. void expandDefaultAccordionTab();
  70. LLCOFCallbacks& getCOFCallbacks() { return mCOFCallbacks; }
  71. /**
  72. * Selects first clothing item with specified LLWearableType::EType from clothing list
  73. */
  74. void selectClothing(LLWearableType::EType clothing_type);
  75. void setAttachmentsTitle();
  76. protected:
  77. void populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items);
  78. void populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
  79. void addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
  80. void onSelectionChange(LLFlatListView* selected_list);
  81. void onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded);
  82. LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last);
  83. LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item);
  84. LLPanelDeletableWearableListItem* buildAttachemntListItem(LLViewerInventoryItem* item);
  85. void onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu);
  86. LLFlatListView* mAttachments;
  87. LLFlatListView* mClothing;
  88. LLFlatListView* mBodyParts;
  89. LLFlatListView* mLastSelectedList;
  90. LLAccordionCtrlTab* mClothingTab;
  91. LLAccordionCtrlTab* mAttachmentsTab;
  92. LLAccordionCtrlTab* mBodyPartsTab;
  93. LLAccordionCtrlTab* mLastSelectedTab;
  94. std::map<const LLAccordionCtrlTab*, LLAssetType::EType> mTab2AssetType;
  95. LLCOFCallbacks mCOFCallbacks;
  96. LLListContextMenu* mClothingMenu;
  97. LLListContextMenu* mAttachmentMenu;
  98. LLListContextMenu* mBodyPartMenu;
  99. LLAccordionCtrl* mAccordionCtrl;
  100. /* COF category version since last refresh */
  101. S32 mCOFVersion;
  102. };
  103. #endif