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