diff options
author | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2010-04-28 20:08:10 +0300 |
---|---|---|
committer | Dmitry Zaporozhan <dzaporozhan@productengine.com> | 2010-04-28 20:08:10 +0300 |
commit | e1cf84c9b670e764d39c4152df3ed8c705732735 (patch) | |
tree | bc744e1ff893264a83f733a2be81314ba37cc980 /indra/newview/llinventoryitemslist.h | |
parent | 0dc325502e5c7f44e1cf20315907275190396df3 (diff) |
Fixed EXT-6550(major) - Edit Outfit: Fix alignment of in-line edit button and put proper icon on it
Replaced LLPanelInventoryListItem with LLPanelInventoryListItem. This class is capable of showing widgets on left and right sides of panel.
Implemented LLPanelClothingListItem and LLPanelBodyPartListItem - makes use of new LLPanelInventoryListItem and is able to show buttons specified in tickets. Buttons are
shown on mouse_enter event and hidden on mouse_leave event. Buttons are - delete, move up, move down, lock, edit. It's item's user responsibility
to control buttons visibility.
Made LLInventoryItemsList::addNewItem virtual to allow inheritors create specific(non-default) items.
Reviewed by Mike Antipov - https://codereview.productengine.com/secondlife/r/325/
--HG--
branch : product-engine
Diffstat (limited to 'indra/newview/llinventoryitemslist.h')
-rw-r--r-- | indra/newview/llinventoryitemslist.h | 115 |
1 files changed, 106 insertions, 9 deletions
diff --git a/indra/newview/llinventoryitemslist.h b/indra/newview/llinventoryitemslist.h index b496f4b9e9..15f04c79a9 100644 --- a/indra/newview/llinventoryitemslist.h +++ b/indra/newview/llinventoryitemslist.h @@ -47,33 +47,130 @@ class LLIconCtrl; class LLTextBox; class LLViewerInventoryItem; -class LLPanelInventoryListItem : public LLPanel +/** + * @class LLPanelInventoryListItemBase + * + * Base class for Inventory flat list item. Panel consists of inventory icon + * and inventory item name. + * This class is able to display widgets(buttons) on left(before icon) and right(after text-box) sides + * of panel. + * + * How to use (see LLPanelClothingListItem for example): + * - implement init() to build panel from xml + * - create new xml file, fill it with widgets you want to dynamically show/hide/reshape on left/right sides + * - redefine postBuild()(call base implementation) and add needed widgets to needed sides, + * + */ +class LLPanelInventoryListItemBase : public LLPanel { public: - static LLPanelInventoryListItem* createItemPanel(const LLViewerInventoryItem* item); - virtual ~LLPanelInventoryListItem(); + static LLPanelInventoryListItemBase* create(LLViewerInventoryItem* item); + + /** + * Called after inventory item was updated, update panel widgets to reflect inventory changes. + */ + virtual void updateItem(); + + /** + * Add widget to left side + */ + void addWidgetToLeftSide(const std::string& name, bool show_widget = true); + void addWidgetToLeftSide(LLUICtrl* ctrl, bool show_widget = true); + + /** + * Add widget to right side, widget is supposed to be child of calling panel + */ + void addWidgetToRightSide(const std::string& name, bool show_widget = true); + void addWidgetToRightSide(LLUICtrl* ctrl, bool show_widget = true); + + /** + * Mark widgets as visible. Only visible widgets take part in reshaping children + */ + void setShowWidget(const std::string& name, bool show); + void setShowWidget(LLUICtrl* ctrl, bool show); + + /** + * Set spacing between widgets during reshape + */ + void setWidgetSpacing(S32 spacing) { mWidgetSpacing = spacing; } + + S32 getWidgetSpacing() { return mWidgetSpacing; } + /** + * Inheritors need to call base implementation of postBuild() + */ /*virtual*/ BOOL postBuild(); + + /** + * Handles item selection + */ /*virtual*/ void setValue(const LLSD& value); - void updateItem(); + /* Highlights item */ + /*virtual*/ void onMouseEnter(S32 x, S32 y, MASK mask); + /* Removes item highlight */ + /*virtual*/ void onMouseLeave(S32 x, S32 y, MASK mask); - void onMouseEnter(S32 x, S32 y, MASK mask); - void onMouseLeave(S32 x, S32 y, MASK mask); + virtual ~LLPanelInventoryListItemBase(){} protected: - LLPanelInventoryListItem(const LLViewerInventoryItem* item); + + LLPanelInventoryListItemBase(LLViewerInventoryItem* item); + + typedef std::vector<LLUICtrl*> widget_array_t; + + /** + * Use it from a factory function to build panel, do not build panel in constructor + */ + virtual void init(); + + void setLeftWidgetsWidth(S32 width) { mLeftWidgetsWidth = width; } + void setRightWidgetsWidth(S32 width) { mRightWidgetsWidth = width; } + + /** + * Set all widgets from both side visible/invisible. Only enabled widgets + * (see setShowWidget()) can become visible + */ + virtual void setWidgetsVisible(bool visible); + + /** + * Reshape all child widgets - icon, text-box and side widgets + */ + virtual void reshapeWidgets(); private: + + /** reshape left side widgets + * Deprecated for now. Disabled reshape left for now to reserve space for 'delete' + * button in LLPanelClothingListItem according to Neal's comment (https://codereview.productengine.com/secondlife/r/325/) + */ + void reshapeLeftWidgets(); + + /** reshape right side widgets */ + void reshapeRightWidgets(); + + /** reshape remaining widgets */ + void reshapeMiddleWidgets(); + + LLViewerInventoryItem* mItem; + LLIconCtrl* mIcon; LLTextBox* mTitle; LLUIImagePtr mItemIcon; - std::string mItemName; std::string mHighlightedText; + + widget_array_t mLeftSideWidgets; + widget_array_t mRightSideWidgets; + S32 mWidgetSpacing; + + S32 mLeftWidgetsWidth; + S32 mRightWidgetsWidth; }; +////////////////////////////////////////////////////////////////////////// + class LLInventoryItemsList : public LLFlatListView { public: @@ -117,7 +214,7 @@ protected: /** * Add an item to the list */ - void addNewItem(LLViewerInventoryItem* item); + virtual void addNewItem(LLViewerInventoryItem* item); private: uuid_vec_t mIDs; // IDs of items that were added in refreshList(). |