From 702efd72ab9e3a2c619b5313b481e0821d453070 Mon Sep 17 00:00:00 2001 From: Igor Borovkov Date: Fri, 30 Apr 2010 15:59:23 +0300 Subject: additional patch for EXT-6732 Create specialized view of inventory for "clothing" accordion tab of outfit editor * reimplemented button bars as static panels not as list items (creating accordion - button bar - list view - adaptor/container) * added management of items' buttons assording to inventory items' states * assigned actions to clothing/bodyparts items' buttons * got rid of separators as distinct items and made them as part of items * removed ad-hoc up/down buttons * removed "+" button from a button bar Reviewed by Mike Antipov at https://codereview.productengine.com/secondlife/r/322 --HG-- branch : product-engine --- indra/newview/llcofwearables.h | 77 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 74 insertions(+), 3 deletions(-) (limited to 'indra/newview/llcofwearables.h') diff --git a/indra/newview/llcofwearables.h b/indra/newview/llcofwearables.h index fec6d34db2..c256d2a05d 100644 --- a/indra/newview/llcofwearables.h +++ b/indra/newview/llcofwearables.h @@ -36,12 +36,80 @@ #include "llpanel.h" #include "llinventorymodel.h" #include "llappearancemgr.h" +#include "llwearableitemslist.h" class LLFlatListView; +/** + * Adaptor between LLAccordionCtrlTab and LLFlatListView to facilitate communication between them + * (notify, notifyParent) regarding size changes of a list and selection changes across accordion tabs. + * Besides that it acts as a container for the LLFlatListView and a button bar on top of it. + */ +class LLCOFAccordionListAdaptor : public LLPanel +{ +public: + LLCOFAccordionListAdaptor() : LLPanel() {}; + ~LLCOFAccordionListAdaptor() {}; + + S32 notifyParent(const LLSD& info) + { + LLView* parent = getParent(); + if (!parent) return -1; + + if (!info.has("action") || "size_changes" != info["action"]) + { + return parent->notifyParent(info); + } + + LLRect rc; + childGetRect("button_bar", rc); + + LLSD params; + params["action"] = "size_changes"; + params["width"] = info["width"]; + params["height"] = info["height"].asInteger() + rc.getHeight(); + + return parent->notifyParent(params); + } + + + S32 notify(const LLSD& info) + { + for (child_list_const_iter_t iter = beginChild(); iter != endChild(); iter++) + { + if (dynamic_cast(*iter)) + { + return (*iter)->notify(info); + } + } + return LLPanel::notify(info); + }; +}; + + class LLCOFWearables : public LLPanel { public: + + /** + * Represents a collection of callbacks assigned to inventory panel item's buttons + */ + class LLCOFCallbacks + { + public: + LLCOFCallbacks() {}; + virtual ~LLCOFCallbacks() {}; + + typedef boost::function cof_callback_t; + + cof_callback_t mMoveWearableCloser; + cof_callback_t mMoveWearableFurther; + cof_callback_t mEditWearable; + cof_callback_t mDeleteWearable; + }; + + + LLCOFWearables(); virtual ~LLCOFWearables() {}; @@ -52,17 +120,18 @@ public: void refresh(); void clear(); + LLCOFCallbacks& getCOFCallbacks() { return mCOFCallbacks; } + protected: void populateAttachmentsAndBodypartsLists(const LLInventoryModel::item_array_t& cof_items); void populateClothingList(LLAppearanceMgr::wearables_by_type_t& clothing_by_type); - void addListButtonBar(LLFlatListView* list, std::string xml_filename); void addClothingTypesDummies(const LLAppearanceMgr::wearables_by_type_t& clothing_by_type); - void addWearableTypeSeparator(LLFlatListView* list); void onSelectionChange(LLFlatListView* selected_list); - LLXMLNodePtr getXMLNode(std::string xml_filename); + LLPanelClothingListItem* buildClothingListItem(LLViewerInventoryItem* item, bool first, bool last); + LLPanelBodyPartsListItem* buildBodypartListItem(LLViewerInventoryItem* item); LLFlatListView* mAttachments; LLFlatListView* mClothing; @@ -70,6 +139,8 @@ protected: LLFlatListView* mLastSelectedList; + LLCOFCallbacks mCOFCallbacks; + }; -- cgit v1.2.3