diff options
Diffstat (limited to 'indra/newview/llwearableitemslist.cpp')
-rw-r--r-- | indra/newview/llwearableitemslist.cpp | 186 |
1 files changed, 143 insertions, 43 deletions
diff --git a/indra/newview/llwearableitemslist.cpp b/indra/newview/llwearableitemslist.cpp index 3887f64618..60ebb9416e 100644 --- a/indra/newview/llwearableitemslist.cpp +++ b/indra/newview/llwearableitemslist.cpp @@ -85,8 +85,8 @@ void LLPanelWearableListItem::onMouseLeave(S32 x, S32 y, MASK mask) reshapeWidgets(); } -LLPanelWearableListItem::LLPanelWearableListItem(LLViewerInventoryItem* item) -: LLPanelInventoryListItemBase(item) +LLPanelWearableListItem::LLPanelWearableListItem(LLViewerInventoryItem* item, const LLPanelWearableListItem::Params& params) +: LLPanelInventoryListItemBase(item, params) { } @@ -101,15 +101,19 @@ LLPanelWearableOutfitItem* LLPanelWearableOutfitItem::create(LLViewerInventoryIt LLPanelWearableOutfitItem* list_item = NULL; if (item) { - list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled); - list_item->init(); + const LLPanelInventoryListItemBase::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelInventoryListItemBase>(); + + list_item = new LLPanelWearableOutfitItem(item, worn_indication_enabled, params); + list_item->initFromParams(params); + list_item->postBuild(); } return list_item; } LLPanelWearableOutfitItem::LLPanelWearableOutfitItem(LLViewerInventoryItem* item, - bool worn_indication_enabled) -: LLPanelInventoryListItemBase(item) + bool worn_indication_enabled, + const LLPanelWearableOutfitItem::Params& params) +: LLPanelInventoryListItemBase(item, params) , mWornIndicationEnabled(worn_indication_enabled) { } @@ -132,6 +136,17 @@ void LLPanelWearableOutfitItem::updateItem(const std::string& name, ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelClothingListItem(&typeid(LLPanelClothingListItem::Params), "clothing_list_item"); + + +LLPanelClothingListItem::Params::Params() +: up_btn("up_btn"), + down_btn("down_btn"), + edit_btn("edit_btn"), + lock_panel("lock_panel"), + edit_panel("edit_panel"), + lock_icon("lock_icon") +{} // static LLPanelClothingListItem* LLPanelClothingListItem::create(LLViewerInventoryItem* item) @@ -139,24 +154,54 @@ LLPanelClothingListItem* LLPanelClothingListItem::create(LLViewerInventoryItem* LLPanelClothingListItem* list_item = NULL; if(item) { - list_item = new LLPanelClothingListItem(item); - list_item->init(); + const LLPanelClothingListItem::Params& params = LLUICtrlFactory::getDefaultParams<LLPanelClothingListItem>(); + list_item = new LLPanelClothingListItem(item, params); + list_item->initFromParams(params); + list_item->postBuild(); } return list_item; } -LLPanelClothingListItem::LLPanelClothingListItem(LLViewerInventoryItem* item) - : LLPanelDeletableWearableListItem(item) +LLPanelClothingListItem::LLPanelClothingListItem(LLViewerInventoryItem* item, const LLPanelClothingListItem::Params& params) + : LLPanelDeletableWearableListItem(item, params) +{ + LLButton::Params button_params = params.up_btn; + applyXUILayout(button_params, this); + addChild(LLUICtrlFactory::create<LLButton>(button_params)); + + button_params = params.down_btn; + applyXUILayout(button_params, this); + addChild(LLUICtrlFactory::create<LLButton>(button_params)); + + LLPanel::Params panel_params = params.lock_panel; + applyXUILayout(panel_params, this); + LLPanel* lock_panelp = LLUICtrlFactory::create<LLPanel>(panel_params); + addChild(lock_panelp); + + panel_params = params.edit_panel; + applyXUILayout(panel_params, this); + LLPanel* edit_panelp = LLUICtrlFactory::create<LLPanel>(panel_params); + addChild(edit_panelp); + + if (lock_panelp) { + LLIconCtrl::Params icon_params = params.lock_icon; + applyXUILayout(icon_params, this); + lock_panelp->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_params)); } -LLPanelClothingListItem::~LLPanelClothingListItem() + if (edit_panelp) { + button_params = params.edit_btn; + applyXUILayout(button_params, this); + edit_panelp->addChild(LLUICtrlFactory::create<LLButton>(button_params)); + } + + setSeparatorVisible(false); } -void LLPanelClothingListItem::init() +LLPanelClothingListItem::~LLPanelClothingListItem() { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_clothing_list_item.xml"); } BOOL LLPanelClothingListItem::postBuild() @@ -178,30 +223,62 @@ BOOL LLPanelClothingListItem::postBuild() ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelBodyPartsListItem(&typeid(LLPanelBodyPartsListItem::Params), "bodyparts_list_item"); + + +LLPanelBodyPartsListItem::Params::Params() +: edit_btn("edit_btn"), + edit_panel("edit_panel"), + lock_panel("lock_panel"), + lock_icon("lock_icon") +{} + // static LLPanelBodyPartsListItem* LLPanelBodyPartsListItem::create(LLViewerInventoryItem* item) { LLPanelBodyPartsListItem* list_item = NULL; if(item) { - list_item = new LLPanelBodyPartsListItem(item); - list_item->init(); + const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelBodyPartsListItem>(); + list_item = new LLPanelBodyPartsListItem(item, params); + list_item->initFromParams(params); + list_item->postBuild(); } return list_item; } -LLPanelBodyPartsListItem::LLPanelBodyPartsListItem(LLViewerInventoryItem* item) -: LLPanelWearableListItem(item) +LLPanelBodyPartsListItem::LLPanelBodyPartsListItem(LLViewerInventoryItem* item, const LLPanelBodyPartsListItem::Params& params) +: LLPanelWearableListItem(item, params) { + LLPanel::Params panel_params = params.edit_panel; + applyXUILayout(panel_params, this); + LLPanel* edit_panelp = LLUICtrlFactory::create<LLPanel>(panel_params); + addChild(edit_panelp); + + panel_params = params.lock_panel; + applyXUILayout(panel_params, this); + LLPanel* lock_panelp = LLUICtrlFactory::create<LLPanel>(panel_params); + addChild(lock_panelp); + + if (edit_panelp) + { + LLButton::Params btn_params = params.edit_btn; + applyXUILayout(btn_params, this); + edit_panelp->addChild(LLUICtrlFactory::create<LLButton>(btn_params)); } -LLPanelBodyPartsListItem::~LLPanelBodyPartsListItem() + if (lock_panelp) { + LLIconCtrl::Params icon_params = params.lock_icon; + applyXUILayout(icon_params, this); + lock_panelp->addChild(LLUICtrlFactory::create<LLIconCtrl>(icon_params)); + } + + setSeparatorVisible(true); } -void LLPanelBodyPartsListItem::init() +LLPanelBodyPartsListItem::~LLPanelBodyPartsListItem() { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_body_parts_list_item.xml"); } BOOL LLPanelBodyPartsListItem::postBuild() @@ -214,6 +291,11 @@ BOOL LLPanelBodyPartsListItem::postBuild() return TRUE; } +static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelDeletableWearableListItem(&typeid(LLPanelDeletableWearableListItem::Params), "deletable_wearable_list_item"); + +LLPanelDeletableWearableListItem::Params::Params() +: delete_btn("delete_btn") +{} // static LLPanelDeletableWearableListItem* LLPanelDeletableWearableListItem::create(LLViewerInventoryItem* item) @@ -221,20 +303,22 @@ LLPanelDeletableWearableListItem* LLPanelDeletableWearableListItem::create(LLVie LLPanelDeletableWearableListItem* list_item = NULL; if(item) { - list_item = new LLPanelDeletableWearableListItem(item); - list_item->init(); + const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDeletableWearableListItem>(); + list_item = new LLPanelDeletableWearableListItem(item, params); + list_item->initFromParams(params); + list_item->postBuild(); } return list_item; } -LLPanelDeletableWearableListItem::LLPanelDeletableWearableListItem(LLViewerInventoryItem* item) -: LLPanelWearableListItem(item) +LLPanelDeletableWearableListItem::LLPanelDeletableWearableListItem(LLViewerInventoryItem* item, const LLPanelDeletableWearableListItem::Params& params) +: LLPanelWearableListItem(item, params) { -} + LLButton::Params button_params = params.delete_btn; + applyXUILayout(button_params, this); + addChild(LLUICtrlFactory::create<LLButton>(button_params)); -void LLPanelDeletableWearableListItem::init() -{ - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_deletable_wearable_list_item.xml"); + setSeparatorVisible(true); } BOOL LLPanelDeletableWearableListItem::postBuild() @@ -260,8 +344,11 @@ LLPanelAttachmentListItem* LLPanelAttachmentListItem::create(LLViewerInventoryIt LLPanelAttachmentListItem* list_item = NULL; if(item) { - list_item = new LLPanelAttachmentListItem(item); - list_item->init(); + const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDeletableWearableListItem>(); + + list_item = new LLPanelAttachmentListItem(item, params); + list_item->initFromParams(params); + list_item->postBuild(); } return list_item; } @@ -284,27 +371,32 @@ void LLPanelAttachmentListItem::updateItem(const std::string& name, ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// +static LLWidgetNameRegistry::StaticRegistrar sRegisterPanelDummyClothingListItem(&typeid(LLPanelDummyClothingListItem::Params), "dummy_clothing_list_item"); + +LLPanelDummyClothingListItem::Params::Params() +: add_panel("add_panel"), + add_btn("add_btn") +{} LLPanelDummyClothingListItem* LLPanelDummyClothingListItem::create(LLWearableType::EType w_type) { - LLPanelDummyClothingListItem* list_item = new LLPanelDummyClothingListItem(w_type); - list_item->init(); + const Params& params = LLUICtrlFactory::getDefaultParams<LLPanelDummyClothingListItem>(); + + LLPanelDummyClothingListItem* list_item = new LLPanelDummyClothingListItem(w_type, params); + list_item->initFromParams(params); + list_item->postBuild(); return list_item; } BOOL LLPanelDummyClothingListItem::postBuild() { - LLIconCtrl* icon = getChild<LLIconCtrl>("item_icon"); - setIconCtrl(icon); - setTitleCtrl(getChild<LLTextBox>("item_name")); - addWidgetToRightSide("btn_add_panel"); setIconImage(LLInventoryIcon::getIcon(LLAssetType::AT_CLOTHING, LLInventoryType::IT_NONE, mWearableType, FALSE)); updateItem(wearableTypeToString(mWearableType)); // Make it look loke clothing item - reserve space for 'delete' button - setLeftWidgetsWidth(icon->getRect().mLeft); + setLeftWidgetsWidth(getChildView("item_icon")->getRect().mLeft); setWidgetsVisible(false); reshapeWidgets(); @@ -317,15 +409,23 @@ LLWearableType::EType LLPanelDummyClothingListItem::getWearableType() const return mWearableType; } -LLPanelDummyClothingListItem::LLPanelDummyClothingListItem(LLWearableType::EType w_type) - : LLPanelWearableListItem(NULL) - , mWearableType(w_type) +LLPanelDummyClothingListItem::LLPanelDummyClothingListItem(LLWearableType::EType w_type, const LLPanelDummyClothingListItem::Params& params) +: LLPanelWearableListItem(NULL, params), + mWearableType(w_type) { -} + LLPanel::Params panel_params(params.add_panel); + applyXUILayout(panel_params, this); + LLPanel* add_panelp = LLUICtrlFactory::create<LLPanel>(panel_params); + addChild(add_panelp); -void LLPanelDummyClothingListItem::init() + if (add_panelp) { - LLUICtrlFactory::getInstance()->buildPanel(this, "panel_dummy_clothing_list_item.xml"); + LLButton::Params button_params(params.add_btn); + applyXUILayout(button_params, this); + add_panelp->addChild(LLUICtrlFactory::create<LLButton>(button_params)); +} + + setSeparatorVisible(true); } typedef std::map<LLWearableType::EType, std::string> clothing_to_string_map_t; |