summaryrefslogtreecommitdiff
path: root/indra/newview
diff options
context:
space:
mode:
authorPaul Guslisty <pguslisty@productengine.com>2010-10-07 13:46:50 +0300
committerPaul Guslisty <pguslisty@productengine.com>2010-10-07 13:46:50 +0300
commit6589c200199e1fe0d0bf5f610d990ae197108981 (patch)
tree2b041ce2366bbe8345598a61ec90852a8a1ac768 /indra/newview
parent7d9ec365cc815fad03c31bfaf9acf5d871c2e11b (diff)
STORM-263 FIXED Cog button in lower-left of sidebar panel does not close popup menu on second click
- In all places of sidebar panel where gear menu button is used changed type of gear menu buttons from LLButton to LLMenuButton - Added setMenuPosition and setMenu to the LLMenuButton interface as public methods - In all sidebar panels where LLButton was replaced with LLMenuButton the algorithm of replacing is simple and the same for all sidebar panels. In general the algorithm is: 1. set gearMenu to the menuButton using LLMenuButton::setMenu 2. set mouse down callback for the menuButton 3. in callback for mouse down set the menu position where it should be shown using LLMenuButton::setMenuPosition
Diffstat (limited to 'indra/newview')
-rw-r--r--indra/newview/lloutfitslist.cpp23
-rw-r--r--indra/newview/llpanellandmarks.cpp12
-rw-r--r--indra/newview/llpanelmaininventory.cpp13
-rw-r--r--indra/newview/llpanelmaininventory.h2
-rw-r--r--indra/newview/llpaneloutfitedit.cpp27
-rw-r--r--indra/newview/llpaneloutfitedit.h5
-rw-r--r--indra/newview/llpanelpeople.cpp110
-rw-r--r--indra/newview/llpanelpeople.h11
-rw-r--r--indra/newview/llpanelteleporthistory.cpp30
-rw-r--r--indra/newview/llpanelteleporthistory.h2
-rw-r--r--indra/newview/llpanelwearing.cpp24
-rw-r--r--indra/newview/skins/default/xui/en/panel_landmarks.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_main_inventory.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_outfit_edit.xml4
-rw-r--r--indra/newview/skins/default/xui/en/panel_outfits_list.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_outfits_wearing.xml2
-rw-r--r--indra/newview/skins/default/xui/en/panel_people.xml9
-rw-r--r--indra/newview/skins/default/xui/en/panel_teleport_history.xml2
18 files changed, 188 insertions, 94 deletions
diff --git a/indra/newview/lloutfitslist.cpp b/indra/newview/lloutfitslist.cpp
index c0f7fa4abf..bd9536d931 100644
--- a/indra/newview/lloutfitslist.cpp
+++ b/indra/newview/lloutfitslist.cpp
@@ -38,6 +38,7 @@
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
#include "lllistcontextmenu.h"
+#include "llmenubutton.h"
#include "llnotificationsutil.h"
#include "lloutfitobserver.h"
#include "llsidetray.h"
@@ -99,10 +100,8 @@ public:
updateItemsVisibility();
mMenu->buildDrawLabels();
+ mMenu->arrangeAndClear();
mMenu->updateParent(LLMenuGL::sMenuContainer);
- S32 menu_x = 0;
- S32 menu_y = spawning_view->getRect().getHeight() + mMenu->getRect().getHeight();
- LLMenuGL::showPopup(spawning_view, mMenu, menu_x, menu_y);
}
void updateItemsVisibility()
@@ -115,6 +114,8 @@ public:
mMenu->arrangeAndClear(); // update menu height
}
+ LLMenuGL* getMenu() { return mMenu; }
+
private:
const LLUUID& getSelectedOutfitID()
{
@@ -353,6 +354,15 @@ BOOL LLOutfitsList::postBuild()
mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
+ LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_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*>(menu_gear_btn)->setMouseDownCallback(boost::bind(&LLOutfitsList::showGearMenu, this, _1));
+
+ menu_gear_btn->setMenu(mGearMenu->getMenu());
+
return TRUE;
}
@@ -695,7 +705,14 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
void LLOutfitsList::showGearMenu(LLView* spawning_view)
{
if (!mGearMenu) return;
+
mGearMenu->show(spawning_view);
+
+ LLMenuButton* btn = dynamic_cast<LLMenuButton*>(spawning_view);
+ if (btn)
+ {
+ btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
+ }
}
void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
diff --git a/indra/newview/llpanellandmarks.cpp b/indra/newview/llpanellandmarks.cpp
index 24bf67a000..0e74cce37f 100644
--- a/indra/newview/llpanellandmarks.cpp
+++ b/indra/newview/llpanellandmarks.cpp
@@ -47,6 +47,7 @@
#include "llinventorymodelbackgroundfetch.h"
#include "llinventorypanel.h"
#include "lllandmarkactions.h"
+#include "llmenubutton.h"
#include "llplacesinventorybridge.h"
#include "llplacesinventorypanel.h"
#include "llsidetray.h"
@@ -707,6 +708,8 @@ void LLLandmarksPanel::initListCommandsHandlers()
mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_place_add_button.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mListCommands->childSetAction(ADD_BUTTON_NAME, boost::bind(&LLLandmarksPanel::showActionMenu, this, mMenuAdd, ADD_BUTTON_NAME));
+
+ getChild<LLUICtrl>("options_gear_btn")->setMouseDownCallback(boost::bind(&LLLandmarksPanel::onActionsButtonClick, this));
}
@@ -751,6 +754,15 @@ void LLLandmarksPanel::showActionMenu(LLMenuGL* menu, std::string spawning_view_
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
LLView* spawning_view = getChild<LLView> (spawning_view_name);
+
+ LLMenuButton* btn = dynamic_cast <LLMenuButton*>(spawning_view);
+ if (btn)
+ {
+ btn->setMenu(menu);
+ btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
+ return;
+ }
+
S32 menu_x, menu_y;
//show menu in co-ordinates of panel
spawning_view->localPointToOtherView(0, spawning_view->getRect().getHeight(), &menu_x, &menu_y, this);
diff --git a/indra/newview/llpanelmaininventory.cpp b/indra/newview/llpanelmaininventory.cpp
index 27e054af34..59d58321a9 100644
--- a/indra/newview/llpanelmaininventory.cpp
+++ b/indra/newview/llpanelmaininventory.cpp
@@ -192,6 +192,8 @@ BOOL LLPanelMainInventory::postBuild()
mFilterEditor->setCommitCallback(boost::bind(&LLPanelMainInventory::onFilterEdit, this, _2));
}
+ mGearMenuButton = getChild<LLMenuButton>("options_gear_btn");
+
initListCommandsHandlers();
// *TODO:Get the cost info from the server
@@ -900,10 +902,14 @@ void LLFloaterInventoryFinder::selectNoTypes(void* user_data)
void LLPanelMainInventory::initListCommandsHandlers()
{
- childSetAction("options_gear_btn", boost::bind(&LLPanelMainInventory::onGearButtonClick, this));
childSetAction("trash_btn", boost::bind(&LLPanelMainInventory::onTrashButtonClick, this));
childSetAction("add_btn", boost::bind(&LLPanelMainInventory::onAddButtonClick, this));
+ // 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*>(mGearMenuButton)->setMouseDownCallback(boost::bind(&LLPanelMainInventory::onGearButtonClick, this));
+
mTrashButton = getChild<LLDragAndDropButton>("trash_btn");
mTrashButton->setDragAndDropHandler(boost::bind(&LLPanelMainInventory::handleDragAndDropToTrash, this
, _4 // BOOL drop
@@ -914,6 +920,7 @@ void LLPanelMainInventory::initListCommandsHandlers()
mCommitCallbackRegistrar.add("Inventory.GearDefault.Custom.Action", boost::bind(&LLPanelMainInventory::onCustomAction, this, _2));
mEnableCallbackRegistrar.add("Inventory.GearDefault.Enable", boost::bind(&LLPanelMainInventory::isActionEnabled, this, _2));
mMenuGearDefault = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_gear_default.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mGearMenuButton->setMenu(mMenuGearDefault);
mMenuAdd = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_inventory_add.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
// Update the trash button when selected item(s) get worn or taken off.
@@ -929,7 +936,9 @@ void LLPanelMainInventory::updateListCommands()
void LLPanelMainInventory::onGearButtonClick()
{
- showActionMenu(mMenuGearDefault,"options_gear_btn");
+ mMenuGearDefault->buildDrawLabels();
+ mMenuGearDefault->updateParent(LLMenuGL::sMenuContainer);
+ mGearMenuButton->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
}
void LLPanelMainInventory::onAddButtonClick()
diff --git a/indra/newview/llpanelmaininventory.h b/indra/newview/llpanelmaininventory.h
index fb31206870..8853ba9248 100644
--- a/indra/newview/llpanelmaininventory.h
+++ b/indra/newview/llpanelmaininventory.h
@@ -31,6 +31,7 @@
#include "llpanel.h"
#include "llinventoryobserver.h"
#include "lldndbutton.h"
+#include "llmenubutton.h"
#include "llfolderview.h"
@@ -144,6 +145,7 @@ private:
LLDragAndDropButton* mTrashButton;
LLMenuGL* mMenuGearDefault;
LLMenuGL* mMenuAdd;
+ LLMenuButton* mGearMenuButton;
bool mNeedUploadCost;
// List Commands //
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()
diff --git a/indra/newview/llpaneloutfitedit.h b/indra/newview/llpaneloutfitedit.h
index 2dca986e33..07edbdb9ba 100644
--- a/indra/newview/llpaneloutfitedit.h
+++ b/indra/newview/llpaneloutfitedit.h
@@ -38,6 +38,7 @@
#include "llinventory.h"
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
+#include "llmenubutton.h"
#include "llwearableitemslist.h"
class LLButton;
@@ -238,8 +239,8 @@ private:
LLMenuGL* mAddWearablesGearMenu;
bool mInitialized;
std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
-
-
+ LLMenuButton* mWearablesGearMenuBtn;
+ LLMenuButton* mGearMenuBtn;
};
diff --git a/indra/newview/llpanelpeople.cpp b/indra/newview/llpanelpeople.cpp
index d096b17145..8d387f3e85 100644
--- a/indra/newview/llpanelpeople.cpp
+++ b/indra/newview/llpanelpeople.cpp
@@ -463,7 +463,11 @@ LLPanelPeople::LLPanelPeople()
mAllFriendList(NULL),
mNearbyList(NULL),
mRecentList(NULL),
- mGroupList(NULL)
+ mGroupList(NULL),
+ mNearbyGearButton(NULL),
+ mFriendsGearButton(NULL),
+ mGroupsGearButton(NULL),
+ mRecentGearButton(NULL)
{
mFriendListUpdater = new LLFriendListUpdater(boost::bind(&LLPanelPeople::updateFriendList, this));
mNearbyListUpdater = new LLNearbyListUpdater(boost::bind(&LLPanelPeople::updateNearbyList, this));
@@ -599,11 +603,6 @@ BOOL LLPanelPeople::postBuild()
buttonSetAction("teleport_btn", boost::bind(&LLPanelPeople::onTeleportButtonClicked, this));
buttonSetAction("share_btn", boost::bind(&LLPanelPeople::onShareButtonClicked, this));
- getChild<LLPanel>(NEARBY_TAB_NAME)->childSetAction("nearby_view_sort_btn",boost::bind(&LLPanelPeople::onNearbyViewSortButtonClicked, this));
- getChild<LLPanel>(RECENT_TAB_NAME)->childSetAction("recent_viewsort_btn",boost::bind(&LLPanelPeople::onRecentViewSortButtonClicked, this));
- getChild<LLPanel>(FRIENDS_TAB_NAME)->childSetAction("friends_viewsort_btn",boost::bind(&LLPanelPeople::onFriendsViewSortButtonClicked, this));
- getChild<LLPanel>(GROUP_TAB_NAME)->childSetAction("groups_viewsort_btn",boost::bind(&LLPanelPeople::onGroupsViewSortButtonClicked, this));
-
// Must go after setting commit callback and initializing all pointers to children.
mTabContainer->selectTabByName(NEARBY_TAB_NAME);
@@ -623,24 +622,49 @@ BOOL LLPanelPeople::postBuild()
enable_registrar.add("People.Recent.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onRecentViewSortMenuItemCheck, this, _2));
enable_registrar.add("People.Nearby.ViewSort.CheckItem", boost::bind(&LLPanelPeople::onNearbyViewSortMenuItemCheck, this, _2));
+ mNearbyGearButton = getChild<LLMenuButton>("nearby_view_sort_btn");
+ mFriendsGearButton = getChild<LLMenuButton>("friends_viewsort_btn");
+ mGroupsGearButton = getChild<LLMenuButton>("groups_viewsort_btn");
+ mRecentGearButton = getChild<LLMenuButton>("recent_viewsort_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*>(mNearbyGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
+ static_cast<LLUICtrl*>(mFriendsGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
+ static_cast<LLUICtrl*>(mGroupsGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
+ static_cast<LLUICtrl*>(mRecentGearButton)->setMouseDownCallback(boost::bind(&LLPanelPeople::onViewSortButtonClicked, this));
+
LLMenuGL* plus_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_group_plus.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
mGroupPlusMenuHandle = plus_menu->getHandle();
LLMenuGL* nearby_view_sort = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_nearby_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(nearby_view_sort)
+ {
mNearbyViewSortMenuHandle = nearby_view_sort->getHandle();
+ mNearbyGearButton->setMenu(nearby_view_sort);
+ }
LLMenuGL* friend_view_sort = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_friends_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(friend_view_sort)
+ {
mFriendsViewSortMenuHandle = friend_view_sort->getHandle();
+ mFriendsGearButton->setMenu(friend_view_sort);
+ }
LLMenuGL* group_view_sort = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_groups_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(group_view_sort)
+ {
mGroupsViewSortMenuHandle = group_view_sort->getHandle();
+ mGroupsGearButton->setMenu(group_view_sort);
+ }
LLMenuGL* recent_view_sort = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_people_recent_view_sort.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
if(recent_view_sort)
+ {
mRecentViewSortMenuHandle = recent_view_sort->getHandle();
+ mRecentGearButton->setMenu(recent_view_sort);
+ }
LLVoiceClient::getInstance()->addObserver(this);
@@ -907,20 +931,9 @@ void LLPanelPeople::getCurrentItemIDs(uuid_vec_t& selected_uuids) const
void LLPanelPeople::showGroupMenu(LLMenuGL* menu)
{
// Shows the menu at the top of the button bar.
-
- // Calculate its coordinates.
- // (assumes that groups panel is the current tab)
- LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel");
- LLPanel* parent_panel = mTabContainer->getCurrentPanel();
menu->arrangeAndClear();
- S32 menu_height = menu->getRect().getHeight();
- S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
- S32 menu_y = bottom_panel->getRect().mTop + menu_height;
-
- // Actually show the menu.
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(parent_panel, menu, menu_x, menu_y);
}
void LLPanelPeople::setSortOrder(LLAvatarList* list, ESortOrder order, bool save)
@@ -1347,36 +1360,39 @@ void LLPanelPeople::onMoreButtonClicked()
// *TODO: not implemented yet
}
-void LLPanelPeople::onFriendsViewSortButtonClicked()
-{
- LLMenuGL* menu = (LLMenuGL*)mFriendsViewSortMenuHandle.get();
- if (!menu)
- return;
- showGroupMenu(menu);
-}
-
-void LLPanelPeople::onGroupsViewSortButtonClicked()
-{
- LLMenuGL* menu = (LLMenuGL*)mGroupsViewSortMenuHandle.get();
- if (!menu)
- return;
- showGroupMenu(menu);
-}
-
-void LLPanelPeople::onRecentViewSortButtonClicked()
-{
- LLMenuGL* menu = (LLMenuGL*)mRecentViewSortMenuHandle.get();
- if (!menu)
- return;
- showGroupMenu(menu);
-}
-
-void LLPanelPeople::onNearbyViewSortButtonClicked()
-{
- LLMenuGL* menu = (LLMenuGL*)mNearbyViewSortMenuHandle.get();
- if (!menu)
- return;
- showGroupMenu(menu);
+void LLPanelPeople::onViewSortButtonClicked()
+{
+ std::string current_panel = getActiveTabName();
+
+ LLMenuGL* menu = NULL;
+ LLMenuButton* btn = NULL;
+
+ if (current_panel == NEARBY_TAB_NAME)
+ {
+ menu = dynamic_cast<LLMenuGL*>(mNearbyViewSortMenuHandle.get());
+ btn = mNearbyGearButton;
+ }
+ else if (current_panel == FRIENDS_TAB_NAME)
+ {
+ menu = dynamic_cast<LLMenuGL*>(mFriendsViewSortMenuHandle.get());
+ btn = mFriendsGearButton;
+ }
+ else if (current_panel == GROUP_TAB_NAME)
+ {
+ menu = dynamic_cast<LLMenuGL*>(mGroupsViewSortMenuHandle.get());
+ btn = mGroupsGearButton;
+ }
+ else if (current_panel == RECENT_TAB_NAME)
+ {
+ menu = dynamic_cast<LLMenuGL*>(mRecentViewSortMenuHandle.get());
+ btn = mRecentGearButton;
+ }
+
+ if (menu && btn)
+ {
+ showGroupMenu(menu);
+ btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
+ }
}
void LLPanelPeople::onOpen(const LLSD& key)
diff --git a/indra/newview/llpanelpeople.h b/indra/newview/llpanelpeople.h
index d0913ee756..3109feef0c 100644
--- a/indra/newview/llpanelpeople.h
+++ b/indra/newview/llpanelpeople.h
@@ -30,6 +30,7 @@
#include <llpanel.h>
#include "llcallingcard.h" // for avatar tracker
+#include "llmenubutton.h"
#include "llvoiceclient.h"
class LLFilterEditor;
@@ -100,10 +101,7 @@ private:
void onShareButtonClicked();
void onMoreButtonClicked();
void onActivateButtonClicked();
- void onRecentViewSortButtonClicked();
- void onNearbyViewSortButtonClicked();
- void onFriendsViewSortButtonClicked();
- void onGroupsViewSortButtonClicked();
+ void onViewSortButtonClicked();
void onAvatarListDoubleClicked(LLUICtrl* ctrl);
void onAvatarListCommitted(LLAvatarList* list);
void onGroupPlusButtonClicked();
@@ -157,6 +155,11 @@ private:
Updater* mNearbyListUpdater;
Updater* mRecentListUpdater;
+ LLMenuButton* mNearbyGearButton;
+ LLMenuButton* mFriendsGearButton;
+ LLMenuButton* mGroupsGearButton;
+ LLMenuButton* mRecentGearButton;
+
std::string mFilterSubString;
std::string mFilterSubStringOrig;
};
diff --git a/indra/newview/llpanelteleporthistory.cpp b/indra/newview/llpanelteleporthistory.cpp
index a7cbf52290..216b7e2fa9 100644
--- a/indra/newview/llpanelteleporthistory.cpp
+++ b/indra/newview/llpanelteleporthistory.cpp
@@ -375,7 +375,8 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
mHistoryAccordion(NULL),
mAccordionTabMenu(NULL),
mLastSelectedFlatlList(NULL),
- mLastSelectedItemIndex(-1)
+ mLastSelectedItemIndex(-1),
+ mMenuGearButton(NULL)
{
LLUICtrlFactory::getInstance()->buildPanel(this, "panel_teleport_history.xml");
}
@@ -439,8 +440,6 @@ BOOL LLTeleportHistoryPanel::postBuild()
}
}
- getChild<LLPanel>("bottom_panel")->childSetAction("gear_btn",boost::bind(&LLTeleportHistoryPanel::onGearButtonClicked, this));
-
LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar;
registrar.add("TeleportHistory.ExpandAllFolders", boost::bind(&LLTeleportHistoryPanel::onExpandAllFolders, this));
@@ -448,9 +447,19 @@ BOOL LLTeleportHistoryPanel::postBuild()
registrar.add("TeleportHistory.ClearTeleportHistory", boost::bind(&LLTeleportHistoryPanel::onClearTeleportHistory, this));
mEnableCallbackRegistrar.add("TeleportHistory.GearMenu.Enable", boost::bind(&LLTeleportHistoryPanel::isActionEnabled, this, _2));
- LLMenuGL* gear_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_teleport_history_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());
+ mMenuGearButton = getChild<LLMenuButton>("gear_btn");
+
+ LLMenuGL* gear_menu = LLUICtrlFactory::getInstance()->createFromFile<LLMenuGL>("menu_teleport_history_gear.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance());;
if(gear_menu)
+ {
mGearMenuHandle = gear_menu->getHandle();
+ mMenuGearButton->setMenu(gear_menu);
+ }
+
+ // 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*>(mMenuGearButton)->setMouseDownCallback(boost::bind(&LLTeleportHistoryPanel::onGearButtonClicked, this));
return TRUE;
}
@@ -991,19 +1000,12 @@ void LLTeleportHistoryPanel::onGearButtonClicked()
if (!menu)
return;
- // Shows the menu at the top of the button bar.
-
- // Calculate its coordinates.
- LLPanel* bottom_panel = getChild<LLPanel>("bottom_panel");
menu->arrangeAndClear();
- S32 menu_height = menu->getRect().getHeight();
- S32 menu_x = -2; // *HACK: compensates HPAD in showPopup()
- S32 menu_y = bottom_panel->getRect().mTop + menu_height;
-
- // Actually show the menu.
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
- LLMenuGL::showPopup(this, menu, menu_x, menu_y);
+
+ // Shows the menu at the top of the button bar.
+ mMenuGearButton->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
}
bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
diff --git a/indra/newview/llpanelteleporthistory.h b/indra/newview/llpanelteleporthistory.h
index b5a025b39b..04809383f2 100644
--- a/indra/newview/llpanelteleporthistory.h
+++ b/indra/newview/llpanelteleporthistory.h
@@ -33,6 +33,7 @@
#include "llpanelplacestab.h"
#include "llteleporthistory.h"
#include "llmenugl.h"
+#include "llmenubutton.h"
class LLTeleportHistoryStorage;
class LLAccordionCtrl;
@@ -118,6 +119,7 @@ private:
ContextMenu mContextMenu;
LLContextMenu* mAccordionTabMenu;
LLHandle<LLView> mGearMenuHandle;
+ LLMenuButton* mMenuGearButton;
};
diff --git a/indra/newview/llpanelwearing.cpp b/indra/newview/llpanelwearing.cpp
index 860470cd73..1b46294c52 100644
--- a/indra/newview/llpanelwearing.cpp
+++ b/indra/newview/llpanelwearing.cpp
@@ -32,6 +32,7 @@
#include "llinventoryfunctions.h"
#include "llinventorymodel.h"
#include "llinventoryobserver.h"
+#include "llmenubutton.h"
#include "llsidetray.h"
#include "llviewermenu.h"
#include "llwearableitemslist.h"
@@ -67,13 +68,13 @@ public:
{
if (!mMenu) return;
+ mMenu->arrangeAndClear();
mMenu->buildDrawLabels();
mMenu->updateParent(LLMenuGL::sMenuContainer);
- S32 menu_x = 0;
- S32 menu_y = spawning_view->getRect().getHeight() + mMenu->getRect().getHeight();
- LLMenuGL::showPopup(spawning_view, mMenu, menu_x, menu_y);
}
+ LLMenuGL* getMenu() { return mMenu; }
+
private:
void onTakeOff()
@@ -189,6 +190,16 @@ BOOL LLPanelWearing::postBuild()
mCOFItemsList = getChild<LLWearableItemsList>("cof_items_list");
mCOFItemsList->setRightMouseDownCallback(boost::bind(&LLPanelWearing::onWearableItemsListRightClick, this, _1, _2, _3));
+ LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_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*>(menu_gear_btn)->setMouseDownCallback(boost::bind(&LLPanelWearing::showGearMenu, this, _1));
+
+ menu_gear_btn->setMenu(mGearMenu->getMenu());
+
+
return TRUE;
}
@@ -257,7 +268,14 @@ bool LLPanelWearing::isActionEnabled(const LLSD& userdata)
void LLPanelWearing::showGearMenu(LLView* spawning_view)
{
if (!mGearMenu) return;
+
mGearMenu->show(spawning_view);
+
+ LLMenuButton* btn = dynamic_cast<LLMenuButton*>(spawning_view);
+ if (btn)
+ {
+ btn->setMenuPosition(LLMenuButton::ON_TOP_LEFT);
+ }
}
boost::signals2::connection LLPanelWearing::setSelectionChangeCallback(commit_callback_t cb)
diff --git a/indra/newview/skins/default/xui/en/panel_landmarks.xml b/indra/newview/skins/default/xui/en/panel_landmarks.xml
index 7e415f45a4..5106215835 100644
--- a/indra/newview/skins/default/xui/en/panel_landmarks.xml
+++ b/indra/newview/skins/default/xui/en/panel_landmarks.xml
@@ -115,7 +115,7 @@
layout="topleft"
name="options_gear_btn_panel"
width="32">
- <button
+ <menu_button
follows="bottom|left"
tool_tip="Show additional options"
height="25"
diff --git a/indra/newview/skins/default/xui/en/panel_main_inventory.xml b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
index 16529f4064..2b6e082542 100644
--- a/indra/newview/skins/default/xui/en/panel_main_inventory.xml
+++ b/indra/newview/skins/default/xui/en/panel_main_inventory.xml
@@ -119,7 +119,7 @@
layout="topleft"
name="options_gear_btn_panel"
width="32">
- <button
+ <menu_button
follows="bottom|left"
tool_tip="Show additional options"
height="25"
diff --git a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
index 883cbb30c6..89e12b2d1d 100644
--- a/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfit_edit.xml
@@ -375,7 +375,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap
name="no_add_wearables_button_bar"
top_pad="0"
width="313">
- <button
+ <menu_button
follows="bottom|left"
height="25"
image_hover_unselected="Toolbar_Left_Over"
@@ -423,7 +423,7 @@ It is calculated as border_size + 2*UIResizeBarOverlap
top_delta="0"
visible="false"
width="313">
- <button
+ <menu_button
follows="bottom|left"
height="25"
image_hover_unselected="Toolbar_Left_Over"
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_list.xml b/indra/newview/skins/default/xui/en/panel_outfits_list.xml
index d18f0d57ca..9f98019c94 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_list.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_list.xml
@@ -35,7 +35,7 @@
visible="true"
name="bottom_panel"
width="312">
- <button
+ <menu_button
follows="bottom|left"
tool_tip="Show additional options"
height="25"
diff --git a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
index 2fbbf6610c..d85b778db2 100644
--- a/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
+++ b/indra/newview/skins/default/xui/en/panel_outfits_wearing.xml
@@ -29,7 +29,7 @@
name="bottom_panel"
top_pad="0"
width="312">
- <button
+ <menu_button
follows="bottom|left"
height="25"
image_hover_unselected="Toolbar_Left_Over"
diff --git a/indra/newview/skins/default/xui/en/panel_people.xml b/indra/newview/skins/default/xui/en/panel_people.xml
index ab8930c967..3ffb462bb5 100644
--- a/indra/newview/skins/default/xui/en/panel_people.xml
+++ b/indra/newview/skins/default/xui/en/panel_people.xml
@@ -114,7 +114,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
name="bottom_panel"
top_pad="0"
width="313">
- <button
+ <menu_button
follows="bottom|left"
height="25"
image_hover_unselected="Toolbar_Left_Over"
@@ -242,7 +242,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
layout="topleft"
name="options_gear_btn_panel"
width="32">
- <button
+ <menu_button
follows="bottom|left"
tool_tip="Show additional options"
height="25"
@@ -407,7 +407,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
name="bottom_panel"
top_pad="0"
width="313">
- <button
+ <menu_button
follows="bottom|left"
tool_tip="Options"
height="25"
@@ -490,7 +490,7 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
name="bottom_panel"
top_pad="0"
width="313">
- <button
+ <menu_button
follows="bottom|left"
tool_tip="Options"
height="25"
@@ -499,7 +499,6 @@ Looking for people to hang out with? Try the [secondlife:///app/worldmap World M
image_selected="Toolbar_Left_Selected"
image_unselected="Toolbar_Left_Off"
layout="topleft"
- left="3"
name="recent_viewsort_btn"
top="1"
width="31" />
diff --git a/indra/newview/skins/default/xui/en/panel_teleport_history.xml b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
index bf09836e87..768efc2f3f 100644
--- a/indra/newview/skins/default/xui/en/panel_teleport_history.xml
+++ b/indra/newview/skins/default/xui/en/panel_teleport_history.xml
@@ -157,7 +157,7 @@
left="3"
name="bottom_panel"
width="313">
- <button
+ <menu_button
follows="bottom|left"
tool_tip="Show additional options"
height="25"