summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorLeslie Linden <none@none>2011-06-09 12:12:28 -0700
committerLeslie Linden <none@none>2011-06-09 12:12:28 -0700
commitdef85f2778d9b69bc3fb0e89c1cef854a1c01886 (patch)
treebfae24f88d2a2679d5812a9684b33a5750d946c6 /indra/llui
parent6e928645b94901518fe452ab7fab0278e87613d7 (diff)
EXP-865 FIX -- Modify LLBadge to allow it to hang off of non-buttons
LLBadgeOwner now only depends on LLView instead of LLUICtrl Sidebar Tab Buttons now can support badges Reviewed by Leyla
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llbadge.cpp8
-rw-r--r--indra/llui/llbadge.h5
-rw-r--r--indra/llui/llbadgeowner.cpp30
-rw-r--r--indra/llui/llbadgeowner.h6
-rw-r--r--indra/llui/llbutton.cpp2
5 files changed, 26 insertions, 25 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 ),