src/Misc/EFTools/DesignXmlCore/VirtualTreeGrid/UI/VirtualTreeSelection.cs
/// <summary>
///     Handles selection and caret changes due to mouse clicks.
/// </summary>
Handles selection and caret changes due to mouse clicks.
Handles selection and caret changes due to mouse clicks .
private void DoSelectionChangeFromMouse(
            ref VirtualTreeHitInfo hitInfo, bool shiftPressed, bool controlPressed, MouseButtons mouseButton)
        {
            var fireEvent = false;
            var columnSwitch = RequireColumnSwitchForSelection(ref hitInfo);
            if (columnSwitch)
            {
                SetSelectionColumn(myMouseDownHitInfo.DisplayColumn, false);
                fireEvent = true;
            }
            if (hitInfo.Row != VirtualTreeConstant.NullIndex)
            {
                if (mouseButton == MouseButtons.Right
                    && IsSelected(hitInfo.Row))
                {
                    if (CaretIndex != hitInfo.Row)
                    {
                        CaretIndex = hitInfo.Row;
                    }
                }
                else
                {
                    if (GetStyleFlag(VTCStyleFlags.ExtendedMultiSelect))
                    {
                        var action = controlPressed ? ModifySelectionAction.Toggle : ModifySelectionAction.Select;
                        SetCurrentExtendedMultiSelectIndex(hitInfo.Row, shiftPressed, controlPressed, action);
                        fireEvent = false;
                    }
                    else if (GetStyleFlag(VTCStyleFlags.MultiSelect))
                    {
                        SetSelected(hitInfo.Row, !IsSelected(hitInfo.Row) || columnSwitch);
                        CurrentIndex = hitInfo.Row; 
                        fireEvent = false;
                    }
                    else if (!IsSelected(hitInfo.Row))
                    {
                        CurrentIndex = hitInfo.Row; 
                        fireEvent = false;
                    }
                }
            }
            if (fireEvent)
            {
                DoSelectionChanged();
            }
        }
private void DoSelectionChangeFromMouse ( ref VirtualTreeHitInfo hitInfo , bool shiftPressed , bool controlPressed , MouseButtons mouseButton ) { var fireEvent = false ; var columnSwitch = RequireColumnSwitchForSelection ( ref hitInfo ) ; if ( columnSwitch ) { SetSelectionColumn ( myMouseDownHitInfo . DisplayColumn , false ) ; fireEvent = true ; } if ( hitInfo . Row != VirtualTreeConstant . NullIndex ) { if ( mouseButton == MouseButtons . Right && IsSelected ( hitInfo . Row ) ) { if ( CaretIndex != hitInfo . Row ) { CaretIndex = hitInfo . Row ; } } else { if ( GetStyleFlag ( VTCStyleFlags . ExtendedMultiSelect ) ) { var action = controlPressed ? ModifySelectionAction . Toggle : ModifySelectionAction . Select ; SetCurrentExtendedMultiSelectIndex ( hitInfo . Row , shiftPressed , controlPressed , action ) ; fireEvent = false ; } else if ( GetStyleFlag ( VTCStyleFlags . MultiSelect ) ) { SetSelected ( hitInfo . Row , ! IsSelected ( hitInfo . Row ) || columnSwitch ) ; CurrentIndex = hitInfo . Row ; fireEvent = false ; } else if ( ! IsSelected ( hitInfo . Row ) ) { CurrentIndex = hitInfo . Row ; fireEvent = false ; } } } if ( fireEvent ) { DoSelectionChanged ( ) ; } }
Handles selection and caret changes due to mouse clicks.
Handles selection and caret changes due to mouse clicks .
// if right button is clicked, and the index is already selected, // we'll just change the caret. // SetCurrentExtendedMultiSelectIndex fires SelectionChanged event. // CurrentIndex setter fires SelectionChanged event. // CurrentIndex setter fires SelectionChanged event.
VirtualTreeHitInfo
ref
shiftPressed
bool
controlPressed
bool
mouseButton
MouseButtons