diff options
author | Richard Nelson <richard@lindenlab.com> | 2011-07-20 20:18:12 -0700 |
---|---|---|
committer | Richard Nelson <richard@lindenlab.com> | 2011-07-20 20:18:12 -0700 |
commit | 95da8c81f3d5afd8d888589398028883e6647333 (patch) | |
tree | c05f27cff294a5ad1a508cc2c8716bc696c8f9ce /indra/llui/llbadgeowner.cpp | |
parent | 4dc0850da7469906e5ad052da71830b05005295b (diff) | |
parent | fecf706f1be58f76df81f8bc1a4a5f3307cee6ff (diff) |
Automated merge with http://hg.secondlife.com/viewer-development
Diffstat (limited to 'indra/llui/llbadgeowner.cpp')
-rw-r--r-- | indra/llui/llbadgeowner.cpp | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/indra/llui/llbadgeowner.cpp b/indra/llui/llbadgeowner.cpp index 77f15567bf..1860a05edd 100644 --- a/indra/llui/llbadgeowner.cpp +++ b/indra/llui/llbadgeowner.cpp @@ -26,6 +26,7 @@ #include "linden_common.h" +#include "llbadgeholder.h" #include "llbadgeowner.h" #include "llpanel.h" @@ -81,40 +82,44 @@ void LLBadgeOwner::setBadgeVisibility(bool visible) } } -void LLBadgeOwner::addBadgeToParentPanel() +bool LLBadgeOwner::addBadgeToParentPanel() { + bool badge_added = false; + LLView * owner_view = mBadgeOwnerView.get(); if (mBadge && owner_view) { - // Badge parent is badge owner by default - LLView * badge_parent = owner_view; + LLBadgeHolder * badge_holder = NULL; - // Find the appropriate parent for the badge + // Find the appropriate holder for the badge LLView * parent = owner_view->getParent(); while (parent) { - LLPanel * parent_panel = dynamic_cast<LLPanel *>(parent); + LLBadgeHolder * badge_holder_panel = dynamic_cast<LLBadgeHolder *>(parent); - if (parent_panel && parent_panel->acceptsBadge()) + if (badge_holder_panel && badge_holder_panel->acceptsBadge()) { - badge_parent = parent; + badge_holder = badge_holder_panel; break; } parent = parent->getParent(); } - if (badge_parent) + if (badge_holder) { - badge_parent->addChild(mBadge); + badge_added = badge_holder->addBadge(mBadge); } else { - llwarns << "Unable to find parent panel for badge " << mBadge->getName() << " on " << owner_view->getName() << llendl; + // Badge parent is fallback badge owner if no valid holder exists in the hierarchy + badge_added = mBadge->addToView(owner_view); } } + + return badge_added; } LLBadge* LLBadgeOwner::createBadge(const LLBadge::Params& p) |