summaryrefslogtreecommitdiff
path: root/indra/llui/llbadge.cpp
diff options
context:
space:
mode:
authorNyx (Neal Orman) <nyx@lindenlab.com>2011-08-15 11:41:00 -0400
committerNyx (Neal Orman) <nyx@lindenlab.com>2011-08-15 11:41:00 -0400
commit402a2de7651105d63693deb2872dd6646dd1bd85 (patch)
tree5b0935f876e954a024227355c34a2c23eebe1b8d /indra/llui/llbadge.cpp
parent60d15f78e17a2203d73d58c3f1c2af941d599277 (diff)
parent6b70273603e4aa807662c301179d05a1f2f5a224 (diff)
merging latest viewer-mesh into nyx's sidebranch
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.)