Beispiel #1
0
 private AccessibleObject NavigateBackward(bool wrapAround)
 {
     if (_owner.OwningColumn == _owner.DataGridView.Columns.GetFirstColumn(DataGridViewElementStates.Visible))
     {
         if (wrapAround)
         {
             // Return the last accessible object in the previous row
             AccessibleObject previousRow = Owner.OwningRow.AccessibilityObject.Navigate(AccessibleNavigation.Previous);
             if (previousRow != null && previousRow.GetChildCount() > 0)
             {
                 return(previousRow.GetChild(previousRow.GetChildCount() - 1));
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             // return the row header cell if the row headers are visible.
             if (_owner.DataGridView.RowHeadersVisible)
             {
                 return(_owner.OwningRow.AccessibilityObject.GetChild(0));
             }
             else
             {
                 return(null);
             }
         }
     }
     else
     {
         int previousVisibleColumnIndex = _owner.DataGridView.Columns.GetPreviousColumn(_owner.OwningColumn,
                                                                                        DataGridViewElementStates.Visible,
                                                                                        DataGridViewElementStates.None).Index;
         return(_owner.OwningRow.Cells[previousVisibleColumnIndex].AccessibilityObject);
     }
 }
            public override AccessibleObject Navigate(AccessibleNavigation navigationDirection)
            {
                if (Owner.OwningColumn == null)
                {
                    return(null);
                }

                switch (navigationDirection)
                {
                case AccessibleNavigation.Right:
                    if (Owner.DataGridView.RightToLeft == RightToLeft.No)
                    {
                        return(NavigateForward());
                    }
                    else
                    {
                        return(NavigateBackward());
                    }

                case AccessibleNavigation.Next:
                    return(NavigateForward());

                case AccessibleNavigation.Left:
                    if (Owner.DataGridView.RightToLeft == RightToLeft.No)
                    {
                        return(NavigateBackward());
                    }
                    else
                    {
                        return(NavigateForward());
                    }

                case AccessibleNavigation.Previous:
                    return(NavigateBackward());

                case AccessibleNavigation.FirstChild:
                    // return the top left header cell accessible object
                    return(Owner.DataGridView.AccessibilityObject.GetChild(0).GetChild(0));

                case AccessibleNavigation.LastChild:
                    // return the last column header cell in the top row header accessible object
                    AccessibleObject topRowHeaderAccessibleObject = Owner.DataGridView.AccessibilityObject.GetChild(0);
                    return(topRowHeaderAccessibleObject.GetChild(topRowHeaderAccessibleObject.GetChildCount() - 1));

                default:
                    return(null);
                }
            }
Beispiel #3
0
            /// <summary>
            ///  Gets the next n child accessible objects.
            /// </summary>
            unsafe HRESULT Oleaut32.IEnumVariant.Next(uint celt, IntPtr rgVar, uint *pCeltFetched)
            {
                // NOTE: rgvar is a pointer to an array of variants
                if (owner.IsClientObject)
                {
                    Debug.WriteLineIf(CompModSwitches.MSAA.TraceInfo, "EnumVariantObject: owner = " + owner.ToString() + ", celt = " + celt);

                    Debug.Indent();

                    int childCount;
                    int[]? newOrder;

                    if ((childCount = owner.GetChildCount()) >= 0)
                    {
                        NextFromChildCollection(celt, rgVar, pCeltFetched, childCount);
                    }
                    else if (owner.systemIEnumVariant is null)
                    {
                        NextEmpty(celt, rgVar, pCeltFetched);
                    }
                    else if ((newOrder = owner.GetSysChildOrder()) != null)
                    {
                        NextFromSystemReordered(celt, rgVar, pCeltFetched, newOrder);
                    }
                    else
                    {
                        NextFromSystem(celt, rgVar, pCeltFetched);
                    }

                    Debug.Unindent();
                }
                else
                {
                    NextFromSystem(celt, rgVar, pCeltFetched);
                }

                if (pCeltFetched is null)
                {
                    return(HRESULT.S_OK);
                }

                // Tell caller whether requested number of items was returned. Once list of items has
                // been exhausted, we return S_FALSE so that caller knows to stop calling this method.
                return(*pCeltFetched == celt ? HRESULT.S_OK : HRESULT.S_FALSE);
            }
Beispiel #4
0
 private AccessibleObject NavigateForward(bool wrapAround)
 {
     if (_owner.OwningColumn == _owner.DataGridView.Columns.GetLastColumn(DataGridViewElementStates.Visible,
                                                                          DataGridViewElementStates.None))
     {
         if (wrapAround)
         {
             // Return the first cell in the next visible row.
             //
             AccessibleObject nextRow = Owner.OwningRow.AccessibilityObject.Navigate(AccessibleNavigation.Next);
             if (nextRow != null && nextRow.GetChildCount() > 0)
             {
                 if (Owner.DataGridView.RowHeadersVisible)
                 {
                     return(nextRow.GetChild(1));
                 }
                 else
                 {
                     return(nextRow.GetChild(0));
                 }
             }
             else
             {
                 return(null);
             }
         }
         else
         {
             return(null);
         }
     }
     else
     {
         int nextVisibleColumnIndex = _owner.DataGridView.Columns.GetNextColumn(_owner.OwningColumn,
                                                                                DataGridViewElementStates.Visible,
                                                                                DataGridViewElementStates.None).Index;
         return(_owner.OwningRow.Cells[nextVisibleColumnIndex].AccessibilityObject);
     }
 }
            public override AccessibleObject Navigate(AccessibleNavigation navigationDirection)
            {
                if (base.Owner.OwningColumn != null)
                {
                    switch (navigationDirection)
                    {
                    case AccessibleNavigation.Left:
                        if (base.Owner.DataGridView.RightToLeft != RightToLeft.No)
                        {
                            return(this.NavigateForward());
                        }
                        return(this.NavigateBackward());

                    case AccessibleNavigation.Right:
                        if (base.Owner.DataGridView.RightToLeft != RightToLeft.No)
                        {
                            return(this.NavigateBackward());
                        }
                        return(this.NavigateForward());

                    case AccessibleNavigation.Next:
                        return(this.NavigateForward());

                    case AccessibleNavigation.Previous:
                        return(this.NavigateBackward());

                    case AccessibleNavigation.FirstChild:
                        return(base.Owner.DataGridView.AccessibilityObject.GetChild(0).GetChild(0));

                    case AccessibleNavigation.LastChild:
                    {
                        AccessibleObject child = base.Owner.DataGridView.AccessibilityObject.GetChild(0);
                        return(child.GetChild(child.GetChildCount() - 1));
                    }
                    }
                }
                return(null);
            }
Beispiel #6
0
		private static void DumpAccessibilityReport(AccessibleObject parent, string indent)
		{
			Debug.WriteLine(string.Format("{0}Name: {1}, Value: {2}, Role: {3}, Description: {4}", indent, parent.Name, parent.Value, parent.Role.ToString(), parent.Description));
			int childCount = parent.GetChildCount();
			if (childCount != 0)
			{
				string childIndent = indent + "\t";
				for (int i = 0; i < childCount; ++i)
				{
					DumpAccessibilityReport(parent.GetChild(i), childIndent);
				}
			}
		}
Beispiel #7
0
		/// <summary>
		/// Find the accessible object matching the given path
		/// </summary>
		/// <param name="parent">The starting accessible object</param>
		/// <param name="nodePath">A list of AccessiblePathNode structures. Note that the
		/// easiest way to populate this is with an array of path nodes</param>
		/// <returns>Matching AccessibleObject, or null</returns>
		public static AccessibleObject FindAccessibleObject(AccessibleObject parent, IList<AccessiblePathNode> nodePath)
		{
			int pathCount = nodePath.Count;
			if (pathCount == 0)
			{
				return null;
			}
			AccessibleObject nextParent = parent;
			for (int currentNodeIndex = 0; currentNodeIndex < pathCount && nextParent != null; ++currentNodeIndex)
			{
				parent = nextParent;
				nextParent = null;
				int childCount = parent.GetChildCount();
				if (childCount != 0)
				{
					AccessiblePathNode currentNode = nodePath[currentNodeIndex];
					int testIndex = currentNode.Index;
					for (int i = 0; i < childCount; ++i)
					{
						AccessibleObject child = parent.GetChild(i);
						if (child != null &&
							child.Name == currentNode.Name &&
							(currentNode.Value == null || currentNode.Value == child.Value))
						{
							if (testIndex > 0)
							{
								--testIndex;
							}
							else
							{
								nextParent = child;
								break;
							}
						}
					}
				}
			}
			return nextParent;
		}
 void CheckProperties(AccessibleObject node)
 {
     // Get code coverage on the boring stuff.
     Trace.WriteLine("Name=" + node.Name);
     Trace.WriteLine("\tValue=" + node.Value);
     Trace.WriteLine("\tParent=" + node.Parent.Name);
     Trace.WriteLine("\tChildCount=" + node.GetChildCount());
     Trace.WriteLine("\tBounds=" + node.Bounds.ToString());
     Trace.WriteLine("\tDefaultAction=" + node.DefaultAction);
     Trace.WriteLine("\tDescription=" + node.Description);
     Trace.WriteLine("\tHelp=" + node.Help);
     Trace.WriteLine("\tKeyboardShortcut=" + node.KeyboardShortcut);
     Trace.WriteLine("\tRole=" + node.Role);
     Trace.WriteLine("\tState=" + node.State);
     string filename = null;
     Trace.WriteLine("\tHelpTopic=" + node.GetHelpTopic(out filename));
 }