summaryrefslogtreecommitdiff
path: root/indra/llui/llbadge.cpp
diff options
context:
space:
mode:
authorMerov Linden <merov@lindenlab.com>2011-08-04 15:45:48 -0700
committerMerov Linden <merov@lindenlab.com>2011-08-04 15:45:48 -0700
commit7cc7d143837f2b75f750c139e33fdf5afa8a8866 (patch)
tree7e37843f06cdd1f163258b5686ac29943aa8558d /indra/llui/llbadge.cpp
parent1b46240ed84e2847dbf7da0d67c67940b646448c (diff)
parent0b81c19cbe809f041e628da334c305ea33fae2e9 (diff)
Sync with viewer-development
Diffstat (limited to 'indra/llui/llbadge.cpp')
-rw-r--r--indra/llui/llbadge.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/indra/llui/llbadge.cpp b/indra/llui/llbadge.cpp
index c28a947a7f..fde3c53a65 100644
--- a/indra/llui/llbadge.cpp
+++ b/indra/llui/llbadge.cpp
@@ -43,6 +43,8 @@ LLBadge::Params::Params()
, image_color("image_color")
, label("label")
, label_color("label_color")
+ , label_offset_horiz("label_offset_horiz")
+ , label_offset_vert("label_offset_vert")
, location("location", LLRelPos::TOP_LEFT)
, location_percent_hcenter("location_percent_hcenter")
, location_percent_vcenter("location_percent_vcenter")
@@ -65,6 +67,8 @@ bool LLBadge::Params::equals(const Params& a) const
comp &= (image_color() == a.image_color());
comp &= (label() == a.label());
comp &= (label_color() == a.label_color());
+ comp &= (label_offset_horiz() == a.label_offset_horiz());
+ comp &= (label_offset_vert() == a.label_offset_vert());
comp &= (location() == a.location());
comp &= (location_percent_hcenter() == a.location_percent_hcenter());
comp &= (location_percent_vcenter() == a.location_percent_vcenter());
@@ -84,6 +88,8 @@ LLBadge::LLBadge(const LLBadge::Params& p)
, mImageColor(p.image_color)
, mLabel(p.label)
, mLabelColor(p.label_color)
+ , mLabelOffsetHoriz(p.label_offset_horiz)
+ , mLabelOffsetVert(p.label_offset_vert)
, mLocation(p.location)
, mLocationPercentHCenter(0.5f)
, mLocationPercentVCenter(0.5f)
@@ -131,6 +137,18 @@ LLBadge::~LLBadge()
{
}
+bool LLBadge::addToView(LLView * view)
+{
+ bool child_added = view->addChild(this);
+
+ if (child_added)
+ {
+ setShape(view->getLocalRect());
+ }
+
+ return child_added;
+}
+
void LLBadge::setLabel(const LLStringExplicit& label)
{
mLabel = label;
@@ -241,8 +259,10 @@ void LLBadge::draw()
// Draw the label
//
- mGLFont->render(badge_label_wstring, badge_label_begin_offset,
- badge_center_x, badge_center_y,
+ mGLFont->render(badge_label_wstring,
+ badge_label_begin_offset,
+ badge_center_x + mLabelOffsetHoriz,
+ badge_center_y + mLabelOffsetVert,
mLabelColor % alpha,
LLFontGL::HCENTER, LLFontGL::VCENTER, // centered around the position
LLFontGL::NORMAL, // normal text (not bold, italics, etc.)