Spawn the menu on button click
TODO: Make a derived button that uses this showMenu function instead So we can finally have menu buttons like upstream
This commit is contained in:
@@ -59,10 +59,23 @@ LLPanelMarketplaceListings::LLPanelMarketplaceListings()
|
||||
mEnableCallbackRegistrar.add("Marketplace.ViewSort.CheckItem", boost::bind(&LLPanelMarketplaceListings::onViewSortMenuItemCheck, this, _2));
|
||||
}
|
||||
|
||||
LLPanelMarketplaceListings::~LLPanelMarketplaceListings() { delete mMenu; }
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
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);
|
||||
auto sort = getChild<LLUICtrl>("sort_btn");
|
||||
sort->setCommitCallback(boost::bind(showMenu, _1, mMenu));
|
||||
|
||||
mFilterEditor = getChild<LLFilterEditor>("filter_editor");
|
||||
mFilterEditor->setCommitCallback(boost::bind(&LLPanelMarketplaceListings::onFilterEdit, this, _2));
|
||||
|
||||
@@ -51,6 +51,7 @@ class LLPanelMarketplaceListings : public LLPanel
|
||||
{
|
||||
public:
|
||||
LLPanelMarketplaceListings();
|
||||
~LLPanelMarketplaceListings();
|
||||
BOOL postBuild();
|
||||
BOOL handleDragAndDrop(S32 x, S32 y, MASK mask, BOOL drop,
|
||||
EDragAndDropType cargo_type,
|
||||
@@ -79,6 +80,7 @@ private:
|
||||
|
||||
LLFolderView* mRootFolder;
|
||||
LLButton* mAuditBtn;
|
||||
class LLMenuGL* mMenu;
|
||||
LLFilterEditor* mFilterEditor;
|
||||
std::string mFilterSubString;
|
||||
bool mFilterListingFoldersOnly;
|
||||
|
||||
Reference in New Issue
Block a user