From 69f9c0bcf9764a1b682bfdd5baa3f340922dcbaa Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 3 Mar 2010 19:37:41 -0800 Subject: WIP - replace top ctrl with LLPopupView --- indra/newview/llstatusbar.cpp | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'indra/newview/llstatusbar.cpp') diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 732c23982b..2ed0718e41 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -239,20 +239,16 @@ BOOL LLStatusBar::postBuild() childSetActionTextbox("stat_btn", onClickStatGraph); - LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); - mPanelVolumePulldown = new LLPanelVolumePulldown(); - popup_holder->addChild(mPanelVolumePulldown); + addChild(mPanelVolumePulldown); + mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); + mPanelVolumePulldown->setVisible(FALSE); mPanelNearByMedia = new LLPanelNearByMedia(); - popup_holder->addChild(mPanelNearByMedia); - gViewerWindow->getRootView()->addMouseDownCallback(boost::bind(&LLStatusBar::onClickScreen, this, _1, _2)); + addChild(mPanelNearByMedia); mPanelNearByMedia->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); mPanelNearByMedia->setVisible(FALSE); - mPanelVolumePulldown->setFollows(FOLLOWS_TOP|FOLLOWS_RIGHT); - mPanelVolumePulldown->setVisible(FALSE); - return TRUE; } @@ -538,8 +534,10 @@ void LLStatusBar::onMouseEnterVolume() // show the master volume pull-down - mPanelVolumePulldown->setVisible(TRUE); + LLUI::clearPopups(); + LLUI::addPopup(mPanelVolumePulldown); mPanelNearByMedia->setVisible(FALSE); + mPanelVolumePulldown->setVisible(TRUE); } void LLStatusBar::onMouseEnterNearbyMedia() @@ -558,8 +556,11 @@ void LLStatusBar::onMouseEnterNearbyMedia() // show the master volume pull-down mPanelNearByMedia->setShape(nearby_media_rect); - mPanelNearByMedia->setVisible(TRUE); + LLUI::clearPopups(); + LLUI::addPopup(mPanelNearByMedia); + mPanelVolumePulldown->setVisible(FALSE); + mPanelNearByMedia->setVisible(TRUE); } @@ -648,18 +649,6 @@ void LLStatusBar::onClickStatGraph(void* data) LLFloaterReg::showInstance("lagmeter"); } -void LLStatusBar::onClickScreen(S32 x, S32 y) -{ - if (mPanelNearByMedia->getVisible()) - { - LLRect screen_rect = mPanelNearByMedia->calcScreenRect(); - if (!screen_rect.pointInRect(x, y)) - { - mPanelNearByMedia->setVisible(FALSE); - } - } -} - BOOL can_afford_transaction(S32 cost) { return((cost <= 0)||((gStatusBar) && (gStatusBar->getBalance() >=cost))); -- cgit v1.2.3 From 0bbcb0d22d2a215e0d8bf824b44a18a8bd948f20 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Wed, 3 Mar 2010 20:23:26 -0800 Subject: resizing and nesting of popups now work --- indra/newview/llstatusbar.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'indra/newview/llstatusbar.cpp') diff --git a/indra/newview/llstatusbar.cpp b/indra/newview/llstatusbar.cpp index 2ed0718e41..0a30ed0ecf 100644 --- a/indra/newview/llstatusbar.cpp +++ b/indra/newview/llstatusbar.cpp @@ -522,11 +522,11 @@ static void onClickScriptDebug(void*) void LLStatusBar::onMouseEnterVolume() { LLButton* volbtn = getChild( "volume_btn" ); - LLRect vol_btn_screen_rect = volbtn->calcScreenRect(); + LLRect vol_btn_rect = volbtn->getRect(); LLRect volume_pulldown_rect = mPanelVolumePulldown->getRect(); - volume_pulldown_rect.setLeftTopAndSize(vol_btn_screen_rect.mLeft - - (volume_pulldown_rect.getWidth() - vol_btn_screen_rect.getWidth())/2, - vol_btn_screen_rect.mBottom, + volume_pulldown_rect.setLeftTopAndSize(vol_btn_rect.mLeft - + (volume_pulldown_rect.getWidth() - vol_btn_rect.getWidth())/2, + vol_btn_rect.mBottom, volume_pulldown_rect.getWidth(), volume_pulldown_rect.getHeight()); @@ -545,7 +545,7 @@ void LLStatusBar::onMouseEnterNearbyMedia() LLView* popup_holder = gViewerWindow->getRootView()->getChildView("popup_holder"); LLRect nearby_media_rect = mPanelNearByMedia->getRect(); LLButton* nearby_media_btn = getChild( "media_toggle_btn" ); - LLRect nearby_media_btn_rect = nearby_media_btn->calcScreenRect(); + LLRect nearby_media_btn_rect = nearby_media_btn->getRect(); nearby_media_rect.setLeftTopAndSize(nearby_media_btn_rect.mLeft - (nearby_media_rect.getWidth() - nearby_media_btn_rect.getWidth())/2, nearby_media_btn_rect.mBottom, -- cgit v1.2.3