From 67e17bd822f146f333b91d353df6f55174ce4db6 Mon Sep 17 00:00:00 2001 From: Maxim Nikolenko Date: Fri, 26 May 2023 19:45:46 +0300 Subject: SL-19774 add context menu for root folder (without any selection); show paste menu when right clicking any item --- indra/newview/llinventorygallery.cpp | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'indra/newview/llinventorygallery.cpp') diff --git a/indra/newview/llinventorygallery.cpp b/indra/newview/llinventorygallery.cpp index 18a7068b66..c6fee42297 100644 --- a/indra/newview/llinventorygallery.cpp +++ b/indra/newview/llinventorygallery.cpp @@ -126,12 +126,15 @@ BOOL LLInventoryGallery::postBuild() mGalleryPanel = LLUICtrlFactory::create(params); mMessageTextBox = getChild("empty_txt"); mInventoryGalleryMenu = new LLInventoryGalleryContextMenu(this); + mRootGalleryMenu = new LLInventoryGalleryContextMenu(this); + mRootGalleryMenu->setRootFolder(true); return TRUE; } LLInventoryGallery::~LLInventoryGallery() { delete mInventoryGalleryMenu; + delete mRootGalleryMenu; delete mFilter; while (!mUnusedRowPanels.empty()) @@ -837,6 +840,27 @@ void LLInventoryGallery::onThumbnailAdded(LLUUID item_id) } } +BOOL LLInventoryGallery::handleRightMouseDown(S32 x, S32 y, MASK mask) +{ + if(mItemMap[mSelectedItemID]) + { + mItemMap[mSelectedItemID]->setFocus(false); + } + clearSelection(); + BOOL res = LLPanel::handleRightMouseDown(x, y, mask); + if (mSelectedItemID.isNull()) + { + if (mInventoryGalleryMenu && mFolderID.notNull()) + { + uuid_vec_t selected_uuids; + selected_uuids.push_back(mFolderID); + mRootGalleryMenu->show(this, selected_uuids, x, y); + return TRUE; + } + } + return res; +} + void LLInventoryGallery::showContextMenu(LLUICtrl* ctrl, S32 x, S32 y, const LLUUID& item_id) { if (mInventoryGalleryMenu && item_id.notNull()) -- cgit v1.3