STORM-263 FIXED popup menu of Cog button in lower-left of sidebar panel closing on second click

- Changed type of gear menu buttons from LLButton to LLMenuButton in all sidebar panels where gear menu button is used.

- Added setMenuPosition(), setMenu() and updateMenuOrigin() to the LLMenuButton.

- Moved actions common for displaying a context menu to LLMenuButton::toggleMenu().

- In all sidebar panels where LLButton was replaced with LLMenuButton the following steps were taken:
    1. setting gearMenu and its position relative to the menuButton with LLMenuButton::setMenu()
    2. setting mouse down callback for the menuButton if needed.
    3. calculating the menu origin point with LLMenuButton::updateMenuOrigin() in mouse down callback
master
Seth ProductEngine 2010-10-15 00:10:55 +03:00
parent e8a4b9308a
commit c12c60df4a
25 changed files with 195 additions and 225 deletions

View File

@ -45,7 +45,8 @@ LLMenuButton::Params::Params()
LLMenuButton::LLMenuButton(const LLMenuButton::Params& p)
: LLButton(p),
mMenu(NULL),
mMenuVisibleLastFrame(false)
mMenuVisibleLastFrame(false),
mMenuPosition(MP_BOTTOM_LEFT)
{
std::string menu_filename = p.menu_filename;
@ -57,38 +58,51 @@ LLMenuButton::LLMenuButton(const LLMenuButton::Params& p)
llwarns << "Error loading menu_button menu" << llendl;
}
}
updateMenuOrigin();
}
void LLMenuButton::toggleMenu()
boost::signals2::connection LLMenuButton::setMouseDownCallback( const mouse_signal_t::slot_type& cb )
{
if(!mMenu)
return;
if (mMenu->getVisible() || mMenuVisibleLastFrame)
{
mMenu->setVisible(FALSE);
}
else
{
LLRect rect = getRect();
//mMenu->needsArrange(); //so it recalculates the visible elements
LLMenuGL::showPopup(getParent(), mMenu, rect.mLeft, rect.mBottom);
}
return LLUICtrl::setMouseDownCallback(cb);
}
void LLMenuButton::hideMenu()
{
if(!mMenu)
return;
mMenu->setVisible(FALSE);
void LLMenuButton::hideMenu()
{
if(!mMenu) return;
mMenu->setVisible(FALSE);
}
void LLMenuButton::setMenu(LLMenuGL* menu, EMenuPosition position /*MP_TOP_LEFT*/)
{
mMenu = menu;
mMenuPosition = position;
}
void LLMenuButton::draw()
{
//we save this off so next frame when we try to close it by
//button click, and it hides menus before we get to it, we know
mMenuVisibleLastFrame = mMenu && mMenu->getVisible();
if (mMenuVisibleLastFrame)
{
setForcePressedState(true);
}
LLButton::draw();
setForcePressedState(false);
}
BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask )
{
if( KEY_RETURN == key && mask == MASK_NONE && !gKeyboard->getKeyRepeated(key))
{
// *HACK: We emit the mouse down signal to fire the callback bound to the
// menu emerging event before actually displaying the menu. See STORM-263.
LLUICtrl::handleMouseDown(-1, -1, MASK_NONE);
toggleMenu();
return TRUE;
}
@ -104,34 +118,52 @@ BOOL LLMenuButton::handleKeyHere(KEY key, MASK mask )
BOOL LLMenuButton::handleMouseDown(S32 x, S32 y, MASK mask)
{
if (hasTabStop() && !getIsChrome())
{
setFocus(TRUE);
}
LLButton::handleMouseDown(x, y, mask);
toggleMenu();
if (getSoundFlags() & MOUSE_DOWN)
{
make_ui_sound("UISndClick");
}
return TRUE;
}
void LLMenuButton::draw()
void LLMenuButton::toggleMenu()
{
//we save this off so next frame when we try to close it by
//button click, and it hides menus before we get to it, we know
mMenuVisibleLastFrame = mMenu && mMenu->getVisible();
if (mMenuVisibleLastFrame)
if(!mMenu) return;
if (mMenu->getVisible() || mMenuVisibleLastFrame)
{
setForcePressedState(true);
mMenu->setVisible(FALSE);
}
else
{
mMenu->buildDrawLabels();
mMenu->arrangeAndClear();
mMenu->updateParent(LLMenuGL::sMenuContainer);
LLButton::draw();
updateMenuOrigin();
setForcePressedState(false);
//mMenu->needsArrange(); //so it recalculates the visible elements
LLMenuGL::showPopup(getParent(), mMenu, mX, mY);
}
}
void LLMenuButton::updateMenuOrigin()
{
if (!mMenu) return;
LLRect rect = getRect();
switch (mMenuPosition)
{
case MP_TOP_LEFT:
{
mX = rect.mLeft;
mY = rect.mTop + mMenu->getRect().getHeight();
break;
}
case MP_BOTTOM_LEFT:
{
mX = rect.mLeft;
mY = rect.mBottom;
break;
}
}
}

View File

@ -42,22 +42,40 @@ public:
Optional<std::string> menu_filename;
Params();
};
};
typedef enum e_menu_position
{
MP_TOP_LEFT,
MP_BOTTOM_LEFT
} EMenuPosition;
void toggleMenu();
boost::signals2::connection setMouseDownCallback( const mouse_signal_t::slot_type& cb );
/*virtual*/ void draw();
/*virtual*/ BOOL handleMouseDown(S32 x, S32 y, MASK mask);
/*virtual*/ BOOL handleKeyHere(KEY key, MASK mask );
void hideMenu();
LLMenuGL* getMenu() { return mMenu; }
void setMenu(LLMenuGL* menu, EMenuPosition position = MP_TOP_LEFT);
void setMenuPosition(EMenuPosition position) { mMenuPosition = position; }
protected:
friend class LLUICtrlFactory;
LLMenuButton(const Params&);
void toggleMenu();
void updateMenuOrigin();
private:
LLMenuGL* mMenu;
bool mMenuVisibleLastFrame;
LLMenuGL* mMenu;
bool mMenuVisibleLastFrame;
EMenuPosition mMenuPosition;
S32 mX;
S32 mY;
};

