summaryrefslogtreecommitdiff
path: root/indra/llui/llscrolllistcell.cpp
diff options
context:
space:
mode:
authorErik Kundiman <erik@megapahit.org>2025-12-04 13:58:12 +0800
committerErik Kundiman <erik@megapahit.org>2025-12-04 16:48:50 +0800
commite3a35af2c676fb211ff7d01a79eb1a3299bc82f3 (patch)
tree0ff7a0a15d1a53850399250b65f0a2a42f7bbf22 /indra/llui/llscrolllistcell.cpp
parentac052bed7f9f97efc63f0a0322214d4dcdcd5664 (diff)
parentc4ec3d866082d588de671e833413474d7ab19524 (diff)
Merge remote-tracking branch 'secondlife/release/2026.01' into 2026.01
Diffstat (limited to 'indra/llui/llscrolllistcell.cpp')
-rw-r--r--indra/llui/llscrolllistcell.cpp32
1 files changed, 26 insertions, 6 deletions
diff --git a/indra/llui/llscrolllistcell.cpp b/indra/llui/llscrolllistcell.cpp
index a3108d77e8..bdf88768c3 100644
--- a/indra/llui/llscrolllistcell.cpp
+++ b/indra/llui/llscrolllistcell.cpp
@@ -98,6 +98,7 @@ const LLSD LLScrollListCell::getAltValue() const
LLScrollListIcon::LLScrollListIcon(const LLScrollListCell::Params& p)
: LLScrollListCell(p),
mIcon(LLUI::getUIImage(p.value().asString())),
+ mIconSize(0),
mColor(p.color),
mAlignment(p.font_halign)
{}
@@ -140,20 +141,32 @@ void LLScrollListIcon::setValue(const LLSD& value)
}
}
-
void LLScrollListIcon::setColor(const LLColor4& color)
{
mColor = color;
}
+void LLScrollListIcon::setIconSize(S32 size)
+{
+ mIconSize = size;
+}
+
S32 LLScrollListIcon::getWidth() const
{
// if no specified fix width, use width of icon
- if (LLScrollListCell::getWidth() == 0 && mIcon.notNull())
+ if (LLScrollListCell::getWidth() != 0)
+ {
+ return LLScrollListCell::getWidth();
+ }
+ if (mIconSize != 0)
+ {
+ return mIconSize;
+ }
+ if (mIcon.notNull())
{
return mIcon->getWidth();
}
- return LLScrollListCell::getWidth();
+ return 0;
}
@@ -161,16 +174,23 @@ void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_col
{
if (mIcon)
{
+ S32 draw_width = mIcon->getWidth();
+ S32 draw_height = mIcon->getHeight();
+ if (mIconSize != 0)
+ {
+ draw_width = mIconSize;
+ draw_height = mIconSize;
+ } // else will draw full icon even if cell is smaller
switch(mAlignment)
{
case LLFontGL::LEFT:
- mIcon->draw(0, 0, mColor);
+ mIcon->draw(0, 0, draw_width, draw_height, mColor);
break;
case LLFontGL::RIGHT:
- mIcon->draw(getWidth() - mIcon->getWidth(), 0, mColor);
+ mIcon->draw(getWidth() - draw_width, 0, draw_width, draw_height, mColor);
break;
case LLFontGL::HCENTER:
- mIcon->draw((getWidth() - mIcon->getWidth()) / 2, 0, mColor);
+ mIcon->draw((getWidth() - draw_width) / 2, 0, draw_width, draw_height, mColor);
break;
default:
break;