[VMM] Make sort menu somewhat work

This commit is contained in:
Lirusaito
2019-03-08 18:11:17 -05:00
parent a3493f5f6b
commit b98d0461d1
3 changed files with 27 additions and 10 deletions

View File

@@ -64,23 +64,15 @@ void showMenu(LLView* button, LLMenuGL* menu)
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
const auto& rect = button->getRect();
LLMenuGL::showPopup(button, menu, rect.mLeft, rect.mBottom);
LLMenuGL::showPopup(button->getParent(), menu, rect.mLeft, rect.mBottom);
}
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", this);
mMenu = LLUICtrlFactory::instance().buildMenu("menu_marketplace_view.xml", LLMenuGL::sMenuContainer);
auto sort = getChild<LLUICtrl>("sort_btn");
new LLBindMemberListener(this, "Marketplace.ViewSort.Action", [this](LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
LLMenuGL::sMenuContainer->findControl(userdata["control"].asString())->setValue(onViewSortMenuItemCheck(userdata["data"]));
});
new LLBindMemberListener(this, "Marketplace.ViewSort.CheckItem", [this](LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
onViewSortMenuItemClicked(userdata["data"]);
});
sort->setCommitCallback(boost::bind(showMenu, _1, mMenu));
mFilterEditor = getChild<LLFilterEditor>("filter_editor");

View File

@@ -132,6 +132,8 @@ protected:
void updateView();
private:
friend MarketplaceViewSortAction;
friend MarketplaceViewSortCheckItem;
S32 getFolderCount();
LLInventoryCategoriesObserver * mCategoriesObserver;

View File

@@ -75,6 +75,7 @@
#include "llfloatergodtools.h"
#include "llfloaterhtmlcurrency.h"
#include "llfloaterland.h"
#include "llfloatermarketplacelistings.h"
#include "llfloatermute.h"
#include "llfloateropenobject.h"
#include "llfloaterpathfindingcharacters.h"
@@ -9318,6 +9319,25 @@ class ListToggleMute : public view_listener_t
}
};
struct MarketplaceViewSortAction : view_listener_t
{
bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
LLFloaterMarketplaceListings::findInstance()->mPanelListings->onViewSortMenuItemClicked(userdata);
return true;
}
};
struct MarketplaceViewSortCheckItem : view_listener_t
{
bool handleEvent(LLPointer<LLOldEvents::LLEvent> event, const LLSD& userdata)
{
LLMenuGL::sMenuContainer->findControl(userdata["control"].asString())
->setValue(LLFloaterMarketplaceListings::findInstance()->mPanelListings->onViewSortMenuItemCheck(userdata["data"]));
return true;
}
};
void addMenu(view_listener_t *menu, const std::string& name)
{
sMenus.push_back(menu);
@@ -9649,6 +9669,9 @@ void initialize_menus()
LLTextEditor::setIsFriendCallback(LLAvatarActions::isFriend);
LLTextEditor::addMenuListeners();
addMenu(new MarketplaceViewSortAction, "Marketplace.ViewSort.Action");
addMenu(new MarketplaceViewSortCheckItem, "Marketplace.ViewSort.CheckItem");
class LLViewBuildMode : public view_listener_t
{
bool handleEvent(LLPointer<LLEvent> event, const LLSD& userdata)