PageRenderTime 39ms CodeModel.GetById 8ms app.highlight 26ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 27#ifndef LL_LLCOFWEARABLES_H
 28#define LL_LLCOFWEARABLES_H
 29
 30// llui
 31#include "llflatlistview.h"
 32#include "llpanel.h"
 33
 34#include "llappearancemgr.h"
 35#include "llinventorymodel.h"
 36
 37class LLAccordionCtrl;
 38class LLAccordionCtrlTab;
 39class LLListContextMenu;
 40class LLPanelClothingListItem;
 41class LLPanelBodyPartsListItem;
 42class LLPanelDeletableWearableListItem;
 43
 44class LLCOFWearables : public LLPanel
 45{
 46public:
 47
 48	/**
 49	 * Represents a collection of callbacks assigned to inventory panel item's buttons
 50	 */
 51	class LLCOFCallbacks
 52	{
 53	public:
 54		LLCOFCallbacks() {};
 55		virtual ~LLCOFCallbacks() {};
 56		
 57		typedef boost::function<void ()> cof_callback_t;
 58
 59		cof_callback_t mAddWearable;
 60		cof_callback_t mMoveWearableCloser;
 61		cof_callback_t mMoveWearableFurther;
 62		cof_callback_t mEditWearable;
 63		cof_callback_t mDeleteWearable;
 64	};
 65
 66
 67
 68	LLCOFWearables();
 69	virtual ~LLCOFWearables();
 70
 71	/*virtual*/ BOOL postBuild();
 72	
 73	LLUUID getSelectedUUID();
 74	bool getSelectedUUIDs(uuid_vec_t& selected_ids);
 75
 76	LLPanel* getSelectedItem();
 77	void getSelectedItems(std::vector<LLPanel*>& selected_items) const;
 78
 79	/* Repopulate the COF wearables list if the COF category has been changed since the last refresh */
 80	void refresh();
 81	void clear();
 82
 83	LLAssetType::EType getExpandedAccordionAssetType();
 84	LLAssetType::EType getSelectedAccordionAssetType();
 85	void expandDefaultAccordionTab();
 86
 87	LLCOFCallbacks& getCOFCallbacks() { return mCOFCallbacks; }
 88
 89	/**
 90	 * Selects first clothing item with specified LLWearableType::EType from clothing list
 91	 */
 92	void selectClothing(LLWearableType::EType clothing_type);
 93
 94	void setAttachmentsTitle();
 95
 96protected:
 97
 98	void populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items);
 99	void populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
100	
101	void addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type);
102	void onSelectionChange(LLFlatListView* selected_list);
103	void onAccordionTabStateChanged(LLUICtrl* ctrl, const LLSD& expanded);
104
105	LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last);
106	LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item);
107	LLPanelDeletableWearableListItem* buildAttachemntListItem(LLViewerInventoryItem* item);
108
109	void onListRightClick(LLUICtrl* ctrl, S32 x, S32 y, LLListContextMenu* menu);
110
111	LLFlatListView* mAttachments;
112	LLFlatListView* mClothing;
113	LLFlatListView* mBodyParts;
114
115	LLFlatListView* mLastSelectedList;
116
117	LLAccordionCtrlTab* mClothingTab;
118	LLAccordionCtrlTab* mAttachmentsTab;
119	LLAccordionCtrlTab* mBodyPartsTab;
120
121	LLAccordionCtrlTab* mLastSelectedTab;
122
123	std::map<const LLAccordionCtrlTab*, LLAssetType::EType> mTab2AssetType;
124
125	LLCOFCallbacks mCOFCallbacks;
126
127	LLListContextMenu* mClothingMenu;
128	LLListContextMenu* mAttachmentMenu;
129	LLListContextMenu* mBodyPartMenu;
130
131	LLAccordionCtrl*	mAccordionCtrl;
132
133	/* COF category version since last refresh */
134	S32 mCOFVersion;
135};
136
137
138#endif