diff options
-rw-r--r-- | indra/llui/lltoggleablemenu.cpp | 9 | ||||
-rw-r--r-- | indra/llui/lltoggleablemenu.h | 3 | ||||
-rw-r--r-- | indra/newview/llfavoritesbar.cpp | 5 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.cpp | 29 | ||||
-rw-r--r-- | indra/newview/llpanelavatar.h | 12 | ||||
-rw-r--r-- | indra/newview/llpanelpicks.cpp | 13 | ||||
-rw-r--r-- | indra/newview/llpanelplaces.cpp | 5 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/menu_profile_overflow.xml | 15 | ||||
-rw-r--r-- | indra/newview/skins/default/xui/en/panel_profile.xml | 20 |
9 files changed, 98 insertions, 13 deletions
diff --git a/indra/llui/lltoggleablemenu.cpp b/indra/llui/lltoggleablemenu.cpp index 717e135412..5df1d35383 100644 --- a/indra/llui/lltoggleablemenu.cpp +++ b/indra/llui/lltoggleablemenu.cpp @@ -40,6 +40,7 @@ static LLDefaultChildRegistry::Register<LLToggleableMenu> r("toggleable_menu"); LLToggleableMenu::LLToggleableMenu(const LLToggleableMenu::Params& p) : LLMenuGL(p), + mButtonRect(), mClosedByButtonClick(false) { } @@ -56,13 +57,19 @@ void LLToggleableMenu::handleVisibilityChange (BOOL curVisibilityIn) } } -void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view) +void LLToggleableMenu::setButtonRect(const LLRect& rect, LLView* current_view) { LLRect screen; current_view->localRectToScreen(rect, &screen); mButtonRect = screen; } +void LLToggleableMenu::setButtonRect(LLView* current_view) +{ + LLRect rect = current_view->getLocalRect(); + setButtonRect(rect, current_view); +} + bool LLToggleableMenu::toggleVisibility() { if (mClosedByButtonClick) diff --git a/indra/llui/lltoggleablemenu.h b/indra/llui/lltoggleablemenu.h index 3cd66e04a8..9d8c5261b9 100644 --- a/indra/llui/lltoggleablemenu.h +++ b/indra/llui/lltoggleablemenu.h @@ -49,8 +49,11 @@ protected: public: virtual void handleVisibilityChange (BOOL curVisibilityIn); + const LLRect& getButtonRect() const { return mButtonRect; } + // Converts the given local button rect to a screen rect void setButtonRect(const LLRect& rect, LLView* current_view); + void setButtonRect(LLView* current_view); // Returns "true" if menu was not closed by button click // and is not still visible. If menu is visible toggles diff --git a/indra/newview/llfavoritesbar.cpp b/indra/newview/llfavoritesbar.cpp index 18135fc558..01603f390d 100644 --- a/indra/newview/llfavoritesbar.cpp +++ b/indra/newview/llfavoritesbar.cpp @@ -901,7 +901,10 @@ void LLFavoritesBarCtrl::showDropDownMenu() menu->buildDrawLabels(); menu->updateParent(LLMenuGL::sMenuContainer); - menu->setButtonRect(mChevronRect, this); + if (menu->getButtonRect().isEmpty()) + { + menu->setButtonRect(mChevronRect, this); + } LLMenuGL::showPopup(this, menu, getRect().getWidth() - menu->getRect().getWidth(), 0); return; diff --git a/indra/newview/llpanelavatar.cpp b/indra/newview/llpanelavatar.cpp index 3b54f1546e..2254684f21 100644 --- a/indra/newview/llpanelavatar.cpp +++ b/indra/newview/llpanelavatar.cpp @@ -41,6 +41,7 @@ #include "llimview.h" #include "lltexteditor.h" #include "lltexturectrl.h" +#include "lltoggleablemenu.h" #include "lltooldraganddrop.h" #include "llscrollcontainer.h" #include "llavatariconctrl.h" @@ -333,8 +334,14 @@ BOOL LLPanelAvatarProfile::postBuild() childSetCommitCallback("im",(boost::bind(&LLPanelAvatarProfile::onIMButtonClick,this)),NULL); childSetCommitCallback("call",(boost::bind(&LLPanelAvatarProfile::onCallButtonClick,this)),NULL); childSetCommitCallback("teleport",(boost::bind(&LLPanelAvatarProfile::onTeleportButtonClick,this)),NULL); + childSetCommitCallback("overflow_btn", boost::bind(&LLPanelAvatarProfile::onOverflowButtonClicked, this), NULL); childSetCommitCallback("share",(boost::bind(&LLPanelAvatarProfile::onShareButtonClick,this)),NULL); + LLUICtrl::CommitCallbackRegistry::ScopedRegistrar registrar; + registrar.add("Profile.Pay", boost::bind(&LLPanelAvatarProfile::pay, this)); + + mProfileMenu = LLUICtrlFactory::getInstance()->createFromFile<LLToggleableMenu>("menu_profile_overflow.xml", gMenuHolder, LLViewerMenuHolderGL::child_registry_t::instance()); + LLTextureCtrl* pic = getChild<LLTextureCtrl>("2nd_life_pic"); pic->setFallbackImageName("default_profile_picture.j2c"); @@ -513,6 +520,11 @@ void LLPanelAvatarProfile::fillAccountStatus(const LLAvatarData* avatar_data) childSetValue("acc_status_text", caption_text); } +void LLPanelAvatarProfile::pay() +{ + LLAvatarActions::pay(getAvatarId()); +} + void LLPanelAvatarProfile::onUrlTextboxClicked(const std::string& url) { LLWeb::loadURL(url); @@ -552,6 +564,23 @@ void LLPanelAvatarProfile::onShareButtonClick() //*TODO not implemented } +void LLPanelAvatarProfile::onOverflowButtonClicked() +{ + if (!mProfileMenu->toggleVisibility()) + return; + + LLView* btn = getChild<LLView>("overflow_btn"); + + if (mProfileMenu->getButtonRect().isEmpty()) + { + mProfileMenu->setButtonRect(btn); + } + mProfileMenu->updateParent(LLMenuGL::sMenuContainer); + + LLRect rect = btn->getRect(); + LLMenuGL::showPopup(this, mProfileMenu, rect.mRight, rect.mTop); +} + ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////// diff --git a/indra/newview/llpanelavatar.h b/indra/newview/llpanelavatar.h index ae0b8e9844..a0caf0c915 100644 --- a/indra/newview/llpanelavatar.h +++ b/indra/newview/llpanelavatar.h @@ -38,6 +38,7 @@ class LLComboBox; class LLLineEditor; +class LLToggleableMenu; enum EOnlineStatus { @@ -160,12 +161,17 @@ protected: * Fills Avatar's online status. */ virtual void fillOnlineStatus(const LLAvatarData* avatar_data); - + /** * Fills account status. */ virtual void fillAccountStatus(const LLAvatarData* avatar_data); + /** + * Opens "Pay Resident" dialog. + */ + void pay(); + void onUrlTextboxClicked(const std::string& url); void onHomepageTextboxClicked(); void onAddFriendButtonClick(); @@ -173,10 +179,12 @@ protected: void onCallButtonClick(); void onTeleportButtonClick(); void onShareButtonClick(); + void onOverflowButtonClicked(); private: - std::string mGroups; + std::string mGroups; + LLToggleableMenu* mProfileMenu; }; /** diff --git a/indra/newview/llpanelpicks.cpp b/indra/newview/llpanelpicks.cpp index 6905c7e546..04b4226f82 100644 --- a/indra/newview/llpanelpicks.cpp +++ b/indra/newview/llpanelpicks.cpp @@ -346,11 +346,18 @@ void LLPanelPicks::onAccordionStateChanged(const LLAccordionCtrlTab* acc_tab) void LLPanelPicks::onOverflowButtonClicked() { - LLRect rect; - childGetRect(XML_BTN_OVERFLOW, rect); + if (!mOverflowMenu->toggleVisibility()) + return; + + LLView* btn = getChild<LLView>(XML_BTN_OVERFLOW); + if (mOverflowMenu->getButtonRect().isEmpty()) + { + mOverflowMenu->setButtonRect(btn); + } mOverflowMenu->updateParent(LLMenuGL::sMenuContainer); - mOverflowMenu->setButtonRect(rect, this); + + LLRect rect = btn->getRect(); LLMenuGL::showPopup(this, mOverflowMenu, rect.mRight, rect.mTop); } diff --git a/indra/newview/llpanelplaces.cpp b/indra/newview/llpanelplaces.cpp index 3d0fba9426..eb10d97b37 100644 --- a/indra/newview/llpanelplaces.cpp +++ b/indra/newview/llpanelplaces.cpp @@ -601,9 +601,12 @@ void LLPanelPlaces::onOverflowButtonClicked() if (!menu->toggleVisibility()) return; + if (menu->getButtonRect().isEmpty()) + { + menu->setButtonRect(mOverflowBtn); + } menu->updateParent(LLMenuGL::sMenuContainer); LLRect rect = mOverflowBtn->getRect(); - menu->setButtonRect(rect, this); LLMenuGL::showPopup(this, menu, rect.mRight, rect.mTop); } diff --git a/indra/newview/skins/default/xui/en/menu_profile_overflow.xml b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml new file mode 100644 index 0000000000..7b52fecef7 --- /dev/null +++ b/indra/newview/skins/default/xui/en/menu_profile_overflow.xml @@ -0,0 +1,15 @@ +<?xml version="1.0" encoding="utf-8" standalone="yes" ?> +<toggleable_menu + height="50" + layout="topleft" + mouse_opaque="false" + name="profile_overflow_menu" + width="120"> + <menu_item_call + label="Pay" + layout="topleft" + name="pay"> + <menu_item_call.on_click + function="Profile.Pay" /> + </menu_item_call> +</toggleable_menu> diff --git a/indra/newview/skins/default/xui/en/panel_profile.xml b/indra/newview/skins/default/xui/en/panel_profile.xml index 0f5e96416d..5110b6b2ef 100644 --- a/indra/newview/skins/default/xui/en/panel_profile.xml +++ b/indra/newview/skins/default/xui/en/panel_profile.xml @@ -283,7 +283,7 @@ mouse_opaque="false" name="add_friend" top="5" - width="75" /> + width="76" /> <button follows="bottom|left" height="19" @@ -292,7 +292,7 @@ name="im" top="5" left_pad="5" - width="45" /> + width="31" /> <button follows="bottom|left" height="19" @@ -301,7 +301,7 @@ name="call" left_pad="5" top="5" - width="45" /> + width="40" /> <button enabled="false" follows="bottom|left" @@ -311,7 +311,7 @@ name="show_on_map_btn" top="5" left_pad="5" - width="45" /> + width="42" /> <button follows="bottom|left" height="19" @@ -320,7 +320,17 @@ name="teleport" left_pad="5" top="5" - width="80" /> + width="64" /> + <button + follows="bottom|right" + font="SansSerifSmall" + height="19" + label="▼" + layout="topleft" + name="overflow_btn" + right="-1" + top="5" + width="21" /> </panel> <panel follows="bottom|left" |