View File

@ -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"
@ -126,18 +127,6 @@ public:
llassert(mMenu);
}
void show(LLView* spawning_view)
{
if (!mMenu) return;
updateItemsVisibility();
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);
}
void updateItemsVisibility()
{
if (!mMenu) return;
@ -148,6 +137,8 @@ public:
mMenu->arrangeAndClear(); // update menu height
}
LLMenuGL* getMenu() { return mMenu; }
private:
const LLUUID& getSelectedOutfitID()
{
@ -386,6 +377,11 @@ BOOL LLOutfitsList::postBuild()
mAccordion = getChild<LLAccordionCtrl>("outfits_accordion");
mAccordion->setComparator(&OUTFIT_TAB_NAME_COMPARATOR);
LLMenuButton* menu_gear_btn = getChild<LLMenuButton>("options_gear_btn");
menu_gear_btn->setMouseDownCallback(boost::bind(&LLOutfitListGearMenu::updateItemsVisibility, mGearMenu));
menu_gear_btn->setMenu(mGearMenu->getMenu());
return TRUE;
}
@ -727,13 +723,6 @@ bool LLOutfitsList::isActionEnabled(const LLSD& userdata)
return false;
}
// virtual
void LLOutfitsList::showGearMenu(LLView* spawning_view)
{
if (!mGearMenu) return;
mGearMenu->show(spawning_view);
}
void LLOutfitsList::getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const
{
// Collect selected items from all selected lists.

View File

@ -94,8 +94,6 @@ public:
/*virtual*/ bool isActionEnabled(const LLSD& userdata);
/*virtual*/ void showGearMenu(LLView* spawning_view);
const LLUUID& getSelectedOutfitUUID() const { return mSelectedOutfitUUID; }
/*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;

View File

@ -39,8 +39,6 @@ public:
virtual bool isActionEnabled(const LLSD& userdata) = 0;
virtual void showGearMenu(LLView* spawning_view) = 0;
virtual void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const {}
static const std::string& getFilterSubString() { return sFilterSubString; }

View File

@ -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"
@ -191,6 +192,7 @@ LLLandmarksPanel::LLLandmarksPanel()
, mLibraryInventoryPanel(NULL)
, mCurrentSelectedList(NULL)
, mListCommands(NULL)
, mGearButton(NULL)
, mGearFolderMenu(NULL)
, mGearLandmarkMenu(NULL)
{
@ -685,7 +687,9 @@ void LLLandmarksPanel::initListCommandsHandlers()
{
mListCommands = getChild<LLPanel>("bottom_panel");
mListCommands->childSetAction(OPTIONS_BUTTON_NAME, boost::bind(&LLLandmarksPanel::onActionsButtonClick, this));
mGearButton = getChild<LLMenuButton>(OPTIONS_BUTTON_NAME);
mGearButton->setMouseDownCallback(boost::bind(&LLLandmarksPanel::onActionsButtonClick, this));
mListCommands->childSetAction(TRASH_BUTTON_NAME, boost::bind(&LLLandmarksPanel::onTrashButtonClick, this));
LLDragAndDropButton* trash_btn = mListCommands->getChild<LLDragAndDropButton>(TRASH_BUTTON_NAME);
@ -741,7 +745,7 @@ void LLLandmarksPanel::onActionsButtonClick()
}
}
showActionMenu(menu,OPTIONS_BUTTON_NAME);
mGearButton->setMenu(menu);
}
void LLLandmarksPanel::showActionMenu(LLMenuGL* menu, std::string spawning_view_name)
@ -750,7 +754,10 @@ void LLLandmarksPanel::showActionMenu(LLMenuGL* menu, std::string spawning_view_
{
menu->buildDrawLabels();
menu->updateParent(LLMenuGL::sMenuContainer);
LLView* spawning_view = getChild<LLView> (spawning_view_name);
menu->arrangeAndClear();
LLView* spawning_view = getChild<LLView>(spawning_view_name);
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);

View File

@ -39,6 +39,7 @@
class LLAccordionCtrlTab;
class LLFolderViewItem;
class LLMenuButton;
class LLMenuGL;
class LLInventoryPanel;
class LLPlacesInventoryPanel;
@ -155,6 +156,7 @@ private:
LLPlacesInventoryPanel* mLandmarksInventoryPanel;
LLPlacesInventoryPanel* mMyInventoryPanel;
LLPlacesInventoryPanel* mLibraryInventoryPanel;
LLMenuButton* mGearButton;
LLMenuGL* mGearLandmarkMenu;
LLMenuGL* mGearFolderMenu;
LLMenuGL* mMenuAdd;

View File

@ -39,6 +39,7 @@
#include "llinventorypanel.h"
#include "llfiltereditor.h"
#include "llfloaterreg.h"
#include "llmenubutton.h"
#include "lloutfitobserver.h"
#include "llpreviewtexture.h"
#include "llresmgr.h"
@ -192,6 +193,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,7 +903,6 @@ 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));
@ -914,6 +916,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.
@ -927,11 +930,6 @@ void LLPanelMainInventory::updateListCommands()
mTrashButton->setEnabled(trash_enabled);
}
void LLPanelMainInventory::onGearButtonClick()
{
showActionMenu(mMenuGearDefault,"options_gear_btn");
}
void LLPanelMainInventory::onAddButtonClick()
{
setUploadCostIfNeeded();

View File

@ -40,6 +40,7 @@ class LLSaveFolderState;
class LLFilterEditor;
class LLTabContainer;
class LLFloaterInventoryFinder;
class LLMenuButton;
class LLMenuGL;
class LLFloater;
@ -129,7 +130,6 @@ private:
protected:
void initListCommandsHandlers();
void updateListCommands();
void onGearButtonClick();
void onAddButtonClick();
void showActionMenu(LLMenuGL* menu, std::string spawning_view_name);
void onTrashButtonClick();
@ -145,6 +145,7 @@ private:
LLDragAndDropButton* mTrashButton;
LLMenuGL* mMenuGearDefault;
LLMenuGL* mMenuAdd;
LLMenuButton* mGearMenuButton;
bool mNeedUploadCost;
// List Commands //

View File

@ -56,6 +56,7 @@
#include "llinventorymodel.h"
#include "llinventorymodelbackgroundfetch.h"
#include "llloadingindicator.h"
#include "llmenubutton.h"
#include "llpaneloutfitsinventory.h"
#include "lluiconstants.h"
#include "llsaveoutfitcombobtn.h"
@ -403,7 +404,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 +481,14 @@ 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");
mCOFWearables = findChild<LLCOFWearables>("cof_wearables_list");
mCOFWearables->setCommitCallback(boost::bind(&LLPanelOutfitEdit::filterWearablesBySelectedItem, this));
@ -557,6 +561,13 @@ BOOL LLPanelOutfitEdit::postBuild()
mWearableItemsList->setComparator(mWearableListViewItemsComparator);
// Creating "Add Wearables" panel gear menu after initialization of mWearableItemsList and mInventoryItemsPanel.
mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
mWearablesGearMenuBtn->setMenu(mAddWearablesGearMenu);
mGearMenu = LLPanelOutfitEditGearMenu::create();
mGearMenuBtn->setMenu(mGearMenu);
mSaveComboBtn.reset(new LLSaveOutfitComboBtn(this));
return TRUE;
}
@ -1256,37 +1267,6 @@ void LLPanelOutfitEdit::resetAccordionState()
}
}
void LLPanelOutfitEdit::onGearButtonClick(LLUICtrl* clicked_button)
{
LLMenuGL* menu = NULL;
if (mAddWearablesPanel->getVisible())
{
if (!mAddWearablesGearMenu)
{
mAddWearablesGearMenu = LLAddWearablesGearMenu::create(mWearableItemsList, mInventoryItemsPanel);
}
menu = mAddWearablesGearMenu;
}
else
{
if (!mGearMenu)
{
mGearMenu = LLPanelOutfitEditGearMenu::create();
}
menu = mGearMenu;
}
if (!menu) 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);
}
void LLPanelOutfitEdit::onAddMoreButtonClicked()
{
toggleAddWearablesPanel();

View File

@ -54,6 +54,7 @@ class LLScrollListCtrl;
class LLToggleableMenu;
class LLFilterEditor;
class LLFilteredWearableListManager;
class LLMenuButton;
class LLMenuGL;
class LLFindNonLinksByMask;
class LLFindWearablesOfType;
@ -186,8 +187,6 @@ public:
std::string& tooltip_msg);
private:
void onGearButtonClick(LLUICtrl* clicked_button);
void onAddMoreButtonClicked();
void showFilteredWearablesListView(LLWearableType::EType type);
void onOutfitChanging(bool started);
@ -238,8 +237,8 @@ private:
LLMenuGL* mAddWearablesGearMenu;
bool mInitialized;
std::auto_ptr<LLSaveOutfitComboBtn> mSaveComboBtn;
LLMenuButton* mWearablesGearMenuBtn;
LLMenuButton* mGearMenuBtn;
};

View File

@ -232,9 +232,7 @@ void LLPanelOutfitsInventory::initListCommandsHandlers()
{
mListCommands = getChild<LLPanel>("bottom_panel");
mListCommands->childSetAction("wear_btn", boost::bind(&LLPanelOutfitsInventory::onWearButtonClick, this));
mMyOutfitsPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this));
mMyOutfitsPanel->childSetAction("trash_btn", boost::bind(&LLPanelOutfitsInventory::onTrashButtonClick, this));
mCurrentOutfitPanel->childSetAction("options_gear_btn", boost::bind(&LLPanelOutfitsInventory::showGearMenu, this));
}
void LLPanelOutfitsInventory::updateListCommands()
@ -258,14 +256,6 @@ void LLPanelOutfitsInventory::updateListCommands()
}
}
void LLPanelOutfitsInventory::showGearMenu()
{
if (!mActivePanel) return;
LLView* spawning_view = getChild<LLView>("options_gear_btn");
mActivePanel->showGearMenu(spawning_view);
}
void LLPanelOutfitsInventory::onTrashButtonClick()
{
LLNotificationsUtil::add("DeleteOutfits", LLSD(), LLSD(), boost::bind(&LLPanelOutfitsInventory::onOutfitsRemovalConfirmation, this, _1, _2));

View File

@ -29,6 +29,7 @@
// libs
#include "llavatarname.h"
#include "llfloaterreg.h"
#include "llmenubutton.h"
#include "llmenugl.h"
#include "llnotificationsutil.h"
#include "lleventtimer.h"
@ -464,7 +465,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));
@ -600,11 +605,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);
@ -624,24 +624,41 @@ 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");
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);
@ -911,7 +928,7 @@ void LLPanelPeople::showGroupMenu(LLMenuGL* menu)
// Calculate its coordinates.
// (assumes that groups panel is the current tab)
LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel");
LLPanel* bottom_panel = mTabContainer->getCurrentPanel()->getChild<LLPanel>("bottom_panel");
LLPanel* parent_panel = mTabContainer->getCurrentPanel();
menu->arrangeAndClear();
S32 menu_height = menu->getRect().getHeight();
@ -1346,38 +1363,6 @@ 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::onOpen(const LLSD& key)
{
std::string tab_name = key["people_panel_tab_name"];

View File

@ -36,6 +36,7 @@ class LLAvatarList;
class LLAvatarName;
class LLFilterEditor;
class LLGroupList;
class LLMenuButton;
class LLTabContainer;
class LLPanelPeople
@ -101,10 +102,6 @@ private:
void onShareButtonClicked();
void onMoreButtonClicked();
void onActivateButtonClicked();
void onRecentViewSortButtonClicked();
void onNearbyViewSortButtonClicked();
void onFriendsViewSortButtonClicked();
void onGroupsViewSortButtonClicked();
void onAvatarListDoubleClicked(LLUICtrl* ctrl);
void onAvatarListCommitted(LLAvatarList* list);
void onGroupPlusButtonClicked();
@ -156,6 +153,11 @@ private:
Updater* mNearbyListUpdater;
Updater* mRecentListUpdater;
LLMenuButton* mNearbyGearButton;
LLMenuButton* mFriendsGearButton;
LLMenuButton* mGroupsGearButton;
LLMenuButton* mRecentGearButton;
std::string mFilterSubString;
std::string mFilterSubStringOrig;
};

View File

@ -27,6 +27,7 @@
#include "llviewerprecompiledheaders.h"
#include "llfloaterreg.h"
#include "llmenubutton.h"
#include "llfloaterworldmap.h"
#include "llpanelteleporthistory.h"
@ -375,7 +376,8 @@ LLTeleportHistoryPanel::LLTeleportHistoryPanel()
mHistoryAccordion(NULL),
mAccordionTabMenu(NULL),
mLastSelectedFlatlList(NULL),
mLastSelectedItemIndex(-1)
mLastSelectedItemIndex(-1),
mMenuGearButton(NULL)
{
buildFromFile( "panel_teleport_history.xml");
}
@ -439,8 +441,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 +448,14 @@ 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);
}
return TRUE;
}
@ -985,27 +990,6 @@ LLFlatListView* LLTeleportHistoryPanel::getFlatListViewFromTab(LLAccordionCtrlTa
return NULL;
}
void LLTeleportHistoryPanel::onGearButtonClicked()
{
LLMenuGL* menu = (LLMenuGL*)mGearMenuHandle.get();
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);
}
bool LLTeleportHistoryPanel::isActionEnabled(const LLSD& userdata) const
{
S32 tabs_cnt = mItemContainers.size();

View File

@ -38,6 +38,7 @@ class LLTeleportHistoryStorage;
class LLAccordionCtrl;
class LLAccordionCtrlTab;
class LLFlatListView;
class LLMenuButton;
class LLTeleportHistoryPanel : public LLPanelPlacesTab
{
@ -94,7 +95,6 @@ private:
void showTeleportHistory();
void handleItemSelect(LLFlatListView* );
LLFlatListView* getFlatListViewFromTab(LLAccordionCtrlTab *);
void onGearButtonClicked();
bool isActionEnabled(const LLSD& userdata) const;
void setAccordionCollapsedByUser(LLUICtrl* acc_tab, bool collapsed);
@ -118,6 +118,7 @@ private:
ContextMenu mContextMenu;
LLContextMenu* mAccordionTabMenu;
LLHandle<LLView> mGearMenuHandle;
LLMenuButton* mMenuGearButton;
};

View File

@ -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"
@ -63,16 +64,7 @@ public:
llassert(mMenu);
}
void show(LLView* spawning_view)
{
if (!mMenu) return;
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:
@ -189,6 +181,10 @@ 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");
menu_gear_btn->setMenu(mGearMenu->getMenu());
return TRUE;
}
@ -253,13 +249,6 @@ bool LLPanelWearing::isActionEnabled(const LLSD& userdata)
return false;
}
// virtual
void LLPanelWearing::showGearMenu(LLView* spawning_view)
{
if (!mGearMenu) return;
mGearMenu->show(spawning_view);
}
boost::signals2::connection LLPanelWearing::setSelectionChangeCallback(commit_callback_t cb)
{
if (!mCOFItemsList) return boost::signals2::connection();

View File

@ -58,8 +58,6 @@ public:
/*virtual*/ bool isActionEnabled(const LLSD& userdata);
/*virtual*/ void showGearMenu(LLView* spawning_view);
/*virtual*/ void getSelectedItemsUUIDs(uuid_vec_t& selected_uuids) const;
boost::signals2::connection setSelectionChangeCallback(commit_callback_t cb);

View File

@ -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"

View File

@ -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"

View File

@ -378,7 +378,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"
@ -426,7 +426,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"

View File

@ -35,7 +35,7 @@
visible="true"
name="bottom_panel"
width="312">
<button
<menu_button
follows="bottom|left"
tool_tip="Show additional options"
height="25"

View File

@ -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"

View File

@ -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" />

View File

@ -157,7 +157,7 @@
left="3"
name="bottom_panel"
width="313">
<button
<menu_button
follows="bottom|left"
tool_tip="Show additional options"
height="25"