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.h158
1 files changed, 151 insertions, 7 deletions
diff --git a/indra/newview/llwearableitemslist.h b/indra/newview/llwearableitemslist.h
index 29532a15c1..7ad1b5a3ad 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
@@ -67,12 +70,35 @@ protected:
LLPanelWearableListItem(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();
+};
+
/**
* @class LLPanelClothingListItem
*
* Provides buttons for editing, moving, deleting a wearable.
*/
-class LLPanelClothingListItem : public LLPanelWearableListItem
+class LLPanelClothingListItem : public LLPanelDeletableWearableListItem
{
LOG_CLASS(LLPanelClothingListItem);
public:
@@ -86,7 +112,6 @@ 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); }
@@ -124,6 +149,7 @@ protected:
/*virtual*/ void init();
};
+
/**
* @class LLPanelDummyClothingListItem
*
@@ -132,20 +158,112 @@ 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();
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,8 +277,32 @@ 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,
+ };
+
+ /* virtual */ LLContextMenu* createMenu();
+ void updateItemsVisibility(LLContextMenu* menu);
+ void setMenuItemVisible(LLContextMenu* menu, const std::string& name, bool val);
+ void updateMask(U32& mask, LLAssetType::EType at);
+ };
+
struct Params : public LLInitParam::Block<Params, LLInventoryItemsList::Params>
{
+ Optional<bool> use_internal_context_menu;
+
Params();
};
@@ -171,6 +313,8 @@ public:
protected:
friend class LLUICtrlFactory;
LLWearableItemsList(const LLWearableItemsList::Params& p);
+
+ void onRightClick(S32 x, S32 y);
};
#endif //LL_LLWEARABLEITEMSLIST_H