diff options
Diffstat (limited to 'indra')
| -rw-r--r-- | indra/llui/llbadge.cpp | 8 | ||||
| -rw-r--r-- | indra/llui/llbadge.h | 5 | ||||
| -rw-r--r-- | indra/llui/llbadgeowner.cpp | 30 | ||||
| -rw-r--r-- | indra/llui/llbadgeowner.h | 6 | ||||
| -rw-r--r-- | indra/llui/llbutton.cpp | 2 | ||||
| -rw-r--r-- | indra/newview/llsidetray.cpp | 17 | 
6 files changed, 40 insertions, 28 deletions
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp index e4c64e327e..53db226b20 100644 --- a/indra/llui/llbadge.cpp +++ b/indra/llui/llbadge.cpp @@ -178,16 +178,16 @@ void LLBadge::draw()  {  	if (!mLabel.empty())  	{ -		LLUICtrl* owner_ctrl = mOwner.get(); +		LLView* owner_view = mOwner.get(); -		if (owner_ctrl) +		if (owner_view)  		{  			//  			// Calculate badge position based on owner  			//  			LLRect owner_rect; -			owner_ctrl->localRectToOtherView(owner_ctrl->getLocalRect(), & owner_rect, this); +			owner_view->localRectToOtherView(owner_view->getLocalRect(), & owner_rect, this);  			F32 badge_center_x = owner_rect.mLeft + owner_rect.getWidth() * mLocationPercentHCenter;  			F32 badge_center_y = owner_rect.mBottom + owner_rect.getHeight() * mLocationPercentVCenter; @@ -230,7 +230,7 @@ void LLBadge::draw()  			}  			else  			{ -				lldebugs << "No image for badge " << getName() << " on owner " << owner_ctrl->getName() << llendl; +				lldebugs << "No image for badge " << getName() << " on owner " << owner_view->getName() << llendl;  				renderBadgeBackground(badge_center_x, badge_center_y,  									  badge_width, badge_height, diff --git a/indra/llui/llbadge.h b/indra/llui/llbadge.h index 05a76af42c..0f923ef01b 100644 --- a/indra/llui/llbadge.h +++ b/indra/llui/llbadge.h @@ -33,6 +33,7 @@  #include "lluictrl.h"  #include "llstring.h"  #include "lluiimage.h" +#include "llview.h"  //  // Declarations @@ -92,7 +93,7 @@ public:  	struct Params   	: public LLInitParam::Block<Params, LLUICtrl::Params>  	{ -		Optional< LLHandle<LLUICtrl> >	owner;	// Mandatory in code but not in xml +		Optional< LLHandle<LLView> >	owner;	// Mandatory in code but not in xml  		Optional< LLUIImage* >			border_image;  		Optional< LLUIColor >			border_color; @@ -144,7 +145,7 @@ private:  	F32						mLocationPercentHCenter;  	F32						mLocationPercentVCenter; -	LLHandle< LLUICtrl >	mOwner; +	LLHandle< LLView >		mOwner;  	F32						mPaddingHoriz;  	F32						mPaddingVert; diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index c77cf21ae0..11f1463b9b 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -33,9 +33,9 @@  // Classes  // -LLBadgeOwner::LLBadgeOwner(LLHandle<LLUICtrl> ctrlHandle) +LLBadgeOwner::LLBadgeOwner(LLHandle< LLView > viewHandle)  	: mBadge(NULL) -	, mBadgeOwnerCtrl(ctrlHandle) +	, mBadgeOwnerView(viewHandle)  {  } @@ -64,7 +64,7 @@ void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label)  		// Push the badge to the front so it renders on top  		// -		LLUICtrl * parent = mBadge->getParentUICtrl(); +		LLView * parent = mBadge->getParent();  		if (parent)  		{ @@ -75,34 +75,34 @@ void LLBadgeOwner::setBadgeLabel(const LLStringExplicit& label)  void LLBadgeOwner::addBadgeToParentPanel()  { -	if (mBadge && mBadgeOwnerCtrl.get()) +	LLView * owner_view = mBadgeOwnerView.get(); +	 +	if (mBadge && owner_view)  	{  		// Find the appropriate parent panel for the badge -		LLUICtrl * owner_ctrl = mBadgeOwnerCtrl.get(); -		LLUICtrl * parent = owner_ctrl->getParentUICtrl(); - -		LLPanel * parentPanel = NULL; +		LLView * parent = owner_view->getParent(); +		LLPanel * parent_panel = NULL;  		while (parent)  		{ -			parentPanel = dynamic_cast<LLPanel *>(parent); +			parent_panel = dynamic_cast<LLPanel *>(parent); -			if (parentPanel && parentPanel->acceptsBadge()) +			if (parent_panel && parent_panel->acceptsBadge())  			{  				break;  			} -			parent = parent->getParentUICtrl(); +			parent = parent->getParent();  		} -		if (parentPanel) +		if (parent_panel)  		{ -			parentPanel->addChild(mBadge); +			parent_panel->addChild(mBadge);  		}  		else  		{ -			llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on ui control " << owner_ctrl->getName() << llendl; +			llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on " << owner_view->getName() << llendl;  		}  	}  } @@ -110,7 +110,7 @@ void LLBadgeOwner::addBadgeToParentPanel()  LLBadge* LLBadgeOwner::createBadge(const LLBadge::Params& p)  {  	LLBadge::Params badge_params(p); -	badge_params.owner = mBadgeOwnerCtrl; +	badge_params.owner = mBadgeOwnerView;  	return LLUICtrlFactory::create<LLBadge>(badge_params);  } diff --git a/indra/llui/llbadgeowner.h b/indra/llui/llbadgeowner.h index 7b2bbe01fd..456ef90c13 100644 --- a/indra/llui/llbadgeowner.h +++ b/indra/llui/llbadgeowner.h @@ -28,7 +28,7 @@  #define LL_LLBADGEOWNER_H  #include "llbadge.h" -#include "lluictrl.h" +#include "llview.h"  //  // Classes @@ -38,7 +38,7 @@ class LLBadgeOwner  {  public: -	LLBadgeOwner(LLHandle<LLUICtrl> ctrlHandle); +	LLBadgeOwner(LLHandle< LLView > viewHandle);  	void initBadgeParams(const LLBadge::Params& p);  	void addBadgeToParentPanel(); @@ -52,7 +52,7 @@ private:  private:  	LLBadge*			mBadge; -	LLHandle<LLUICtrl>	mBadgeOwnerCtrl; +	LLHandle< LLView >	mBadgeOwnerView;  };  #endif  // LL_LLBADGEOWNER_H diff --git a/indra/llui/llbutton.cpp b/indra/llui/llbutton.cpp index 907dc31721..637024e513 100644 --- a/indra/llui/llbutton.cpp +++ b/indra/llui/llbutton.cpp @@ -110,7 +110,7 @@ LLButton::Params::Params()  LLButton::LLButton(const LLButton::Params& p)  :	LLUICtrl(p), -	LLBadgeOwner(getUICtrlHandle()), +	LLBadgeOwner(LLView::getHandle()),  	mMouseDownFrame(0),  	mMouseHeldDownCount(0),  	mBorderEnabled( FALSE ), diff --git a/indra/newview/llsidetray.cpp b/indra/newview/llsidetray.cpp index 631b244785..fe3f2568bc 100644 --- a/indra/newview/llsidetray.cpp +++ b/indra/newview/llsidetray.cpp @@ -30,6 +30,7 @@  #include "llagentcamera.h"  #include "llappviewer.h" +#include "llbadgeowner.h"  #include "llbottomtray.h"  #include "llfloaterreg.h"  #include "llfirstuse.h" @@ -98,7 +99,7 @@ bool	LLSideTray::instanceCreated	()  // Represents a single tab in the side tray, only used by LLSideTray  ////////////////////////////////////////////////////////////////////////////// -class LLSideTrayTab: public LLPanel +class LLSideTrayTab: public LLPanel, public LLBadgeOwner  {  	LOG_CLASS(LLSideTrayTab);  	friend class LLUICtrlFactory; @@ -113,11 +114,14 @@ public:  		Optional<std::string>		image_selected;  		Optional<std::string>		tab_title;  		Optional<std::string>		description; +		Optional<LLBadge::Params>	badge; +		  		Params()  		:	image("image"),  			image_selected("image_selected"),  			tab_title("tab_title","no title"), -			description("description","no description") +			description("description","no description"), +			badge("badge")  		{};  	};  protected: @@ -162,12 +166,17 @@ private:  LLSideTrayTab::LLSideTrayTab(const Params& p)  :	LLPanel(), +	LLBadgeOwner(LLView::getHandle()),  	mTabTitle(p.tab_title),  	mImage(p.image),  	mImageSelected(p.image_selected),  	mDescription(p.description),  	mMainPanel(NULL)  { +	if (p.badge.isProvided()) +	{ +		LLBadgeOwner::initBadgeParams(p.badge()); +	}  }  LLSideTrayTab::~LLSideTrayTab() @@ -196,7 +205,9 @@ BOOL LLSideTrayTab::postBuild()  	getChild<LLButton>("undock")->setCommitCallback(boost::bind(&LLSideTrayTab::setDocked, this, false));  	getChild<LLButton>("dock")->setCommitCallback(boost::bind(&LLSideTrayTab::setDocked, this, true)); -	return true; +	addBadgeToParentPanel(); + +	return LLPanel::postBuild();  }  static const S32 splitter_margin = 1;  | 
