summaryrefslogtreecommitdiff
path: root/indra/llui
diff options
context:
space:
mode:
authorBrad Linden <brad@lindenlab.com>2023-04-26 15:38:47 -0700
committerBrad Linden <brad@lindenlab.com>2023-04-26 15:38:47 -0700
commit369945b45da4697735bea7e925d87c65d90b2a5a (patch)
tree1c3d9af52d8e082b589085a87acad2d8a3f6ecd4 /indra/llui
parent9f3f23ffa2ac487741be305068002536b872b015 (diff)
parent162a825dd59c23c9b475d75e0bd5169f3573267b (diff)
Merge remote-tracking branch 'origin/DRTVWR-539' into DRTVWR-559-merge-539
Diffstat (limited to 'indra/llui')
-rw-r--r--indra/llui/llscrolllistcell.cpp72
-rw-r--r--indra/llui/llscrolllistcell.h22
2 files changed, 94 insertions, 0 deletions
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index 8dd552d2ad..f73c9aa539 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -54,6 +54,10 @@ LLScrollListCell* LLScrollListCell::create(const LLScrollListCell::Params& cell_
{
cell = new LLScrollListIconText(cell_p);
}
+ else if (cell_p.type() == "bar")
+ {
+ cell = new LLScrollListBar(cell_p);
+ }
else // default is "text"
{
cell = new LLScrollListText(cell_p);
@@ -174,6 +178,74 @@ void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_col
}
//
+// LLScrollListBar
+//
+LLScrollListBar::LLScrollListBar(const LLScrollListCell::Params& p)
+ : LLScrollListCell(p),
+ mRatio(0),
+ mColor(p.color),
+ mBottom(1),
+ mLeftPad(1),
+ mRightPad(1)
+{}
+
+LLScrollListBar::~LLScrollListBar()
+{
+}
+
+/*virtual*/
+S32 LLScrollListBar::getHeight() const
+{
+ return LLScrollListCell::getHeight();
+}
+
+/*virtual*/
+const LLSD LLScrollListBar::getValue() const
+{
+ return LLStringUtil::null;
+}
+
+void LLScrollListBar::setValue(const LLSD& value)
+{
+ if (value.has("ratio"))
+ {
+ mRatio = value["ratio"].asReal();
+ }
+ if (value.has("bottom"))
+ {
+ mBottom = value["bottom"].asInteger();
+ }
+ if (value.has("left_pad"))
+ {
+ mLeftPad = value["left_pad"].asInteger();
+ }
+ if (value.has("right_pad"))
+ {
+ mRightPad = value["right_pad"].asInteger();
+ }
+}
+
+void LLScrollListBar::setColor(const LLColor4& color)
+{
+ mColor = color;
+}
+
+S32 LLScrollListBar::getWidth() const
+{
+ return LLScrollListCell::getWidth();
+}
+
+
+void LLScrollListBar::draw(const LLColor4& color, const LLColor4& highlight_color) const
+{
+ S32 bar_width = getWidth() - mLeftPad - mRightPad;
+ S32 left = bar_width - bar_width * mRatio;
+ left = llclamp(left, mLeftPad, getWidth() - mRightPad - 1);
+
+ gl_rect_2d(left, mBottom, getWidth() - mRightPad, mBottom - 1, mColor);
+}
+
+//
// LLScrollListText
//
U32 LLScrollListText::sCount = 0;
diff --git a/indra/llui/llscrolllistcell.h b/indra/llui/llscrolllistcell.h
index ede8d847d9..2588da2331 100644
--- a/indra/llui/llscrolllistcell.h
+++ b/indra/llui/llscrolllistcell.h
@@ -33,6 +33,7 @@
#include "lluistring.h"
#include "v4color.h"
#include "llui.h"
+#include "llgltexture.h"
class LLCheckBoxCtrl;
class LLSD;
@@ -159,6 +160,7 @@ public:
void setText(const LLStringExplicit& text);
void setFontStyle(const U8 font_style);
+ void setAlignment(LLFontGL::HAlign align) { mFontAlignment = align; }
protected:
LLUIString mText;
@@ -199,6 +201,26 @@ private:
LLFontGL::HAlign mAlignment;
};
+
+class LLScrollListBar : public LLScrollListCell
+{
+public:
+ LLScrollListBar(const LLScrollListCell::Params& p);
+ /*virtual*/ ~LLScrollListBar();
+ /*virtual*/ void draw(const LLColor4& color, const LLColor4& highlight_color) const;
+ /*virtual*/ S32 getWidth() const;
+ /*virtual*/ S32 getHeight() const;
+ /*virtual*/ const LLSD getValue() const;
+ /*virtual*/ void setColor(const LLColor4&);
+ /*virtual*/ void setValue(const LLSD& value);
+
+private:
+ LLColor4 mColor;
+ F32 mRatio;
+ S32 mBottom;
+ S32 mRightPad;
+ S32 mLeftPad;
+};
/*
* An interactive cell containing a check box.
*/