public override bool ConsumeKey(Key key)
 {
     if (ActiveChild.ConsumeKey(key))
     {
         CalculateSize();
         return(true);
     }
     if (key == Key.Down)
     {
         if (ActiveChild == mainRowContainer)
         {
             Point point = ActiveChild.GetVerticalCaretLocation();
             ActiveChild = bottomRowContainer;
             point.Y     = ActiveChild.Top + 1;
             ActiveChild.SetCursorOnKeyUpDown(key, point);
             return(true);
         }
     }
     else if (key == Key.Up)
     {
         if (ActiveChild == bottomRowContainer)
         {
             Point point = ActiveChild.GetVerticalCaretLocation();
             ActiveChild = mainRowContainer;
             point.Y     = ActiveChild.Bottom - 1;
             ActiveChild.SetCursorOnKeyUpDown(key, point);
             return(true);
         }
     }
     return(false);
 }
 public override bool ConsumeKey(Key key)
 {
     if (ActiveChild.ConsumeKey(key))
     {
         CalculateSize();
         return(true);
     }
     if (key == Key.Down)
     {
         if (ActiveChild == topRowContainer)
         {
             ActiveChild = mainRowContainer;
             return(true);
         }
     }
     else if (key == Key.Up)
     {
         if (ActiveChild == mainRowContainer)
         {
             ActiveChild = topRowContainer;
             return(true);
         }
     }
     return(false);
 }
 public override bool ConsumeKey(Key key)
 {
     if (ActiveChild.ConsumeKey(key))
     {
         CalculateSize();
         return(true);
     }
     if (key == Key.Right)
     {
         if (ActiveChild == topEquation)
         {
             ActiveChild = bottomEquation;
             return(true);
         }
     }
     else if (key == Key.Left)
     {
         if (ActiveChild == bottomEquation)
         {
             ActiveChild = topEquation;
             return(true);
         }
     }
     return(false);
 }
Exemple #4
0
 public override bool ConsumeKey(Key key)
 {
     if (ActiveChild.ConsumeKey(key))
     {
         CalculateSize();
         return(true);
     }
     if (key == Key.Down)
     {
         if (ActiveChild == mainEquation)
         {
             ActiveChild = bottomEquation;
             return(true);
         }
     }
     else if (key == Key.Up)
     {
         if (ActiveChild == bottomEquation)
         {
             ActiveChild = mainEquation;
             return(true);
         }
     }
     return(false);
 }
Exemple #5
0
        public override bool ConsumeKey(Key key)
        {
            if ((Keyboard.IsKeyDown(Key.LeftShift) || Keyboard.IsKeyDown(Key.RightShift)) && (new[] { Key.Right, Key.Left, Key.Up, Key.Down, Key.Home, Key.End }).Contains(key))
            {
                if (!IsSelecting)
                {
                    IsSelecting = true;
                    ((RowContainer)ActiveChild).StartSelection();
                }
                ActiveChild.Select(key);
                AdjustCarets();
                return(true);
            }
            Key[] handledKeys = { Key.Left, Key.Right, Key.Delete, Key.Up, Key.Down, Key.Enter, Key.Escape, Key.Back, Key.Home, Key.End };
            bool  result      = false;

            if (handledKeys.Contains(key))
            {
                result = true;
                if (IsSelecting && (new[] { Key.Delete, Key.Enter, Key.Back }).Contains(key))
                {
                    ActiveChild.RemoveSelection(true);
                }
                else
                {
                    ActiveChild.ConsumeKey(key);
                }
                CalculateSize();
                AdjustCarets();
                DeSelect();
            }
            return(result);
        }
Exemple #6
0
        public override bool ConsumeKey(Key key)
        {
            if (ActiveChild.ConsumeKey(key))
            {
                CalculateSize();
                return(true);
            }
            int currentIndex = childEquations.IndexOf(ActiveChild);

            if (key == Key.Right)
            {
                if (currentIndex % columns < columns - 1)//not last column?
                {
                    ActiveChild = childEquations[currentIndex + 1];
                    return(true);
                }
            }
            else if (key == Key.Left)
            {
                if (currentIndex % columns > 0)//not last column?
                {
                    ActiveChild = childEquations[currentIndex - 1];
                    return(true);
                }
            }
            else if (key == Key.Up)
            {
                if (currentIndex / columns > 0)//not in first row?
                {
                    Point point = ActiveChild.GetVerticalCaretLocation();
                    ActiveChild = childEquations[currentIndex - columns];;
                    point.Y     = ActiveChild.Top + 1;
                    ActiveChild.SetCursorOnKeyUpDown(key, point);
                    return(true);
                }
            }
            else if (key == Key.Down)
            {
                if (currentIndex / columns < rows - 1)//not in last row?
                {
                    Point point = ActiveChild.GetVerticalCaretLocation();
                    ActiveChild = childEquations[currentIndex + columns];;
                    point.Y     = ActiveChild.Top + 1;
                    ActiveChild.SetCursorOnKeyUpDown(key, point);
                    return(true);
                }
            }
            return(false);
        }