From d770034e5c454d6d4e65b8ee4adfbab1d1cae3d9 Mon Sep 17 00:00:00 2001 From: Lirusaito Date: Mon, 4 Mar 2019 20:31:17 -0500 Subject: [PATCH] Hook up the menu the old fashioned way --- .../newview/llfloatermarketplacelistings.cpp | 21 +++++++++++++++++-- indra/newview/llfloatermarketplacelistings.h | 3 +++ 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/indra/newview/llfloatermarketplacelistings.cpp b/indra/newview/llfloatermarketplacelistings.cpp index 1a410847d..96ef0ca88 100644 --- a/indra/newview/llfloatermarketplacelistings.cpp +++ b/indra/newview/llfloatermarketplacelistings.cpp @@ -55,8 +55,6 @@ LLPanelMarketplaceListings::LLPanelMarketplaceListings() , mSortOrder(LLInventoryFilter::SO_FOLDERS_BY_NAME) , mFilterListingFoldersOnly(false) { - mCommitCallbackRegistrar.add("Marketplace.ViewSort.Action", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemClicked, this, _2)); - mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemCheck, this, _2)); } LLPanelMarketplaceListings::~LLPanelMarketplaceListings() { delete mMenu; } @@ -68,12 +66,31 @@ void showMenu(LLView* button, LLMenuGL* menu) const auto& rect = button->getRect(); LLMenuGL::showPopup(button, menu, rect.mLeft, rect.mBottom); } +struct MarketplaceViewSortAction : public LLMemberListener +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + mPtr->onViewSortMenuItemClicked(userdata["data"]); + return true; + } +}; + +struct MarketplaceViewSortCheckItem : public LLMemberListener +{ + bool handleEvent(LLPointer event, const LLSD& userdata) + { + LLMenuGL::sMenuContainer->findControl(userdata["control"].asString())->setValue(mPtr->onViewSortMenuItemCheck(userdata["data"])); + return true; + } +}; BOOL LLPanelMarketplaceListings::postBuild() { childSetAction("add_btn", boost::bind(&LLPanelMarketplaceListings::onAddButtonClicked, this)); childSetAction("audit_btn", boost::bind(&LLPanelMarketplaceListings::onAuditButtonClicked, this)); mMenu = LLUICtrlFactory::instance().buildMenu("menu_marketplace_view.xml", LLMenuGL::sMenuContainer); + (new MarketplaceViewSortAction)->registerListener(this, "Marketplace.ViewSort.Action"); + (new MarketplaceViewSortCheckItem)->registerListener(this, "Marketplace.ViewSort.CheckItem"); auto sort = getChild("sort_btn"); sort->setCommitCallback(boost::bind(showMenu, _1, mMenu)); diff --git a/indra/newview/llfloatermarketplacelistings.h b/indra/newview/llfloatermarketplacelistings.h index 7df0c4976..fbeb10077 100644 --- a/indra/newview/llfloatermarketplacelistings.h +++ b/indra/newview/llfloatermarketplacelistings.h @@ -65,6 +65,9 @@ public: void buildAllPanels(); private: + friend struct MarketplaceViewSortAction; + friend struct MarketplaceViewSortCheckItem; + LLInventoryPanel* buildInventoryPanel(const std::string& childname, const std::string& filename); // UI callbacks