summaryrefslogtreecommitdiff
path: root/indra/llui/llbadgeowner.cpp
diff options
context:
space:
mode:
authorDave Parks <davep@lindenlab.com>2012-03-09 15:50:51 -0600
committerDave Parks <davep@lindenlab.com>2012-03-09 15:50:51 -0600
commit8e60cdb3335ec198c71b29d37ab08c4aff9f8223 (patch)
tree2e043ee721d725dcc8d654a8f51eaafaaeb423de /indra/llui/llbadgeowner.cpp
parent1d200c56e151eb8fc384693175d1b9318ff0f919 (diff)
parent4b20d72a991cfebaf5765fe7756190f4a9645a3b (diff)
merge
Diffstat (limited to 'indra/llui/llbadgeowner.cpp')
-rw-r--r--indra/llui/llbadgeowner.cpp25
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)