1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/External/Aga.Controls/Tree/Input/InputWithShift.cs Sun May 27 15:16:19 2012 +0000
1.3 @@ -0,0 +1,69 @@
1.4 +using System;
1.5 +using System.Collections.Generic;
1.6 +using System.Text;
1.7 +
1.8 +namespace Aga.Controls.Tree
1.9 +{
1.10 + internal class InputWithShift: NormalInputState
1.11 + {
1.12 + public InputWithShift(TreeViewAdv tree): base(tree)
1.13 + {
1.14 + }
1.15 +
1.16 + protected override void FocusRow(TreeNodeAdv node)
1.17 + {
1.18 + Tree.SuspendSelectionEvent = true;
1.19 + try
1.20 + {
1.21 + if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null)
1.22 + base.FocusRow(node);
1.23 + else if (CanSelect(node))
1.24 + {
1.25 + SelectAllFromStart(node);
1.26 + Tree.CurrentNode = node;
1.27 + Tree.ScrollTo(node);
1.28 + }
1.29 + }
1.30 + finally
1.31 + {
1.32 + Tree.SuspendSelectionEvent = false;
1.33 + }
1.34 + }
1.35 +
1.36 + protected override void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
1.37 + {
1.38 + if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null)
1.39 + {
1.40 + base.DoMouseOperation(args);
1.41 + }
1.42 + else if (CanSelect(args.Node))
1.43 + {
1.44 + Tree.SuspendSelectionEvent = true;
1.45 + try
1.46 + {
1.47 + SelectAllFromStart(args.Node);
1.48 + }
1.49 + finally
1.50 + {
1.51 + Tree.SuspendSelectionEvent = false;
1.52 + }
1.53 + }
1.54 + }
1.55 +
1.56 + protected override void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
1.57 + {
1.58 + }
1.59 +
1.60 + private void SelectAllFromStart(TreeNodeAdv node)
1.61 + {
1.62 + Tree.ClearSelectionInternal();
1.63 + int a = node.Row;
1.64 + int b = Tree.SelectionStart.Row;
1.65 + for (int i = Math.Min(a, b); i <= Math.Max(a, b); i++)
1.66 + {
1.67 + if (Tree.SelectionMode == TreeSelectionMode.Multi || Tree.RowMap[i].Parent == node.Parent)
1.68 + Tree.RowMap[i].IsSelected = true;
1.69 + }
1.70 + }
1.71 + }
1.72 +}