@@ -98,6 +98,7 @@ const LLSD LLScrollListCell::getAltValue() const
9898LLScrollListIcon::LLScrollListIcon (const LLScrollListCell::Params& p)
9999: LLScrollListCell(p),
100100 mIcon(LLUI::getUIImage(p.value().asString())),
101+ mIconSize(0 ),
101102 mColor(p.color),
102103 mAlignment(p.font_halign)
103104{}
@@ -140,37 +141,56 @@ void LLScrollListIcon::setValue(const LLSD& value)
140141 }
141142}
142143
143-
144144void LLScrollListIcon::setColor (const LLColor4& color)
145145{
146146 mColor = color;
147147}
148148
149+ void LLScrollListIcon::setIconSize (S32 size)
150+ {
151+ mIconSize = size;
152+ }
153+
149154S32 LLScrollListIcon::getWidth () const
150155{
151156 // if no specified fix width, use width of icon
152- if (LLScrollListCell::getWidth () == 0 && mIcon .notNull ())
157+ if (LLScrollListCell::getWidth () != 0 )
158+ {
159+ return LLScrollListCell::getWidth ();
160+ }
161+ if (mIconSize != 0 )
162+ {
163+ return mIconSize ;
164+ }
165+ if (mIcon .notNull ())
153166 {
154167 return mIcon ->getWidth ();
155168 }
156- return LLScrollListCell::getWidth () ;
169+ return 0 ;
157170}
158171
159172
160173void LLScrollListIcon::draw (const LLColor4& color, const LLColor4& highlight_color)
161174{
162175 if (mIcon )
163176 {
177+ S32 draw_width = mIcon ->getWidth ();
178+ S32 draw_height = mIcon ->getHeight ();
179+ if (mIconSize != 0 )
180+ {
181+ draw_width = mIconSize ;
182+ draw_height = mIconSize ;
183+ } // else will draw full icon even if cell is smaller
164184 switch (mAlignment )
165185 {
166186 case LLFontGL::LEFT:
167- mIcon ->draw (0 , 0 , mColor );
187+ mIcon ->draw (0 , 0 , draw_width, draw_height, mColor );
168188 break ;
169189 case LLFontGL::RIGHT:
170- mIcon ->draw (getWidth () - mIcon -> getWidth () , 0 , mColor );
190+ mIcon ->draw (getWidth () - draw_width , 0 , draw_width, draw_height , mColor );
171191 break ;
172192 case LLFontGL::HCENTER:
173- mIcon ->draw ((getWidth () - mIcon -> getWidth ()) / 2 , 0 , mColor );
193+ mIcon ->draw ((getWidth () - draw_width) / 2 , 0 , draw_width, draw_height , mColor );
174194 break ;
175195 default :
176196 break ;
0 commit comments