aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/llui/llscrolllistctrl.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:45:42 -0500
committerJacek Antonelli2008-08-15 23:45:42 -0500
commitce28e056c20bf2723f565bbf464b87781ec248a2 (patch)
treeef7b0501c4de4b631a916305cbc2a5fdc125e52d /linden/indra/llui/llscrolllistctrl.cpp
parentSecond Life viewer sources 1.19.1.4b (diff)
downloadmeta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.zip
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.gz
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.bz2
meta-impy-ce28e056c20bf2723f565bbf464b87781ec248a2.tar.xz
Second Life viewer sources 1.20.2
Diffstat (limited to 'linden/indra/llui/llscrolllistctrl.cpp')
-rw-r--r--linden/indra/llui/llscrolllistctrl.cpp288
1 files changed, 162 insertions, 126 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp
index 01c37d9..2066819 100644
--- a/linden/indra/llui/llscrolllistctrl.cpp
+++ b/linden/indra/llui/llscrolllistctrl.cpp
@@ -55,10 +55,11 @@
55#include "llkeyboard.h" 55#include "llkeyboard.h"
56#include "llresizebar.h" 56#include "llresizebar.h"
57 57
58const S32 LIST_BORDER_PAD = 0; // white space inside the border and to the left of the scrollbar
59const S32 MIN_COLUMN_WIDTH = 20; 58const S32 MIN_COLUMN_WIDTH = 20;
60const S32 LIST_SNAP_PADDING = 5; 59const S32 LIST_SNAP_PADDING = 5;
61 60
61static LLRegisterWidget<LLScrollListCtrl> r("scroll_list");
62
62// local structures & classes. 63// local structures & classes.
63struct SortScrollListItem 64struct SortScrollListItem
64{ 65{
@@ -68,37 +69,26 @@ struct SortScrollListItem
68 69
69 bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2) 70 bool operator()(const LLScrollListItem* i1, const LLScrollListItem* i2)
70 { 71 {
71 if ( mSortOrders.empty() ) return true; 72 if ( mSortOrders.empty() )
72 73 return i1 < i2;
73 const LLScrollListCell *cell1 = NULL;
74 const LLScrollListCell *cell2 = NULL;
75
76 sort_order_t::const_reverse_iterator end_it = mSortOrders.rend();
77 sort_order_t::const_reverse_iterator it;
78 74
79 // sort over all columns in order specified by mSortOrders 75 // sort over all columns in order specified by mSortOrders
80 S32 sort_result = 0; 76 S32 sort_result = 0;
81 for (it = mSortOrders.rbegin(); it != end_it; ++it) 77 for (sort_order_t::const_reverse_iterator it = mSortOrders.rbegin();
78 it != mSortOrders.rend(); ++it)
82 { 79 {
83 S32 col_idx = it->first; 80 S32 col_idx = it->first;
84 BOOL sort_ascending = it->second; 81 BOOL sort_ascending = it->second;
85 82
86 cell1 = i1->getColumn(col_idx); 83 const LLScrollListCell *cell1 = i1->getColumn(col_idx);
87 cell2 = i2->getColumn(col_idx); 84 const LLScrollListCell *cell2 = i2->getColumn(col_idx);
88 // ascending or descending sort for this column? 85 S32 order = sort_ascending ? 1 : -1; // ascending or descending sort for this column?
89 S32 order = 1;
90 if (!sort_ascending)
91 {
92 order = -1;
93 }
94
95 if (cell1 && cell2) 86 if (cell1 && cell2)
96 { 87 {
97 sort_result = (order * LLString::compareDict(cell1->getValue().asString(), cell2->getValue().asString())); 88 sort_result = order * LLString::compareDict(cell1->getValue().asString(), cell2->getValue().asString());
98 if (sort_result != 0) 89 if (sort_result != 0)
99 { 90 {
100 // we have a sort order! 91 break; // we have a sort order!
101 break;
102 } 92 }
103 } 93 }
104 } 94 }
@@ -114,24 +104,49 @@ struct SortScrollListItem
114// 104//
115// LLScrollListIcon 105// LLScrollListIcon
116// 106//
117LLScrollListIcon::LLScrollListIcon(const LLUUID& icon_id, S32 width) 107LLScrollListIcon::LLScrollListIcon(LLUIImagePtr icon, S32 width)
108 : LLScrollListCell(width),
109 mIcon(icon),
110 mColor(LLColor4::white)
111{
112}
113
114LLScrollListIcon::LLScrollListIcon(const LLSD& value, S32 width)
118 : LLScrollListCell(width), 115 : LLScrollListCell(width),
119 mColor(LLColor4::white), 116 mColor(LLColor4::white)
120 mImageUUID(icon_id)
121{ 117{
122 // don't use default image specified by LLUUID::null, use no image in that case 118 setValue(value);
123 mIcon = icon_id.isNull() ? NULL : LLUI::sImageProvider->getImageByID(icon_id);
124} 119}
125 120
121
126LLScrollListIcon::~LLScrollListIcon() 122LLScrollListIcon::~LLScrollListIcon()
127{ 123{
128} 124}
129 125
130void LLScrollListIcon::setValue(const LLSD& value) 126void LLScrollListIcon::setValue(const LLSD& value)
131{ 127{
132 mImageUUID = value.asUUID(); 128 if (value.isUUID())
133 // don't use default image specified by LLUUID::null, use no image in that case 129 {
134 mIcon = mImageUUID.isNull() ? NULL : LLUI::sImageProvider->getImageByID(mImageUUID); 130 // don't use default image specified by LLUUID::null, use no image in that case
131 LLUUID image_id = value.asUUID();
132 mIcon = image_id.notNull() ? LLUI::sImageProvider->getUIImageByID(image_id) : LLUIImagePtr(NULL);
133 }
134 else
135 {
136 LLString value_string = value.asString();
137 if (LLUUID::validate(value_string))
138 {
139 setValue(LLUUID(value_string));
140 }
141 else if (!value_string.empty())
142 {
143 mIcon = LLUI::getUIImage(value.asString());
144 }
145 else
146 {
147 mIcon = NULL;
148 }
149 }
135} 150}
136 151
137 152
@@ -143,7 +158,7 @@ void LLScrollListIcon::setColor(const LLColor4& color)
143S32 LLScrollListIcon::getWidth() const 158S32 LLScrollListIcon::getWidth() const
144{ 159{
145 // if no specified fix width, use width of icon 160 // if no specified fix width, use width of icon
146 if (LLScrollListCell::getWidth() == 0) 161 if (LLScrollListCell::getWidth() == 0 && mIcon.notNull())
147 { 162 {
148 return mIcon->getWidth(); 163 return mIcon->getWidth();
149 } 164 }
@@ -151,11 +166,11 @@ S32 LLScrollListIcon::getWidth() const
151} 166}
152 167
153 168
154void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color) const 169void LLScrollListIcon::draw(const LLColor4& color, const LLColor4& highlight_color) const
155{ 170{
156 if (mIcon) 171 if (mIcon)
157 { 172 {
158 gl_draw_image(0, 0, mIcon, mColor); 173 mIcon->draw(0, 0, mColor);
159 } 174 }
160} 175}
161 176
@@ -206,6 +221,13 @@ LLScrollListSeparator::LLScrollListSeparator(S32 width) : LLScrollListCell(width
206{ 221{
207} 222}
208 223
224//virtual
225S32 LLScrollListSeparator::getHeight() const
226{
227 return 5;
228}
229
230
209void LLScrollListSeparator::draw(const LLColor4& color, const LLColor4& highlight_color) const 231void LLScrollListSeparator::draw(const LLColor4& color, const LLColor4& highlight_color) const
210{ 232{
211 //*FIXME: use dynamic item heights and make separators narrow, and inactive 233 //*FIXME: use dynamic item heights and make separators narrow, and inactive
@@ -234,9 +256,34 @@ LLScrollListText::LLScrollListText( const LLString& text, const LLFontGL* font,
234 // initialize rounded rect image 256 // initialize rounded rect image
235 if (!mRoundedRectImage) 257 if (!mRoundedRectImage)
236 { 258 {
237 mRoundedRectImage = LLUI::sImageProvider->getImageByID(LLUUID(LLUI::sAssetsGroup->getString("rounded_square.tga"))); 259 mRoundedRectImage = LLUI::sImageProvider->getUIImage("rounded_square.tga");
238 } 260 }
239} 261}
262//virtual
263void LLScrollListText::highlightText(S32 offset, S32 num_chars)
264{
265 mHighlightOffset = offset;
266 mHighlightCount = num_chars;
267}
268
269//virtual
270BOOL LLScrollListText::isText() const
271{
272 return TRUE;
273}
274
275//virtual
276BOOL LLScrollListText::getVisible() const
277{
278 return mVisible;
279}
280
281//virtual
282S32 LLScrollListText::getHeight() const
283{
284 return llround(mFont->getLineHeight());
285}
286
240 287
241LLScrollListText::~LLScrollListText() 288LLScrollListText::~LLScrollListText()
242{ 289{
@@ -266,6 +313,13 @@ void LLScrollListText::setValue(const LLSD& text)
266 setText(text.asString()); 313 setText(text.asString());
267} 314}
268 315
316//virtual
317const LLSD LLScrollListText::getValue() const
318{
319 return LLSD(mText.getString());
320}
321
322
269void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const 323void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_color) const
270{ 324{
271 LLColor4 display_color; 325 LLColor4 display_color;
@@ -280,8 +334,6 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
280 334
281 if (mHighlightCount > 0) 335 if (mHighlightCount > 0)
282 { 336 {
283 mRoundedRectImage->bind();
284 gGL.color4fv(highlight_color.mV);
285 S32 left = 0; 337 S32 left = 0;
286 switch(mFontAlignment) 338 switch(mFontAlignment)
287 { 339 {
@@ -295,13 +347,11 @@ void LLScrollListText::draw(const LLColor4& color, const LLColor4& highlight_col
295 left = (getWidth() - mFont->getWidth(mText.getString())) / 2; 347 left = (getWidth() - mFont->getWidth(mText.getString())) / 2;
296 break; 348 break;
297 } 349 }
298 gl_segmented_rect_2d_tex(left - 2, 350 LLRect highlight_rect(left - 2,
299 llround(mFont->getLineHeight()) + 1, 351 llround(mFont->getLineHeight()) + 1,
300 left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1, 352 left + mFont->getWidth(mText.getString(), mHighlightOffset, mHighlightCount) + 1,
301 1, 353 1);
302 mRoundedRectImage->getWidth(), 354 mRoundedRectImage->draw(highlight_rect, highlight_color);
303 mRoundedRectImage->getHeight(),
304 16);
305 } 355 }
306 356
307 // Try to draw the entire string 357 // Try to draw the entire string
@@ -389,8 +439,6 @@ void LLScrollListItem::draw(const LLRect& rect, const LLColor4& fg_color, const
389{ 439{
390 // draw background rect 440 // draw background rect
391 LLRect bg_rect = rect; 441 LLRect bg_rect = rect;
392 // pad background rectangle to separate it from contents
393 bg_rect.stretch(LIST_BORDER_PAD, 0);
394 { 442 {
395 LLGLSNoTexture no_texture; 443 LLGLSNoTexture no_texture;
396 gGL.color4fv(bg_color.mV); 444 gGL.color4fv(bg_color.mV);
@@ -432,7 +480,7 @@ LLScrollListItemComment::LLScrollListItemComment(const LLString& comment_string,
432: LLScrollListItem(FALSE), 480: LLScrollListItem(FALSE),
433 mColor(color) 481 mColor(color)
434{ 482{
435 addColumn( comment_string, gResMgr->getRes( LLFONT_SANSSERIF_SMALL ) ); 483 addColumn( comment_string, LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ) );
436} 484}
437 485
438void LLScrollListItemComment::draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding) 486void LLScrollListItemComment::draw(const LLRect& rect, const LLColor4& fg_color, const LLColor4& bg_color, const LLColor4& highlight_color, S32 column_padding)
@@ -541,10 +589,10 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
541 mDrewSelected(FALSE) 589 mDrewSelected(FALSE)
542{ 590{
543 mItemListRect.setOriginAndSize( 591 mItemListRect.setOriginAndSize(
544 mBorderThickness + LIST_BORDER_PAD, 592 mBorderThickness,
545 mBorderThickness + LIST_BORDER_PAD, 593 mBorderThickness,
546 getRect().getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ), 594 getRect().getWidth() - 2 * mBorderThickness,
547 getRect().getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) ); 595 getRect().getHeight() - 2 * mBorderThickness );
548 596
549 updateLineHeight(); 597 updateLineHeight();
550 598
@@ -738,10 +786,10 @@ void LLScrollListCtrl::updateLayout()
738 // reserve room for column headers, if needed 786 // reserve room for column headers, if needed
739 S32 heading_size = (mDisplayColumnHeaders ? mHeadingHeight : 0); 787 S32 heading_size = (mDisplayColumnHeaders ? mHeadingHeight : 0);
740 mItemListRect.setOriginAndSize( 788 mItemListRect.setOriginAndSize(
741 mBorderThickness + LIST_BORDER_PAD, 789 mBorderThickness,
742 mBorderThickness + LIST_BORDER_PAD, 790 mBorderThickness,
743 getRect().getWidth() - 2*( mBorderThickness + LIST_BORDER_PAD ), 791 getRect().getWidth() - 2 * mBorderThickness,
744 getRect().getHeight() - 2*( mBorderThickness + LIST_BORDER_PAD ) - heading_size ); 792 getRect().getHeight() - (2 * mBorderThickness ) - heading_size );
745 793
746 // how many lines of content in a single "page" 794 // how many lines of content in a single "page"
747 mPageLines = mLineHeight? mItemListRect.getHeight() / mLineHeight : 0; 795 mPageLines = mLineHeight? mItemListRect.getHeight() / mLineHeight : 0;
@@ -749,7 +797,7 @@ void LLScrollListCtrl::updateLayout()
749 if (scrollbar_visible) 797 if (scrollbar_visible)
750 { 798 {
751 // provide space on the right for scrollbar 799 // provide space on the right for scrollbar
752 mItemListRect.mRight = getRect().getWidth() - ( mBorderThickness + LIST_BORDER_PAD ) - SCROLLBAR_SIZE; 800 mItemListRect.mRight = getRect().getWidth() - mBorderThickness - SCROLLBAR_SIZE;
753 } 801 }
754 802
755 mScrollbar->reshape(SCROLLBAR_SIZE, mItemListRect.getHeight() + (mDisplayColumnHeaders ? mHeadingHeight : 0)); 803 mScrollbar->reshape(SCROLLBAR_SIZE, mItemListRect.getHeight() + (mDisplayColumnHeaders ? mHeadingHeight : 0));
@@ -775,7 +823,7 @@ LLRect LLScrollListCtrl::getRequiredRect()
775{ 823{
776 S32 heading_size = (mDisplayColumnHeaders ? mHeadingHeight : 0); 824 S32 heading_size = (mDisplayColumnHeaders ? mHeadingHeight : 0);
777 S32 height = (mLineHeight * getItemCount()) 825 S32 height = (mLineHeight * getItemCount())
778 + (2 * ( mBorderThickness + LIST_BORDER_PAD )) 826 + (2 * mBorderThickness )
779 + heading_size; 827 + heading_size;
780 S32 width = getRect().getWidth(); 828 S32 width = getRect().getWidth();
781 829
@@ -1357,7 +1405,6 @@ LLScrollListItem* LLScrollListCtrl::addCommentText(const LLString& comment_text,
1357 LLScrollListItem* item = NULL; 1405 LLScrollListItem* item = NULL;
1358 if (getItemCount() < mMaxItemCount) 1406 if (getItemCount() < mMaxItemCount)
1359 { 1407 {
1360 // simple items have their LLSD data set to their label
1361 // always draw comment text with "enabled" color 1408 // always draw comment text with "enabled" color
1362 item = new LLScrollListItemComment( comment_text, mFgUnselectedColor ); 1409 item = new LLScrollListItemComment( comment_text, mFgUnselectedColor );
1363 addItem( item, pos, FALSE ); 1410 addItem( item, pos, FALSE );
@@ -1525,7 +1572,7 @@ LLScrollListItem* LLScrollListCtrl::addStringUUIDItem(const LLString& item_text,
1525 if (getItemCount() < mMaxItemCount) 1572 if (getItemCount() < mMaxItemCount)
1526 { 1573 {
1527 item = new LLScrollListItem( enabled, NULL, id ); 1574 item = new LLScrollListItem( enabled, NULL, id );
1528 item->addColumn(item_text, gResMgr->getRes(LLFONT_SANSSERIF_SMALL), column_width); 1575 item->addColumn(item_text, LLResMgr::getInstance()->getRes(LLFONT_SANSSERIF_SMALL), column_width);
1529 addItem( item, pos ); 1576 addItem( item, pos );
1530 } 1577 }
1531 return item; 1578 return item;
@@ -1664,7 +1711,6 @@ void LLScrollListCtrl::drawItems()
1664 fg_color = (item->getEnabled() ? mFgUnselectedColor : mFgDisabledColor); 1711 fg_color = (item->getEnabled() ? mFgUnselectedColor : mFgDisabledColor);
1665 if( item->getSelected() && mCanSelect) 1712 if( item->getSelected() && mCanSelect)
1666 { 1713 {
1667 // Draw background of selected item
1668 bg_color = mBgSelectedColor; 1714 bg_color = mBgSelectedColor;
1669 fg_color = (item->getEnabled() ? mFgSelectedColor : mFgDisabledColor); 1715 fg_color = (item->getEnabled() ? mFgSelectedColor : mFgDisabledColor);
1670 } 1716 }
@@ -1697,43 +1743,40 @@ void LLScrollListCtrl::drawItems()
1697 1743
1698void LLScrollListCtrl::draw() 1744void LLScrollListCtrl::draw()
1699{ 1745{
1700 if( getVisible() ) 1746 // if user specifies sort, make sure it is maintained
1747 if (needsSorting() && !isSorted())
1701 { 1748 {
1702 // if user specifies sort, make sure it is maintained 1749 sortItems();
1703 if (needsSorting() && !isSorted()) 1750 }
1704 {
1705 sortItems();
1706 }
1707
1708 if (mNeedsScroll)
1709 {
1710 scrollToShowSelected();
1711 mNeedsScroll = FALSE;
1712 }
1713 LLRect background(0, getRect().getHeight(), getRect().getWidth(), 0);
1714 // Draw background
1715 if (mBackgroundVisible)
1716 {
1717 LLGLSNoTexture no_texture;
1718 gGL.color4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV );
1719 gl_rect_2d(background);
1720 }
1721 1751
1722 if (mColumnsDirty) 1752 if (mNeedsScroll)
1723 { 1753 {
1724 updateColumns(); 1754 scrollToShowSelected();
1725 mColumnsDirty = FALSE; 1755 mNeedsScroll = FALSE;
1726 } 1756 }
1757 LLRect background(0, getRect().getHeight(), getRect().getWidth(), 0);
1758 // Draw background
1759 if (mBackgroundVisible)
1760 {
1761 LLGLSNoTexture no_texture;
1762 glColor4fv( getEnabled() ? mBgWriteableColor.mV : mBgReadOnlyColor.mV );
1763 gl_rect_2d(background);
1764 }
1727 1765
1728 drawItems(); 1766 if (mColumnsDirty)
1767 {
1768 updateColumns();
1769 mColumnsDirty = FALSE;
1770 }
1729 1771
1730 if (mBorder) 1772 drawItems();
1731 {
1732 mBorder->setKeyboardFocusHighlight(gFocusMgr.getKeyboardFocus() == this);
1733 }
1734 1773
1735 LLUICtrl::draw(); 1774 if (mBorder)
1775 {
1776 mBorder->setKeyboardFocusHighlight(gFocusMgr.getKeyboardFocus() == this);
1736 } 1777 }
1778
1779 LLUICtrl::draw();
1737} 1780}
1738 1781
1739void LLScrollListCtrl::setEnabled(BOOL enabled) 1782void LLScrollListCtrl::setEnabled(BOOL enabled)
@@ -1950,23 +1993,21 @@ BOOL LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
1950BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask) 1993BOOL LLScrollListCtrl::handleDoubleClick(S32 x, S32 y, MASK mask)
1951{ 1994{
1952 //BOOL handled = FALSE; 1995 //BOOL handled = FALSE;
1953 if(getVisible()) 1996 BOOL handled = handleClick(x, y, mask);
1954 {
1955 BOOL handled = handleClick(x, y, mask);
1956 1997
1957 if (!handled) 1998 if (!handled)
1999 {
2000 // Offer the click to the children, even if we aren't enabled
2001 // so the scroll bars will work.
2002 if (NULL == LLView::childrenHandleDoubleClick(x, y, mask))
1958 { 2003 {
1959 // Offer the click to the children, even if we aren't enabled 2004 if( mCanSelect && mOnDoubleClickCallback )
1960 // so the scroll bars will work.
1961 if (NULL == LLView::childrenHandleDoubleClick(x, y, mask))
1962 { 2005 {
1963 if( mCanSelect && mOnDoubleClickCallback ) 2006 mOnDoubleClickCallback( mCallbackUserData );
1964 {
1965 mOnDoubleClickCallback( mCallbackUserData );
1966 }
1967 } 2007 }
1968 } 2008 }
1969 } 2009 }
2010
1970 return TRUE; 2011 return TRUE;
1971} 2012}
1972 2013
@@ -2146,12 +2187,12 @@ BOOL LLScrollListCtrl::handleHover(S32 x,S32 y,MASK mask)
2146} 2187}
2147 2188
2148 2189
2149BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask, BOOL called_from_parent ) 2190BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask )
2150{ 2191{
2151 BOOL handled = FALSE; 2192 BOOL handled = FALSE;
2152 2193
2153 // not called from parent means we have keyboard focus or a child does 2194 // not called from parent means we have keyboard focus or a child does
2154 if (mCanSelect && !called_from_parent) 2195 if (mCanSelect)
2155 { 2196 {
2156 // Ignore capslock 2197 // Ignore capslock
2157 mask = mask; 2198 mask = mask;
@@ -2234,7 +2275,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask, BOOL called_from_parent
2234 // JC - Special case: Only claim to have handled it 2275 // JC - Special case: Only claim to have handled it
2235 // if we're the special non-commit-on-move 2276 // if we're the special non-commit-on-move
2236 // type. AND we are visible 2277 // type. AND we are visible
2237 if (!mCommitOnKeyboardMovement && mask == MASK_NONE && getVisible()) 2278 if (!mCommitOnKeyboardMovement && mask == MASK_NONE)
2238 { 2279 {
2239 onCommit(); 2280 onCommit();
2240 mSearchString.clear(); 2281 mSearchString.clear();
@@ -2281,7 +2322,7 @@ BOOL LLScrollListCtrl::handleKeyHere(KEY key,MASK mask, BOOL called_from_parent
2281 return handled; 2322 return handled;
2282} 2323}
2283 2324
2284BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char, BOOL called_from_parent) 2325BOOL LLScrollListCtrl::handleUnicodeCharHere(llwchar uni_char)
2285{ 2326{
2286 if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL 2327 if ((uni_char < 0x20) || (uni_char == 0x7F)) // Control character or DEL
2287 { 2328 {
@@ -3207,17 +3248,16 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3207 LLColor4 color = ((*itor)["color"]); 3248 LLColor4 color = ((*itor)["color"]);
3208 BOOL enabled = !(*itor).has("enabled") || (*itor)["enabled"].asBoolean() == true; 3249 BOOL enabled = !(*itor).has("enabled") || (*itor)["enabled"].asBoolean() == true;
3209 3250
3210 const LLFontGL *font = gResMgr->getRes(fontname); 3251 const LLFontGL *font = LLResMgr::getInstance()->getRes(fontname);
3211 if (!font) 3252 if (!font)
3212 { 3253 {
3213 font = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); 3254 font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
3214 } 3255 }
3215 U8 font_style = LLFontGL::getStyleFromString(fontstyle); 3256 U8 font_style = LLFontGL::getStyleFromString(fontstyle);
3216 3257
3217 if (type == "icon") 3258 if (type == "icon")
3218 { 3259 {
3219 LLUUID image_id = value.asUUID(); 3260 LLScrollListIcon* cell = new LLScrollListIcon(value, width);
3220 LLScrollListIcon* cell = new LLScrollListIcon(value.asUUID(), width);
3221 if (has_color) 3261 if (has_color)
3222 { 3262 {
3223 cell->setColor(color); 3263 cell->setColor(color);
@@ -3270,7 +3310,7 @@ LLScrollListItem* LLScrollListCtrl::addElement(const LLSD& value, EAddPosition p
3270 if (new_item->getColumn(column_idx) == NULL) 3310 if (new_item->getColumn(column_idx) == NULL)
3271 { 3311 {
3272 LLScrollListColumn* column_ptr = &column_it->second; 3312 LLScrollListColumn* column_ptr = &column_it->second;
3273 new_item->setColumn(column_idx, new LLScrollListText("", gResMgr->getRes( LLFONT_SANSSERIF_SMALL ), column_ptr->mWidth, LLFontGL::NORMAL)); 3313 new_item->setColumn(column_idx, new LLScrollListText("", LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL ), column_ptr->mWidth, LLFontGL::NORMAL));
3274 } 3314 }
3275 } 3315 }
3276 3316
@@ -3290,7 +3330,7 @@ LLScrollListItem* LLScrollListCtrl::addSimpleElement(const LLString& value, EAdd
3290 3330
3291 LLScrollListItem *new_item = new LLScrollListItem(entry_id); 3331 LLScrollListItem *new_item = new LLScrollListItem(entry_id);
3292 3332
3293 const LLFontGL *font = gResMgr->getRes( LLFONT_SANSSERIF_SMALL ); 3333 const LLFontGL *font = LLResMgr::getInstance()->getRes( LLFONT_SANSSERIF_SMALL );
3294 3334
3295 new_item->addColumn(value, font, getRect().getWidth()); 3335 new_item->addColumn(value, font, getRect().getWidth());
3296 3336
@@ -3438,29 +3478,25 @@ LLColumnHeader::~LLColumnHeader()
3438 3478
3439void LLColumnHeader::draw() 3479void LLColumnHeader::draw()
3440{ 3480{
3441 if( getVisible() ) 3481 BOOL draw_arrow = !mColumn->mLabel.empty() && mColumn->mParentCtrl->isSorted() && mColumn->mParentCtrl->getSortColumnName() == mColumn->mSortingColumn;
3442 {
3443 BOOL draw_arrow = !mColumn->mLabel.empty() && mColumn->mParentCtrl->isSorted() && mColumn->mParentCtrl->getSortColumnName() == mColumn->mSortingColumn;
3444 3482
3445 BOOL is_ascending = mColumn->mParentCtrl->getSortAscending(); 3483 BOOL is_ascending = mColumn->mParentCtrl->getSortAscending();
3446 mButton->setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, draw_arrow ? LLColor4::white : LLColor4::transparent); 3484 mButton->setImageOverlay(is_ascending ? "up_arrow.tga" : "down_arrow.tga", LLFontGL::RIGHT, draw_arrow ? LLColor4::white : LLColor4::transparent);
3447 mArrowImage = mButton->getImageOverlay()->getImage(); 3485 mArrowImage = mButton->getImageOverlay();
3448 3486
3449 //BOOL clip = getRect().mRight > mColumn->mParentCtrl->getItemListRect().getWidth(); 3487 //BOOL clip = getRect().mRight > mColumn->mParentCtrl->getItemListRect().getWidth();
3450 //LLGLEnable scissor_test(clip ? GL_SCISSOR_TEST : GL_FALSE); 3488 //LLGLEnable scissor_test(clip ? GL_SCISSOR_TEST : GL_FALSE);
3451 3489
3452 //LLRect column_header_local_rect(-getRect().mLeft, getRect().getHeight(), mColumn->mParentCtrl->getItemListRect().getWidth() - getRect().mLeft, 0); 3490 //LLRect column_header_local_rect(-getRect().mLeft, getRect().getHeight(), mColumn->mParentCtrl->getItemListRect().getWidth() - getRect().mLeft, 0);
3453 //LLUI::setScissorRegionLocal(column_header_local_rect); 3491 //LLUI::setScissorRegionLocal(column_header_local_rect);
3454 3492
3455 // Draw children 3493 // Draw children
3456 LLComboBox::draw(); 3494 LLComboBox::draw();
3457
3458 if (mList->getVisible())
3459 {
3460 // sync sort order with list selection every frame
3461 mColumn->mParentCtrl->sortByColumn(mColumn->mSortingColumn, getCurrentIndex() == 0);
3462 }
3463 3495
3496 if (mList->getVisible())
3497 {
3498 // sync sort order with list selection every frame
3499 mColumn->mParentCtrl->sortByColumn(mColumn->mSortingColumn, getCurrentIndex() == 0);
3464 } 3500 }
3465} 3501}
3466 3502