diff options
Diffstat (limited to 'indra/llui/llscrolllistcell.cpp')
-rw-r--r-- | indra/llui/llscrolllistcell.cpp | 24 |
1 files changed, 18 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 |