summaryrefslogtreecommitdiff
path: root/indra/newview/llwearableitemslist.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llwearableitemslist.h')
-rw-r--r--indra/newview/llwearableitemslist.h207
1 files changed, 198 insertions, 9 deletions
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index 29532a15c1..f03336186c 100644
--- a/indra/newview/llwearableitemslist.h
+++ b/indra/newview/llwearableitemslist.h
@@ -32,12 +32,15 @@
#ifndef LL_LLWEARABLEITEMSLIST_H
#define LL_LLWEARABLEITEMSLIST_H
+// libs
#include "llpanel.h"
+#include "llsingleton.h"
// newview
#include "llinventoryitemslist.h"
#include "llinventorymodel.h"
-#include "llwearabledictionary.h"
+#include "lllistcontextmenu.h"
+#include "llwearabletype.h"
/**
* @class LLPanelWearableListItem
@@ -68,11 +71,72 @@ protected:
};
/**
+ * @class LLPanelWearableOutfitItem
+ *
+ * Outfit item for "My Outfits" list.
+ * Extends LLPanelInventoryListItemBase with handling
+ * double click to wear the item.
+ */
+class LLPanelWearableOutfitItem : public LLPanelInventoryListItemBase
+{
+ LOG_CLASS(LLPanelWearableOutfitItem);
+public:
+ static LLPanelWearableOutfitItem* create(LLViewerInventoryItem* item);
+
+ /**
+ * Puts item on if it is not worn by agent
+ * otherwise takes it off on double click.
+ */
+ /*virtual*/ BOOL handleDoubleClick(S32 x, S32 y, MASK mask);
+
+protected:
+
+ LLPanelWearableOutfitItem(LLViewerInventoryItem* item);
+};
+
+class LLPanelDeletableWearableListItem : public LLPanelWearableListItem
+{
+ LOG_CLASS(LLPanelDeletableWearableListItem);
+public:
+
+ static LLPanelDeletableWearableListItem* create(LLViewerInventoryItem* item);
+
+ virtual ~LLPanelDeletableWearableListItem() {};
+
+ /*virtual*/ BOOL postBuild();
+
+ /**
+ * Make button visible during mouse over event.
+ */
+ inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); }
+
+protected:
+ LLPanelDeletableWearableListItem(LLViewerInventoryItem* item);
+
+ /*virtual*/ void init();
+};
+
+/** Outfit list item for an attachment */
+class LLPanelAttachmentListItem : public LLPanelDeletableWearableListItem
+{
+ LOG_CLASS(LLPanelAttachmentListItem);
+public:
+ static LLPanelAttachmentListItem* create(LLViewerInventoryItem* item);
+ virtual ~LLPanelAttachmentListItem() {};
+
+ /** Set item title. Joint name is added to the title in parenthesis */
+ /*virtual*/ void setTitle(const std::string& title, const std::string& highlit_text);
+
+protected:
+ LLPanelAttachmentListItem(LLViewerInventoryItem* item) : LLPanelDeletableWearableListItem(item) {};
+};
+
+/**
* @class LLPanelClothingListItem
*
* Provides buttons for editing, moving, deleting a wearable.
*/
-class LLPanelClothingListItem : public LLPanelWearableListItem
+class LLPanelClothingListItem : public LLPanelDeletableWearableListItem
{
LOG_CLASS(LLPanelClothingListItem);
public:
@@ -86,12 +150,11 @@ public:
/**
* Make button visible during mouse over event.
*/
- inline void setShowDeleteButton(bool show) { setShowWidget("btn_delete", show); }
inline void setShowMoveUpButton(bool show) { setShowWidget("btn_move_up", show); }
inline void setShowMoveDownButton(bool show) { setShowWidget("btn_move_down", show); }
inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); }
- inline void setShowEditButton(bool show) { setShowWidget("btn_edit", show); }
+ inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); }
protected:
@@ -116,7 +179,7 @@ public:
* Make button visible during mouse over event.
*/
inline void setShowLockButton(bool show) { setShowWidget("btn_lock", show); }
- inline void setShowEditButton(bool show) { setShowWidget("btn_edit", show); }
+ inline void setShowEditButton(bool show) { setShowWidget("btn_edit_panel", show); }
protected:
LLPanelBodyPartsListItem(LLViewerInventoryItem* item);
@@ -124,6 +187,7 @@ protected:
/*virtual*/ void init();
};
+
/**
* @class LLPanelDummyClothingListItem
*
@@ -132,20 +196,113 @@ protected:
class LLPanelDummyClothingListItem : public LLPanelWearableListItem
{
public:
- static LLPanelDummyClothingListItem* create(EWearableType w_type);
+ static LLPanelDummyClothingListItem* create(LLWearableType::EType w_type);
/*virtual*/ void updateItem();
/*virtual*/ BOOL postBuild();
+ LLWearableType::EType getWearableType() const;
protected:
- LLPanelDummyClothingListItem(EWearableType w_type);
+ LLPanelDummyClothingListItem(LLWearableType::EType w_type);
/*virtual*/ void init();
- static std::string wearableTypeToString(EWearableType w_type);
+ static std::string wearableTypeToString(LLWearableType::EType w_type);
+
+private:
+ LLWearableType::EType mWearableType;
+};
+
+/**
+ * @class LLWearableListItemComparator
+ *
+ * Abstract comparator of wearable list items.
+ */
+class LLWearableListItemComparator : public LLFlatListView::ItemComparator
+{
+ LOG_CLASS(LLWearableListItemComparator);
+
+public:
+ LLWearableListItemComparator() {};
+ virtual ~LLWearableListItemComparator() {};
+
+ virtual bool compare(const LLPanel* item1, const LLPanel* item2) const
+ {
+ const LLPanelInventoryListItemBase* wearable_item1 = dynamic_cast<const LLPanelInventoryListItemBase*>(item1);
+ const LLPanelInventoryListItemBase* wearable_item2 = dynamic_cast<const LLPanelInventoryListItemBase*>(item2);
+
+ if (!wearable_item1 || !wearable_item2)
+ {
+ llwarning("item1 and item2 cannot be null", 0);
+ return true;
+ }
+
+ return doCompare(wearable_item1, wearable_item2);
+ }
+
+protected:
+
+ /**
+ * Returns true if wearable_item1 < wearable_item2, false otherwise
+ * Implement this method in your particular comparator.
+ */
+ virtual bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const = 0;
+};
+
+/**
+ * @class LLWearableItemNameComparator
+ *
+ * Comparator for sorting wearable list items by name.
+ */
+class LLWearableItemNameComparator : public LLWearableListItemComparator
+{
+ LOG_CLASS(LLWearableItemNameComparator);
+
+public:
+ LLWearableItemNameComparator() {};
+ virtual ~LLWearableItemNameComparator() {};
+
+protected:
+ /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const;
+};
+
+/**
+ * @class LLWearableItemTypeNameComparator
+ *
+ * Comparator for sorting wearable list items by type and name.
+ */
+class LLWearableItemTypeNameComparator : public LLWearableItemNameComparator
+{
+ LOG_CLASS(LLWearableItemTypeNameComparator);
+
+public:
+ LLWearableItemTypeNameComparator() {};
+ virtual ~LLWearableItemTypeNameComparator() {};
+
+protected:
+ /**
+ * Returns "true" if wearable_item1 is placed before wearable_item2 sorted by the following:
+ * - Attachments (abc order)
+ * - Clothing
+ * - by type (types order determined in LLWearableType::EType)
+ * - outer layer on top
+ * - Body Parts (abc order),
+ * "false" otherwise.
+ */
+ /*virtual*/ bool doCompare(const LLPanelInventoryListItemBase* wearable_item1, const LLPanelInventoryListItemBase* wearable_item2) const;
private:
- EWearableType mWearableType;
+ enum ETypeListOrder
+ {
+ TLO_ATTACHMENT = 0x01,
+ TLO_CLOTHING = 0x02,
+ TLO_BODYPART = 0x04,
+ TLO_UNKNOWN = 0x08,
+
+ TLO_NOT_CLOTHING = TLO_ATTACHMENT | TLO_BODYPART | TLO_UNKNOWN
+ };
+
+ static LLWearableItemTypeNameComparator::ETypeListOrder getTypeListOrder(LLAssetType::EType item_type);
};
/**
@@ -159,18 +316,50 @@ private:
class LLWearableItemsList : public LLInventoryItemsList
{
public:
+ /**
+ * Context menu.
+ *
+ * This menu is likely to be used from outside
+ * (e.g. for items selected across multiple wearable lists),
+ * so making it a singleton.
+ */
+ class ContextMenu : public LLListContextMenu, public LLSingleton<ContextMenu>
+ {
+ protected:
+ enum {
+ MASK_CLOTHING = 0x01,
+ MASK_BODYPART = 0x02,
+ MASK_ATTACHMENT = 0x04,
+ MASK_UNKNOWN = 0x08,
+ };
+
+ /* virtual */ LLContextMenu* createMenu();
+ void updateItemsVisibility(LLContextMenu* menu);
+ void updateItemsLabels(LLContextMenu* menu);
+ static void setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val);
+ static void setMenuItemEnabled(LLContextMenu* menu, const std::string& name, bool val);
+ static void updateMask(U32& mask, LLAssetType::EType at);
+ static void createNewWearable(const LLUUID& item_id);
+ };
+
struct Params : public LLInitParam::Block<Params, LLInventoryItemsList::Params>
{
+ Optional<bool> use_internal_context_menu;
+
Params();
};
virtual ~LLWearableItemsList();
+ /*virtual*/ void addNewItem(LLViewerInventoryItem* item, bool rearrange = true);
+
void updateList(const LLUUID& category_id);
protected:
friend class LLUICtrlFactory;
LLWearableItemsList(const LLWearableItemsList::Params& p);
+
+ void onRightClick(S32 x, S32 y);
};
#endif //LL_LLWEARABLEITEMSLIST_H