moel@345: using System; moel@345: using System.Collections.Generic; moel@345: using System.Text; moel@345: moel@345: namespace Aga.Controls.Tree moel@345: { moel@345: internal class InputWithShift: NormalInputState moel@345: { moel@345: public InputWithShift(TreeViewAdv tree): base(tree) moel@345: { moel@345: } moel@345: moel@345: protected override void FocusRow(TreeNodeAdv node) moel@345: { moel@345: Tree.SuspendSelectionEvent = true; moel@345: try moel@345: { moel@345: if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null) moel@345: base.FocusRow(node); moel@345: else if (CanSelect(node)) moel@345: { moel@345: SelectAllFromStart(node); moel@345: Tree.CurrentNode = node; moel@345: Tree.ScrollTo(node); moel@345: } moel@345: } moel@345: finally moel@345: { moel@345: Tree.SuspendSelectionEvent = false; moel@345: } moel@345: } moel@345: moel@345: protected override void DoMouseOperation(TreeNodeAdvMouseEventArgs args) moel@345: { moel@345: if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null) moel@345: { moel@345: base.DoMouseOperation(args); moel@345: } moel@345: else if (CanSelect(args.Node)) moel@345: { moel@345: Tree.SuspendSelectionEvent = true; moel@345: try moel@345: { moel@345: SelectAllFromStart(args.Node); moel@345: } moel@345: finally moel@345: { moel@345: Tree.SuspendSelectionEvent = false; moel@345: } moel@345: } moel@345: } moel@345: moel@345: protected override void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args) moel@345: { moel@345: } moel@345: moel@345: private void SelectAllFromStart(TreeNodeAdv node) moel@345: { moel@345: Tree.ClearSelectionInternal(); moel@345: int a = node.Row; moel@345: int b = Tree.SelectionStart.Row; moel@345: for (int i = Math.Min(a, b); i <= Math.Max(a, b); i++) moel@345: { moel@345: if (Tree.SelectionMode == TreeSelectionMode.Multi || Tree.RowMap[i].Parent == node.Parent) moel@345: Tree.RowMap[i].IsSelected = true; moel@345: } moel@345: } moel@345: } moel@345: }