diff options
Diffstat (limited to 'indra/newview/llpaneloutfitedit.cpp')
-rw-r--r-- | indra/newview/llpaneloutfitedit.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/indra/newview/llpaneloutfitedit.cpp b/indra/newview/llpaneloutfitedit.cpp index 54b0805a6c..c625ba5a11 100644 --- a/indra/newview/llpaneloutfitedit.cpp +++ b/indra/newview/llpaneloutfitedit.cpp @@ -403,7 +403,9 @@ LLPanelOutfitEdit::LLPanelOutfitEdit() mAddWearablesPanel(NULL), mFolderViewFilterCmbBox(NULL), mListViewFilterCmbBox(NULL), - mPlusBtn(NULL) + mPlusBtn(NULL), + mWearablesGearMenuBtn(NULL), + mGearMenuBtn(NULL) { mSavedFolderState = new LLSaveFolderState(); mSavedFolderState->setApply(FALSE); @@ -478,13 +480,20 @@ 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"); + + // LLMenuButton::handleMouseDownCallback calls signal LLUICtrl::mouse_signal_t, not LLButton::commit_signal_t. + // That's why to set signal LLUICtrl::mouse_signal_t we need to upcast to LLUICtrl. Using static_cast instead + // of getChild<LLUICtrl>(...) for performance. + static_cast<LLUICtrl*>(mWearablesGearMenuBtn)->setMouseDownCallback(boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1)); + static_cast<LLUICtrl*>(mGearMenuBtn)->setMouseDownCallback(boost::bind(&LLPanelOutfitEdit::onGearButtonClick, this, _1)); + mCOFWearables = getChild<LLCOFWearables>("cof_wearables_list"); mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this)); @@ -1259,32 +1268,36 @@ void LLPanelOutfitEdit::resetAccordionState() void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button) { LLMenuGL* menu = NULL; + LLMenuButton* btn = NULL; if (mAddWearablesPanel->getVisible()) { if (!mAddWearablesGearMenu) { mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel); + mWearablesGearMenuBtn->setMenu(mAddWearablesGearMenu); } menu = mAddWearablesGearMenu; + btn = mWearablesGearMenuBtn; } else { if (!mGearMenu) { mGearMenu = LLPanelOutfitEditGearMenu::create(); + mGearMenuBtn->setMenu(mGearMenu); } menu = mGearMenu; + btn = mGearMenuBtn; } - if (!menu) return; + if (!menu || !btn) 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); + menu->arrangeAndClear(); + btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT); } void LLPanelOutfitEdit::onAddMoreButtonClicked() |