diff options
author | Paul Guslisty <pguslisty@productengine.com> | 2010-10-07 13:46:50 +0300 |
---|---|---|
committer | Paul Guslisty <pguslisty@productengine.com> | 2010-10-07 13:46:50 +0300 |
commit | 6589c200199e1fe0d0bf5f610d990ae197108981 (patch) | |
tree | 2b041ce2366bbe8345598a61ec90852a8a1ac768 /indra/newview/lloutfitslist.cpp | |
parent | 7d9ec365cc815fad03c31bfaf9acf5d871c2e11b (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/lloutfitslist.cpp')
-rw-r--r-- | indra/newview/lloutfitslist.cpp | 23 |
1 files changed, 20 insertions, 3 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 |