diff -r 3145aadca3d2 -r 0c551e8818e0 External/Aga.Controls/Tree/Input/InputWithShift.cs --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/External/Aga.Controls/Tree/Input/InputWithShift.cs Sun May 27 15:16:19 2012 +0000 @@ -0,0 +1,69 @@ +using System; +using System.Collections.Generic; +using System.Text; + +namespace Aga.Controls.Tree +{ + internal class InputWithShift: NormalInputState + { + public InputWithShift(TreeViewAdv tree): base(tree) + { + } + + protected override void FocusRow(TreeNodeAdv node) + { + Tree.SuspendSelectionEvent = true; + try + { + if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null) + base.FocusRow(node); + else if (CanSelect(node)) + { + SelectAllFromStart(node); + Tree.CurrentNode = node; + Tree.ScrollTo(node); + } + } + finally + { + Tree.SuspendSelectionEvent = false; + } + } + + protected override void DoMouseOperation(TreeNodeAdvMouseEventArgs args) + { + if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null) + { + base.DoMouseOperation(args); + } + else if (CanSelect(args.Node)) + { + Tree.SuspendSelectionEvent = true; + try + { + SelectAllFromStart(args.Node); + } + finally + { + Tree.SuspendSelectionEvent = false; + } + } + } + + protected override void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args) + { + } + + private void SelectAllFromStart(TreeNodeAdv node) + { + Tree.ClearSelectionInternal(); + int a = node.Row; + int b = Tree.SelectionStart.Row; + for (int i = Math.Min(a, b); i <= Math.Max(a, b); i++) + { + if (Tree.SelectionMode == TreeSelectionMode.Multi || Tree.RowMap[i].Parent == node.Parent) + Tree.RowMap[i].IsSelected = true; + } + } + } +}