summaryrefslogtreecommitdiff
path: root/indra/llui/llscrolllistctrl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/llui/llscrolllistctrl.cpp')
-rw-r--r--indra/llui/llscrolllistctrl.cpp31
1 files changed, 29 insertions, 2 deletions
diff --git a/indra/llui/llscrolllistctrl.cpp b/indra/llui/llscrolllistctrl.cpp
index e802b3426b..ffad4809e9 100644
--- a/indra/llui/llscrolllistctrl.cpp
+++ b/indra/llui/llscrolllistctrl.cpp
@@ -427,6 +427,8 @@ LLScrollListCtrl::LLScrollListCtrl(const LLString& name, const LLRect& rect,
mSortColumn(-1),
mSortAscending(TRUE),
mSorted(TRUE),
+ mDirty(FALSE),
+ mOriginalSelection(-1),
mDrewSelected(FALSE)
{
mItemListRect.setOriginAndSize(
@@ -515,6 +517,7 @@ void LLScrollListCtrl::clearRows()
mScrollLines = 0;
mLastSelected = NULL;
updateMaxContentWidth(NULL);
+ mDirty = FALSE;
}
@@ -547,10 +550,10 @@ std::vector<LLScrollListItem*> LLScrollListCtrl::getAllSelected() const
return ret;
}
-S32 LLScrollListCtrl::getFirstSelectedIndex()
+S32 LLScrollListCtrl::getFirstSelectedIndex() const
{
S32 CurSelectedIndex = 0;
- item_list::iterator iter;
+ item_list::const_iterator iter;
for (iter = mItemList.begin(); iter != mItemList.end(); iter++)
{
LLScrollListItem* item = *iter;
@@ -865,6 +868,7 @@ BOOL LLScrollListCtrl::selectFirstItem()
selectItem(itemp);
}
success = TRUE;
+ mOriginalSelection = 0;
}
else
{
@@ -898,6 +902,7 @@ BOOL LLScrollListCtrl::selectNthItem( S32 target_index )
{
selectItem(itemp);
success = TRUE;
+ mOriginalSelection = target_index;
}
}
else
@@ -1721,6 +1726,7 @@ BOOL LLScrollListCtrl::handleMouseUp(S32 x, S32 y, MASK mask)
// always commit when mouse operation is completed inside list
if (mItemListRect.pointInRect(x,y))
{
+ mDirty |= mSelectionChanged;
mSelectionChanged = FALSE;
onCommit();
}
@@ -2121,6 +2127,7 @@ void LLScrollListCtrl::commitIfChanged()
{
if (mSelectionChanged)
{
+ mDirty = TRUE;
mSelectionChanged = FALSE;
onCommit();
}
@@ -2979,6 +2986,26 @@ void LLScrollListCtrl::setFocus(BOOL b)
LLUICtrl::setFocus(b);
}
+
+// virtual
+BOOL LLScrollListCtrl::isDirty() const
+{
+ BOOL grubby = mDirty;
+ if ( !mAllowMultipleSelection )
+ {
+ grubby = (mOriginalSelection != getFirstSelectedIndex());
+ }
+ return grubby;
+}
+
+// Clear dirty state
+void LLScrollListCtrl::resetDirty()
+{
+ mDirty = FALSE;
+ mOriginalSelection = getFirstSelectedIndex();
+}
+
+
//virtual
void LLScrollListCtrl::onFocusReceived()
{