PageRenderTime 32ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llpaneloutfitedit.h

https://bitbucket.org/lindenlab/viewer-beta/
C++ Header | 246 lines | 159 code | 41 blank | 46 comment | 0 complexity | d4e7ac42933e1b5c5f24e0988a9884cf MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llpaneloutfitedit.h
  3. * @brief Displays outfit edit information in Side Tray.
  4. *
  5. * $LicenseInfo:firstyear=2009&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_LLPANELOUTFITEDIT_H
  27. #define LL_LLPANELOUTFITEDIT_H
  28. #include "llpanel.h"
  29. #include "v3dmath.h"
  30. #include "lluuid.h"
  31. #include "lliconctrl.h"
  32. #include "llremoteparcelrequest.h"
  33. #include "llinventory.h"
  34. #include "llinventoryfunctions.h"
  35. #include "llinventorymodel.h"
  36. #include "llwearableitemslist.h"
  37. class LLButton;
  38. class LLCOFWearables;
  39. class LLComboBox;
  40. class LLTextBox;
  41. class LLInventoryCategory;
  42. class LLOutfitObserver;
  43. class LLCOFDragAndDropObserver;
  44. class LLInventoryPanel;
  45. class LLSaveFolderState;
  46. class LLFolderViewItem;
  47. class LLScrollListCtrl;
  48. class LLToggleableMenu;
  49. class LLFilterEditor;
  50. class LLFilteredWearableListManager;
  51. class LLMenuButton;
  52. class LLMenuGL;
  53. class LLFindNonLinksByMask;
  54. class LLFindWearablesOfType;
  55. class LLSaveOutfitComboBtn;
  56. class LLWearableItemTypeNameComparator;
  57. class LLPanelOutfitEdit : public LLPanel
  58. {
  59. LOG_CLASS(LLPanelOutfitEdit);
  60. public:
  61. // NOTE: initialize mFolderViewItemTypes at the index of any new enum you add in the LLPanelOutfitEdit() constructor
  62. typedef enum e_folder_view_item_type
  63. {
  64. FVIT_ALL = 0,
  65. FVIT_WEARABLE, // clothing or shape
  66. FVIT_ATTACHMENT,
  67. NUM_FOLDER_VIEW_ITEM_TYPES
  68. } EFolderViewItemType;
  69. //should reflect order from LLWearableType::EType
  70. typedef enum e_list_view_item_type
  71. {
  72. LVIT_ALL = 0,
  73. LVIT_CLOTHING,
  74. LVIT_BODYPART,
  75. LVIT_ATTACHMENT,
  76. LVIT_SHAPE,
  77. LVIT_SKIN,
  78. LVIT_HAIR,
  79. LVIT_EYES,
  80. LVIT_SHIRT,
  81. LVIT_PANTS,
  82. LVIT_SHOES,
  83. LVIT_SOCKS,
  84. LVIT_JACKET,
  85. LVIT_GLOVES,
  86. LVIT_UNDERSHIRT,
  87. LVIT_UNDERPANTS,
  88. LVIT_SKIRT,
  89. LVIT_ALPHA,
  90. LVIT_TATTOO,
  91. LVIT_PHYSICS,
  92. NUM_LIST_VIEW_ITEM_TYPES
  93. } EListViewItemType;
  94. struct LLLookItemType {
  95. std::string displayName;
  96. U64 inventoryMask;
  97. LLLookItemType() : displayName("NONE"), inventoryMask(0) {}
  98. LLLookItemType(std::string name, U64 mask) : displayName(name), inventoryMask(mask) {}
  99. };
  100. struct LLFilterItem {
  101. std::string displayName;
  102. LLInventoryCollectFunctor* collector;
  103. LLFilterItem() : displayName("NONE"), collector(NULL) {}
  104. LLFilterItem(std::string name, LLInventoryCollectFunctor* _collector) : displayName(name), collector(_collector) {}
  105. ~LLFilterItem() { delete collector; }
  106. //the struct is not supposed to by copied, either way the destructor kills collector
  107. //LLPointer is not used as it requires LLInventoryCollectFunctor to extend LLRefCount what it doesn't do
  108. private:
  109. LLFilterItem(const LLFilterItem& filter_item) {};
  110. };
  111. LLPanelOutfitEdit();
  112. /*virtual*/ ~LLPanelOutfitEdit();
  113. /*virtual*/ BOOL postBuild();
  114. /*virtual*/ void onOpen(const LLSD& key);
  115. void moveWearable(bool closer_to_body);
  116. void toggleAddWearablesPanel();
  117. void showAddWearablesPanel(bool show__add_wearables);
  118. //following methods operate with "add wearables" panel
  119. void showWearablesFilter();
  120. void showWearablesListView();
  121. void showWearablesFolderView();
  122. void updateFiltersVisibility();
  123. void onFolderViewFilterCommitted(LLUICtrl* ctrl);
  124. void onListViewFilterCommitted(LLUICtrl* ctrl);
  125. void onSearchEdit(const std::string& string);
  126. void updatePlusButton();
  127. void onPlusBtnClicked(void);
  128. void onVisibilityChange(const LLSD &in_visible_chain);
  129. void applyFolderViewFilter(EFolderViewItemType type);
  130. void applyListViewFilter(EListViewItemType type);
  131. /**
  132. * Filter items in views of Add Wearables Panel and show appropriate view depending on currently selected COF item(s)
  133. * No COF items selected - shows the folder view, reset filter
  134. * 1 COF item selected - shows the list view and filters wearables there by a wearable type of the selected item
  135. * More than 1 COF item selected - shows the list view and filters it by a type of the selected item (attachment or clothing)
  136. */
  137. void filterWearablesBySelectedItem(void);
  138. void onRemoveFromOutfitClicked(void);
  139. void onEditWearableClicked(void);
  140. void onAddWearableClicked(void);
  141. void onReplaceMenuItemClicked(LLUUID selected_item_id);
  142. void onShopButtonClicked();
  143. void displayCurrentOutfit();
  144. void updateCurrentOutfitName();
  145. void update();
  146. void updateVerbs();
  147. /**
  148. * @brief Helper function. Shows one panel instead of another.
  149. * If panels already switched does nothing and returns false.
  150. * @param switch_from_panel panel to hide
  151. * @param switch_to_panel panel to show
  152. * @retun returns true if switching happened, false if not.
  153. */
  154. bool switchPanels(LLPanel* switch_from_panel, LLPanel* switch_to_panel);
  155. void resetAccordionState();
  156. virtual BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
  157. EDragAndDropType cargo_type,
  158. void* cargo_data,
  159. EAcceptance* accept,
  160. std::string& tooltip_msg);
  161. private:
  162. void onAddMoreButtonClicked();
  163. void showFilteredWearablesListView(LLWearableType::EType type);
  164. void onOutfitChanging(bool started);
  165. void getSelectedItemsUUID(uuid_vec_t& uuid_list);
  166. void getCurrentItemUUID(LLUUID& selected_id);
  167. void onCOFChanged();
  168. /**
  169. * Method preserves selection while switching between folder/list view modes
  170. */
  171. void saveListSelection();
  172. void updateWearablesPanelVerbButtons();
  173. typedef std::pair<LLWearableType::EType, size_t> selection_info_t;
  174. LLWearableType::EType getCOFWearablesSelectionType() const;
  175. selection_info_t getAddMorePanelSelectionType() const;
  176. LLWearableType::EType getWearableTypeByItemUUID(const LLUUID& item_uuid) const;
  177. LLTextBox* mCurrentOutfitName;
  178. LLTextBox* mStatus;
  179. LLInventoryPanel* mInventoryItemsPanel;
  180. LLFilterEditor* mSearchFilter;
  181. LLSaveFolderState* mSavedFolderState;
  182. std::string mSearchString;
  183. LLButton* mEditWearableBtn;
  184. LLButton* mFolderViewBtn;
  185. LLButton* mListViewBtn;
  186. LLButton* mPlusBtn;
  187. LLPanel* mAddWearablesPanel;
  188. LLComboBox* mFolderViewFilterCmbBox;
  189. LLComboBox* mListViewFilterCmbBox;
  190. LLFilteredWearableListManager* mWearableListManager;
  191. LLWearableItemsList* mWearableItemsList;
  192. LLPanel* mWearablesListViewPanel;
  193. LLWearableItemTypeNameComparator* mWearableListViewItemsComparator;
  194. LLCOFDragAndDropObserver* mCOFDragAndDropObserver;
  195. std::vector<LLLookItemType> mFolderViewItemTypes;
  196. std::vector<LLFilterItem*> mListViewItemTypes;
  197. LLCOFWearables* mCOFWearables;
  198. LLToggleableMenu* mGearMenu;
  199. LLToggleableMenu* mAddWearablesGearMenu;
  200. bool mInitialized;
  201. std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
  202. LLMenuButton* mWearablesGearMenuBtn;
  203. LLMenuButton* mGearMenuBtn;
  204. };
  205. #endif // LL_LLPANELOUTFITEDIT_H