diff options
Diffstat (limited to 'linden/indra/llui/llscrolllistctrl.cpp')
-rw-r--r-- | linden/indra/llui/llscrolllistctrl.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/linden/indra/llui/llscrolllistctrl.cpp b/linden/indra/llui/llscrolllistctrl.cpp index 56a6a22..9e1a573 100644 --- a/linden/indra/llui/llscrolllistctrl.cpp +++ b/linden/indra/llui/llscrolllistctrl.cpp | |||
@@ -447,6 +447,8 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect, | |||
447 | mSortColumn(-1), | 447 | mSortColumn(-1), |
448 | mSortAscending(TRUE), | 448 | mSortAscending(TRUE), |
449 | mSorted(TRUE), | 449 | mSorted(TRUE), |
450 | mDirty(FALSE), | ||
451 | mOriginalSelection(-1), | ||
450 | mDrewSelected(FALSE) | 452 | mDrewSelected(FALSE) |
451 | { | 453 | { |
452 | mItemListRect.setOriginAndSize( | 454 | mItemListRect.setOriginAndSize( |
@@ -535,6 +537,7 @@ void LLScrollListCtrl::clearRows() | |||
535 | mScrollLines = 0; | 537 | mScrollLines = 0; |
536 | mLastSelected = NULL; | 538 | mLastSelected = NULL; |
537 | updateMaxContentWidth(NULL); | 539 | updateMaxContentWidth(NULL); |
540 | mDirty = FALSE; | ||
538 | } | 541 | } |
539 | 542 | ||
540 | 543 | ||
@@ -567,10 +570,10 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const | |||
567 | return ret; | 570 | return ret; |
568 | } | 571 | } |
569 | 572 | ||
570 | S32 LLScrollListCtrl::getFirstSelectedIndex() | 573 | S32 LLScrollListCtrl::getFirstSelectedIndex() const |
571 | { | 574 | { |
572 | S32 CurSelectedIndex = 0; | 575 | S32 CurSelectedIndex = 0; |
573 | item_list::iterator iter; | 576 | item_list::const_iterator iter; |
574 | for (iter = mItemList.begin(); iter != mItemList.end(); iter++) | 577 | for (iter = mItemList.begin(); iter != mItemList.end(); iter++) |
575 | { | 578 | { |
576 | LLScrollListItem* item = *iter; | 579 | LLScrollListItem* item = *iter; |
@@ -885,6 +888,7 @@ BOOL LLScrollListCtrl::selectFirstItem() | |||
885 | selectItem(itemp); | 888 | selectItem(itemp); |
886 | } | 889 | } |
887 | success = TRUE; | 890 | success = TRUE; |
891 | mOriginalSelection = 0; | ||
888 | } | 892 | } |
889 | else | 893 | else |
890 | { | 894 | { |
@@ -918,6 +922,7 @@ BOOL LLScrollListCtrl::selectNthItem( S32 target_index ) | |||
918 | { | 922 | { |
919 | selectItem(itemp); | 923 | selectItem(itemp); |
920 | success = TRUE; | 924 | success = TRUE; |
925 | mOriginalSelection = target_index; | ||
921 | } | 926 | } |
922 | } | 927 | } |
923 | else | 928 | else |
@@ -1741,6 +1746,7 @@ BOOL LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask) | |||
1741 | // always commit when mouse operation is completed inside list | 1746 | // always commit when mouse operation is completed inside list |
1742 | if (mItemListRect.pointInRect(x,y)) | 1747 | if (mItemListRect.pointInRect(x,y)) |
1743 | { | 1748 | { |
1749 | mDirty |= mSelectionChanged; | ||
1744 | mSelectionChanged = FALSE; | 1750 | mSelectionChanged = FALSE; |
1745 | onCommit(); | 1751 | onCommit(); |
1746 | } | 1752 | } |
@@ -2141,6 +2147,7 @@ void LLScrollListCtrl::commitIfChanged() | |||
2141 | { | 2147 | { |
2142 | if (mSelectionChanged) | 2148 | if (mSelectionChanged) |
2143 | { | 2149 | { |
2150 | mDirty = TRUE; | ||
2144 | mSelectionChanged = FALSE; | 2151 | mSelectionChanged = FALSE; |
2145 | onCommit(); | 2152 | onCommit(); |
2146 | } | 2153 | } |
@@ -2999,6 +3006,26 @@ void LLScrollListCtrl::setFocus(BOOL b) | |||
2999 | LLUICtrl::setFocus(b); | 3006 | LLUICtrl::setFocus(b); |
3000 | } | 3007 | } |
3001 | 3008 | ||
3009 | |||
3010 | // virtual | ||
3011 | BOOL LLScrollListCtrl::isDirty() const | ||
3012 | { | ||
3013 | BOOL grubby = mDirty; | ||
3014 | if ( !mAllowMultipleSelection ) | ||
3015 | { | ||
3016 | grubby = (mOriginalSelection != getFirstSelectedIndex()); | ||
3017 | } | ||
3018 | return grubby; | ||
3019 | } | ||
3020 | |||
3021 | // Clear dirty state | ||
3022 | void LLScrollListCtrl::resetDirty() | ||
3023 | { | ||
3024 | mDirty = FALSE; | ||
3025 | mOriginalSelection = getFirstSelectedIndex(); | ||
3026 | } | ||
3027 | |||
3028 | |||
3002 | //virtual | 3029 | //virtual |
3003 | void LLScrollListCtrl::onFocusReceived() | 3030 | void LLScrollListCtrl::onFocusReceived() |
3004 | { | 3031 | { |