| 3630 | //----------------------------------------------------------------------------- |
| 3631 | |
| 3632 | void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) |
| 3633 | { |
| 3634 | if( !mActive || !mAwake || !mVisible ) |
| 3635 | { |
| 3636 | Parent::onMouseDown(event); |
| 3637 | return; |
| 3638 | } |
| 3639 | if ( mProfile->mCanKeyFocus ) |
| 3640 | setFirstResponder(); |
| 3641 | |
| 3642 | Item * item = 0; |
| 3643 | BitSet32 hitFlags; |
| 3644 | mDragMidPoint = NomDragMidPoint; |
| 3645 | |
| 3646 | mMouseDragged = false; |
| 3647 | mMouseDownPoint = event.mousePoint; |
| 3648 | |
| 3649 | // |
| 3650 | if(!_hitTest(event.mousePoint, item, hitFlags)) |
| 3651 | return; |
| 3652 | |
| 3653 | mPossibleRenameItem = NULL; |
| 3654 | mRenamingItem = NULL; |
| 3655 | mTempItem = NULL; |
| 3656 | |
| 3657 | // |
| 3658 | if( event.modifier & SI_MULTISELECT ) |
| 3659 | { |
| 3660 | bool selectFlag = item->mState.test(Item::Selected); |
| 3661 | if (selectFlag == true) |
| 3662 | { |
| 3663 | // already selected, so unselect it and remove it |
| 3664 | removeSelection(item->mId); |
| 3665 | } |
| 3666 | else |
| 3667 | { |
| 3668 | addSelection(item->mId); |
| 3669 | } |
| 3670 | } |
| 3671 | else if( event.modifier & SI_RANGESELECT && mMultipleSelections ) |
| 3672 | { |
| 3673 | // is something already selected? |
| 3674 | S32 firstSelectedIndex = 0; |
| 3675 | Item * firstItem = NULL; |
| 3676 | if (!mSelectedItems.empty()) |
| 3677 | { |
| 3678 | firstItem = mSelectedItems.front(); |
| 3679 | for (S32 i = 0; i < mVisibleItems.size();i++) |
| 3680 | { |
| 3681 | if (mVisibleItems[i] == mSelectedItems.front()) |
| 3682 | { |
| 3683 | firstSelectedIndex = i; |
| 3684 | break; |
| 3685 | } |
| 3686 | } |
| 3687 | mCurrentDragCell = mMouseOverCell.y; |
| 3688 | if (mVisibleItems[firstSelectedIndex] != firstItem ) |
| 3689 | { |
nothing calls this directly
no test coverage detected