External/Aga.Controls/Tree/Input/InputWithShift.cs
author moel.mich
Sun, 23 Sep 2012 18:37:43 +0000
changeset 380 573f1fff48b2
permissions -rw-r--r--
Fixed Issue 387. The new implementation does not try to start a ring 0 driver that already exists, but could not be opened. It tries to delete the driver and install it new. The driver is now stored temporarily in the application folder. The driver is not correctly removed on system shutdown.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 
     5 namespace Aga.Controls.Tree
     6 {
     7 	internal class InputWithShift: NormalInputState
     8 	{
     9 		public InputWithShift(TreeViewAdv tree): base(tree)
    10 		{
    11 		}
    12 
    13 		protected override void FocusRow(TreeNodeAdv node)
    14 		{
    15 			Tree.SuspendSelectionEvent = true;
    16 			try
    17 			{
    18 				if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null)
    19 					base.FocusRow(node);
    20 				else if (CanSelect(node))
    21 				{
    22 					SelectAllFromStart(node);
    23 					Tree.CurrentNode = node;
    24 					Tree.ScrollTo(node);
    25 				}
    26 			}
    27 			finally
    28 			{
    29 				Tree.SuspendSelectionEvent = false;
    30 			}
    31 		}
    32 
    33 		protected override void DoMouseOperation(TreeNodeAdvMouseEventArgs args)
    34 		{
    35 			if (Tree.SelectionMode == TreeSelectionMode.Single || Tree.SelectionStart == null)
    36 			{
    37 				base.DoMouseOperation(args);
    38 			}
    39 			else if (CanSelect(args.Node))
    40 			{
    41 				Tree.SuspendSelectionEvent = true;
    42 				try
    43 				{
    44 					SelectAllFromStart(args.Node);
    45 				}
    46 				finally
    47 				{
    48 					Tree.SuspendSelectionEvent = false;
    49 				}
    50 			}
    51 		}
    52 
    53 		protected override void MouseDownAtEmptySpace(TreeNodeAdvMouseEventArgs args)
    54 		{
    55 		}
    56 
    57 		private void SelectAllFromStart(TreeNodeAdv node)
    58 		{
    59 			Tree.ClearSelectionInternal();
    60 			int a = node.Row;
    61 			int b = Tree.SelectionStart.Row;
    62 			for (int i = Math.Min(a, b); i <= Math.Max(a, b); i++)
    63 			{
    64 				if (Tree.SelectionMode == TreeSelectionMode.Multi || Tree.RowMap[i].Parent == node.Parent)
    65 					Tree.RowMap[i].IsSelected = true;
    66 			}
    67 		}
    68 	}
    69 }