diff options
Diffstat (limited to 'indra/newview/llpanelpicks.cpp')
-rw-r--r-- | indra/newview/llpanelpicks.cpp | 51 |
1 files changed, 42 insertions, 9 deletions
diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 1219a08c6c..aa6909560d 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -39,6 +39,7 @@ #include "llfloaterreg.h" #include "llfloaterworldmap.h" #include "lltexturectrl.h" +#include "lltoggleablemenu.h" #include "llviewergenericmessage.h" // send_generic_message #include "llmenugl.h" #include "llviewermenu.h" @@ -55,6 +56,7 @@ static const std::string XML_BTN_DELETE = "trash_btn"; static const std::string XML_BTN_INFO = "info_btn"; static const std::string XML_BTN_TELEPORT = "teleport_btn"; static const std::string XML_BTN_SHOW_ON_MAP = "show_on_map_btn"; +static const std::string XML_BTN_OVERFLOW = "overflow_btn"; static const std::string PICK_ID("pick_id"); static const std::string PICK_CREATOR_ID("pick_creator_id"); @@ -74,6 +76,7 @@ LLPanelPicks::LLPanelPicks() mPicksList(NULL) , mPanelPickInfo(NULL) , mPanelPickEdit(NULL) + , mOverflowMenu(NULL) { } @@ -159,25 +162,56 @@ BOOL LLPanelPicks::postBuild() { mPicksList = getChild<LLFlatListView>("picks_list"); + childSetAction(XML_BTN_NEW, boost::bind(&LLPanelPicks::onClickNew, this)); childSetAction(XML_BTN_DELETE, boost::bind(&LLPanelPicks::onClickDelete, this)); - - childSetAction("teleport_btn", boost::bind(&LLPanelPicks::onClickTeleport, this)); - childSetAction("show_on_map_btn", boost::bind(&LLPanelPicks::onClickMap, this)); - - childSetAction("info_btn", boost::bind(&LLPanelPicks::onClickInfo, this)); - childSetAction("new_btn", boost::bind(&LLPanelPicks::onClickNew, this)); + childSetAction(XML_BTN_TELEPORT, boost::bind(&LLPanelPicks::onClickTeleport, this)); + childSetAction(XML_BTN_SHOW_ON_MAP, boost::bind(&LLPanelPicks::onClickMap, this)); + childSetAction(XML_BTN_INFO, boost::bind(&LLPanelPicks::onClickInfo, this)); + childSetAction(XML_BTN_OVERFLOW, boost::bind(&LLPanelPicks::onOverflowButtonClicked, this)); - CommitCallbackRegistry::ScopedRegistrar registar; + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registar; registar.add("Pick.Info", boost::bind(&LLPanelPicks::onClickInfo, this)); registar.add("Pick.Edit", boost::bind(&LLPanelPicks::onClickMenuEdit, this)); registar.add("Pick.Teleport", boost::bind(&LLPanelPicks::onClickTeleport, this)); registar.add("Pick.Map", boost::bind(&LLPanelPicks::onClickMap, this)); registar.add("Pick.Delete", boost::bind(&LLPanelPicks::onClickDelete, this)); mPopupMenu = LLUICtrlFactory::getInstance()->createFromFile<LLContextMenu>("menu_picks.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar overflow_registar; + overflow_registar.add("PicksList.Overflow", boost::bind(&LLPanelPicks::onOverflowMenuItemClicked, this, _2)); + mOverflowMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_picks_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); return TRUE; } +void LLPanelPicks::onOverflowMenuItemClicked(const LLSD& param) +{ + std::string value = param.asString(); + + if("info" == value) + { + onClickInfo(); + } + else if("teleport" == value) + { + onClickTeleport(); + } + else if("map" == value) + { + onClickMap(); + } +} + +void LLPanelPicks::onOverflowButtonClicked() +{ + LLRect rect; + childGetRect(XML_BTN_OVERFLOW, rect); + + mOverflowMenu->updateParent(LLMenuGL::sMenuContainer); + mOverflowMenu->setButtonRect(rect, this); + LLMenuGL::showPopup(this, mOverflowMenu, rect.mRight, rect.mTop); +} + void LLPanelPicks::onOpen(const LLSD& key) { const LLUUID id(key.asUUID()); @@ -305,8 +339,6 @@ void LLPanelPicks::updateButtons() { bool has_selected = mPicksList->numSelected(); - childSetEnabled(XML_BTN_INFO, has_selected); - if (getAvatarId() == gAgentID) { childSetEnabled(XML_BTN_NEW, !LLAgentPicksInfo::getInstance()->isPickLimitReached()); @@ -316,6 +348,7 @@ void LLPanelPicks::updateButtons() childSetEnabled(XML_BTN_INFO, has_selected); childSetEnabled(XML_BTN_TELEPORT, has_selected); childSetEnabled(XML_BTN_SHOW_ON_MAP, has_selected); + childSetEnabled(XML_BTN_OVERFLOW, has_selected); } void LLPanelPicks::setProfilePanel(LLPanelProfile* profile_panel) |