diff options
Diffstat (limited to 'indra/llui')
-rw-r--r-- | indra/llui/llscrolllistcell.cpp | 24 | ||||
-rw-r--r-- | indra/llui/llscrolllistcell.h | 2 |
2 files changed, 20 insertions, 6 deletions
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp index 0a33ee8878..d6627a6957 100644 --- a/indra/llui/llscrolllistcell.cpp +++ b/indra/llui/llscrolllistcell.cpp @@ -196,7 +196,14 @@ LLScrollListText::LLScrollListText(const LLScrollListCell::Params& p) void LLScrollListText::highlightText(S32 offset, S32 num_chars) { mHighlightOffset = offset; - mHighlightCount = num_chars; + mHighlightCount = llmax(0, num_chars); +} + +//virtual +void LLScrollListText::setHighlighted(bool highlighted) +{ + mHighlightOffset = 0; + mHighlightCount = highlighted ? -1 : 0; } //virtual @@ -296,6 +303,7 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col if (mHighlightCount > 0) { + // Highlight text S32 left = 0; switch(mFontAlignment) { @@ -314,11 +322,15 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, 1); mRoundedRectImage->draw(highlight_rect, highlight_color); - /*LLRect highlight_rect(left - 2, - mFont->getLineHeight() + 2, - left + getWidth() + 2, - 1); - mRoundedRectImage->draw(highlight_rect, LLColor4::black);*/ + } + else if (mHighlightCount < 0) + { + // Highlight whole cell + LLRect highlight_rect(0, + getHeight(), + getWidth() - 1, + -1); + gl_rect_2d(highlight_rect, LLColor4(0.38f, 0.694f, 0.573f, 0.35f)); } // Try to draw the entire string diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h index 1604a9b1dc..b4bb14bcf1 100644 --- a/indra/llui/llscrolllistcell.h +++ b/indra/llui/llscrolllistcell.h @@ -103,6 +103,7 @@ public: virtual BOOL getVisible() const { return TRUE; } virtual void setWidth(S32 width) { mWidth = width; } virtual void highlightText(S32 offset, S32 num_chars) {} + virtual void setHighlighted(bool highlighted) {} virtual BOOL isText() const { return FALSE; } virtual BOOL needsToolTip() const { return ! mToolTip.empty(); } virtual void setColor(const LLColor4&) {} @@ -140,6 +141,7 @@ public: /*virtual*/ const LLSD getValue() const; /*virtual*/ BOOL getVisible() const; /*virtual*/ void highlightText(S32 offset, S32 num_chars); + /*virtual*/ void setHighlighted(bool highlighted); /*virtual*/ void setColor(const LLColor4&); /*virtual*/ BOOL isText() const; |