Ejemplo n.º 1
0
            public override AccessibleObject Navigate(AccessibleNavigation navigationDirection)
            {
                ToolStripItem nextItem = null;

                if (Owner != null)
                {
                    ToolStrip parent = Owner.ParentInternal;
                    if (parent is null)
                    {
                        return(null);
                    }

                    bool forwardInCollection = (parent.RightToLeft == RightToLeft.No);
                    switch (navigationDirection)
                    {
                    case AccessibleNavigation.FirstChild:
                        nextItem = parent.GetNextItem(null, ArrowDirection.Right, /*RTLAware=*/ true);
                        break;

                    case AccessibleNavigation.LastChild:
                        nextItem = parent.GetNextItem(null, ArrowDirection.Left, /*RTLAware=*/ true);
                        break;

                    case AccessibleNavigation.Previous:
                    case AccessibleNavigation.Left:
                        nextItem = parent.GetNextItem(Owner, ArrowDirection.Left, /*RTLAware=*/ true);
                        break;

                    case AccessibleNavigation.Next:
                    case AccessibleNavigation.Right:
                        nextItem = parent.GetNextItem(Owner, ArrowDirection.Right, /*RTLAware=*/ true);
                        break;

                    case AccessibleNavigation.Up:
                        nextItem = (Owner.IsOnDropDown) ? parent.GetNextItem(Owner, ArrowDirection.Up) :
                                   parent.GetNextItem(Owner, ArrowDirection.Left, /*RTLAware=*/ true);
                        break;

                    case AccessibleNavigation.Down:
                        nextItem = (Owner.IsOnDropDown) ? parent.GetNextItem(Owner, ArrowDirection.Down) :
                                   parent.GetNextItem(Owner, ArrowDirection.Right, /*RTLAware=*/ true);
                        break;
                    }
                }

                return(nextItem?.AccessibilityObject);
            }
 private ToolStripItem GetNextItem(ToolStrip parent, ToolStripItem startItem, ArrowDirection direction)
 {
     if ((parent.RightToLeft == RightToLeft.Yes) && ((direction == ArrowDirection.Left) || (direction == ArrowDirection.Right)))
     {
         if (direction == ArrowDirection.Right)
         {
             direction = ArrowDirection.Left;
         }
         else if (direction == ArrowDirection.Left)
         {
             direction = ArrowDirection.Right;
         }
     }
     return parent.GetNextItem(startItem, direction);
 }
Ejemplo n.º 3
0
		public void MethodGetNextItemIEAE ()
		{
			ToolStrip ts = new ToolStrip ();
			ts.GetNextItem (null, (ArrowDirection)42);
		}
Ejemplo n.º 4
0
		public void MethodGetNextItem ()
		{
			ToolStrip ts = new ToolStrip ();
			ts.Items.Add ("Test Item 1");
			
			Form f = new Form ();
			f.ShowInTaskbar = false;
			f.Controls.Add (ts);
			f.Show ();

			Assert.AreEqual (ts.Items[0], ts.GetNextItem (null, ArrowDirection.Right), "A1");
			Assert.AreEqual (ts.Items[0], ts.GetNextItem (ts.Items[0], ArrowDirection.Right), "A2");

			ts.Items.Add ("Test Item 2");
			
			Assert.AreEqual (ts.Items[0], ts.GetNextItem (null, ArrowDirection.Right), "A3");
			Assert.AreEqual (ts.Items[1], ts.GetNextItem (ts.Items[0], ArrowDirection.Right), "A4");

			f.Dispose ();
		}