summaryrefslogtreecommitdiff
path: root/indra/newview/llpaneloutfitedit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r--indra/newview/llpaneloutfitedit.cpp67
1 files changed, 21 insertions, 46 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp
index 408d4f29b7..c10c21683b 100644
--- a/indra/newview/llpaneloutfitedit.cpp
+++ b/indra/newview/llpaneloutfitedit.cpp
@@ -56,11 +56,13 @@
#include "llinventorymodel.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llloadingindicator.h"
+#include "llmenubutton.h"
#include "llpaneloutfitsinventory.h"
#include "lluiconstants.h"
#include "llsaveoutfitcombobtn.h"
#include "llscrolllistctrl.h"
#include "lltextbox.h"
+#include "lltoggleablemenu.h"
#include "lltrans.h"
#include "lluictrlfactory.h"
#include "llsdutil.h"
@@ -151,13 +153,13 @@ std::string LLShopURLDispatcher::resolveURL(LLAssetType::EType asset_type, ESex
class LLPanelOutfitEditGearMenu
{
public:
- static LLMenuGL* create()
+ static LLToggleableMenu* create()
{
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("Wearable.Create", boost::bind(onCreate, _2));
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+ LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_cof_gear.xml", LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
llassert(menu);
if (menu)
@@ -184,14 +186,8 @@ private:
// Populate the menu with items like "New Skin", "New Pants", etc.
static void populateCreateWearableSubmenus(LLMenuGL* menu)
{
- LLView* menu_clothes = gMenuHolder->findChildView("COF.Gear.New_Clothes", FALSE);
- LLView* menu_bp = gMenuHolder->findChildView("COF.Geear.New_Body_Parts", FALSE);
-
- if (!menu_clothes || !menu_bp)
- {
- llassert(menu_clothes && menu_bp);
- return;
- }
+ LLView* menu_clothes = gMenuHolder->getChildView("COF.Gear.New_Clothes", FALSE);
+ LLView* menu_bp = gMenuHolder->getChildView("COF.Geear.New_Body_Parts", FALSE);
for (U8 i = LLWearableType::WT_SHAPE; i != (U8) LLWearableType::WT_COUNT; ++i)
{
@@ -218,7 +214,7 @@ private:
class LLAddWearablesGearMenu : public LLInitClass<LLAddWearablesGearMenu>
{
public:
- static LLMenuGL* create(LLWearableItemsList* flat_list, LLInventoryPanel* inventory_panel)
+ static LLToggleableMenu* create(LLWearableItemsList* flat_list, LLInventoryPanel* inventory_panel)
{
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
LLUICtrl::EnableCallbackRegistry::ScopedRegistrar enable_registrar;
@@ -233,7 +229,7 @@ public:
enable_registrar.add("AddWearable.Gear.Check", boost::bind(onCheck, flat_list_handle, inventory_panel_handle, _2));
enable_registrar.add("AddWearable.Gear.Visible", boost::bind(onVisible, inventory_panel_handle, _2));
- LLMenuGL* menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>(
+ LLToggleableMenu* menu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>(
"menu_add_wearable_gear.xml",
LLMenuGL::sMenuContainer, LLViewerMenuHolderGL::child_registry_t::instance());
@@ -404,7 +400,9 @@ LLPanelOutfitEdit::LLPanelOutfitEdit()
mFolderViewFilterCmbBox(NULL),
mListViewFilterCmbBox(NULL),
mWearableListManager(NULL),
- mPlusBtn(NULL)
+ mPlusBtn(NULL),
+ mWearablesGearMenuBtn(NULL),
+ mGearMenuBtn(NULL)
{
mSavedFolderState = new LLSaveFolderState();
mSavedFolderState->setApply(FALSE);
@@ -480,13 +478,14 @@ BOOL LLPanelOutfitEdit::postBuild()
childSetCommitCallback("folder_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::showWearablesListView, this), NULL);
childSetCommitCallback("list_view_btn", boost::bind(&LLPanelOutfitEdit::saveListSelection, this), NULL);
- childSetCommitCallback("wearables_gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
- childSetCommitCallback("gear_menu_btn", boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1), NULL);
childSetCommitCallback("shop_btn_1", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
childSetCommitCallback("shop_btn_2", boost::bind(&LLPanelOutfitEdit::onShopButtonClicked, this), NULL);
setVisibleCallback(boost::bind(&LLPanelOutfitEdit::onVisibilityChange, this, _2));
+ mWearablesGearMenuBtn = getChild<LLMenuButton>("wearables_gear_menu_btn");
+ mGearMenuBtn = getChild<LLMenuButton>("gear_menu_btn");
+
mCOFWearables = findChild<LLCOFWearables>("cof_wearables_list");
mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
@@ -559,6 +558,13 @@ BOOL LLPanelOutfitEdit::postBuild()
mWearableItemsList->setComparator(mWearableListViewItemsComparator);
+ // Creating "Add Wearables" panel gear menu after initialization of mWearableItemsList and mInventoryItemsPanel.
+ mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
+ mWearablesGearMenuBtn->setMenu(mAddWearablesGearMenu);
+
+ mGearMenu = LLPanelOutfitEditGearMenu::create();
+ mGearMenuBtn->setMenu(mGearMenu);
+
mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
return TRUE;
}
@@ -1258,37 +1264,6 @@ void LLPanelOutfitEdit::resetAccordionState()
}
}
-void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button)
-{
- LLMenuGL* menu = NULL;
-
- if (mAddWearablesPanel->getVisible())
- {
- if (!mAddWearablesGearMenu)
- {
- mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
- }
-
- menu = mAddWearablesGearMenu;
- }
- else
- {
- if (!mGearMenu)
- {
- mGearMenu = LLPanelOutfitEditGearMenu::create();
- }
-
- menu = mGearMenu;
- }
-
- if (!menu) return;
-
- menu->arrangeAndClear(); // update menu height
- S32 menu_y = menu->getRect().getHeight() + clicked_button->getRect().getHeight();
- menu->buildDrawLabels();
- LLMenuGL::showPopup(clicked_button, menu, 0, menu_y);
-}
-
void LLPanelOutfitEdit::onAddMoreButtonClicked()
{
toggleAddWearablesPanel();