public EnumVariantObject(AccessibleObject owner) {
     Debug.Assert(owner != null, "Cannot create EnumVariantObject with a null owner");
     this.owner = owner;
 }
		public DataGridViewRow ()
		{
			cells = new DataGridViewCellCollection(this);
			minimumHeight = 3;
			height = -1;
			explicit_height = -1;
			headerCell = new DataGridViewRowHeaderCell();
			headerCell.SetOwningRow (this);
			accessibilityObject = new AccessibleObject ();
			SetState (DataGridViewElementStates.Visible);
		}
 internal virtual bool GetSysChild(AccessibleNavigation navdir, out AccessibleObject accessibleObject)
 {
     accessibleObject = null;
     return false;
 }
 internal InternalAccessibleObject(AccessibleObject accessibleImplemention)
 {
     this.publicIAccessible = accessibleImplemention;
     this.publicIEnumVariant = accessibleImplemention;
     this.publicIOleWindow = accessibleImplemention;
     this.publicIReflect = accessibleImplemention;
 }
Ejemplo n.º 5
0
		/// <summary>
		/// Get an array of selected accessible objects
		/// </summary>
		public AccessibleObject[] GetSelectedAccessibleObjects()
		{
			DiagramClientView view = myClientView;
			SelectedShapesCollection shapes = view.Selection;
			int selectionCount = shapes.Count;
			AccessibleObject[] retVal = new AccessibleObject[shapes.Count];
			int i = 0;
			foreach (DiagramItem item in shapes)
			{
				retVal[i] = item.GetAccessibleObject(view);
				++i;
			}
			return retVal;
		}
Ejemplo n.º 6
0
		/// <summary>
		/// Start a drag operation on an accessible object. The caller should make sure that the
		/// accessible object is visible before making this call.
		/// </summary>
		/// <param name="accessibleObject">A child accessible object to drag</param>
		/// <param name="location">The location in the accessible object to drag from</param>
		/// <param name="xOffset">A horizontal offset (in pixels) from the specified drag location.</param>
		/// <param name="yOffset">A vertical offset (in pixels) from the specified drag location.</param>
		public void DragAccessibleObject(AccessibleObject accessibleObject, ClickLocation location, int xOffset, int yOffset)
		{
			Rectangle rect = accessibleObject.Bounds;
			PointF pt;
			switch (location)
			{
				case ClickLocation.UpperLeft:
					pt = new PointF((float)rect.Left + xOffset, (float)rect.Top + yOffset);
					break;
				case ClickLocation.Center:
				default:
					pt = new PointF(((float)rect.Left + rect.Right) / 2 + xOffset, ((float)rect.Top + rect.Bottom) / 2 + yOffset);
					break;
			}
			Rectangle screenBounds = Screen.GetBounds(myClientView);
			MoveMouseClose(screenBounds, pt);
			int dx = (int)(pt.X / screenBounds.Width * 65535f);
			int dy = (int)(pt.Y / screenBounds.Height * 65535f);
			Size dragSize = SystemInformation.DragSize;
			float dxDrag = (dragSize.Width / screenBounds.Width * 65535f);
			float dyDrag = (dragSize.Height / screenBounds.Height * 65535f);
			SendKeys.Flush();
			mouse_event(MouseEventFlags.Move | MouseEventFlags.Absolute, dx, dy, 0, 0);
			SendKeys.Flush();
			mouse_event(MouseEventFlags.LeftDown | MouseEventFlags.Absolute, dx, dy, 0, 0);
			// Move .5 the drag size, the full drag size, and 1.5 the drag size to make sure we got it
			mouse_event(MouseEventFlags.Move | MouseEventFlags.Absolute, dx + (int)(dxDrag * .5), dy + (int)(dyDrag * .5), 0, 0);
			SendKeys.Flush();
			mouse_event(MouseEventFlags.Move | MouseEventFlags.Absolute, dx + (int)dxDrag, dy + (int)dyDrag, 0, 0);
			SendKeys.Flush();
			mouse_event(MouseEventFlags.Move | MouseEventFlags.Absolute, dx + (int)(dxDrag * 1.5), dy + (int)(dyDrag * 1.5), 0, 0);
			SendKeys.Flush();
		}
Ejemplo n.º 7
0
		/// <summary>
		/// End a drag operation with a drop on an accessible object. The caller should make sure that the
		/// accessible object is visible before making this call.
		/// </summary>
		/// <param name="accessibleObject">A child accessible object to drop on</param>
		/// <param name="location">The location in the accessible object to drop on</param>
		/// <param name="xOffset">A horizontal offset (in pixels) from the specified drop location.</param>
		/// <param name="yOffset">A vertical offset (in pixels) from the specified drop location.</param>
		public void DropOnAccessibleObject(AccessibleObject accessibleObject, ClickLocation location, int xOffset, int yOffset)
		{
			Rectangle rect = accessibleObject.Bounds;
			PointF pt;
			switch (location)
			{
				case ClickLocation.UpperLeft:
					pt = new PointF((float)rect.Left + xOffset, (float)rect.Top + yOffset);
					break;
				case ClickLocation.Center:
				default:
					pt = new PointF(((float)rect.Left + rect.Right) / 2 + xOffset, ((float)rect.Top + rect.Bottom) / 2 + yOffset);
					break;
			}
			Rectangle screenBounds = Screen.GetBounds(myClientView);
			MoveMouseClose(screenBounds, pt);
			int dx = (int)(pt.X / screenBounds.Width * 65535f);
			int dy = (int)(pt.Y / screenBounds.Height * 65535f);
			SendKeys.Flush();
			mouse_event(MouseEventFlags.Move | MouseEventFlags.Absolute, dx, dy, 0, 0);
			SendKeys.Flush();
			mouse_event(MouseEventFlags.LeftUp | MouseEventFlags.Absolute, dx, dy, 0, 0);
			SendKeys.Flush();
		}
Ejemplo n.º 8
0
		/// <summary>
		/// Helper function for TranslateAccessibleObject and EnsureAccessibleObjectVisible
		/// </summary>
		private DiagramItem TranslateAccessibleObjectToDiagramItem(AccessibleObject accessibleObject, bool returnShape)
		{
			if (accessibleObject == null)
			{
				return null;
			}
			DiagramItem hitItem = null;
			DiagramClientView clientView = myClientView;
			DiagramHitTestInfo hitInfo = new DiagramHitTestInfo(clientView);
			RectangleD boundsD = clientView.DeviceToWorld(clientView.RectangleToClient(accessibleObject.Bounds));
			if (clientView.Diagram.DoHitTest(boundsD.Center, hitInfo, false))
			{
				hitItem = hitInfo.HitDiagramItem;
				if (!returnShape)
				{
					// Wind back out the parent stack if the hit test went too far
					if (hitItem.SubField != null)
					{
						if (!(accessibleObject is SubfieldAccessibleObject))
						{
							if (!(accessibleObject is FieldAccessibleObject))
							{
								hitItem = new DiagramItem(hitItem.Shape);
							}
							else
							{
								hitItem = new DiagramItem(hitItem.Shape, hitItem.Field);
							}
						}
					}
					else if (hitItem.Field != null && !(accessibleObject is FieldAccessibleObject))
					{
						hitItem = new DiagramItem(hitItem.Shape);
					}
				}
			}
			return hitItem;
		}
Ejemplo n.º 9
0
		/// <summary>
		/// Click on an accessible object. The caller should make sure that the
		/// accessible object is visible before making this call.
		/// </summary>
		/// <param name="accessibleObject">A child accessible object to click on</param>
		public void ClickAccessibleObject(AccessibleObject accessibleObject)
		{
			ClickAccessibleObject(accessibleObject, 1, ClickLocation.Center, 0, 0);
		}
Ejemplo n.º 10
0
 /// <include file='doc\DomainUpDown.uex' path='docs/doc[@for="DomainUpDown.DomainItemAccessibleObject.DomainItemAccessibleObject"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public DomainItemAccessibleObject(string name, AccessibleObject parent) : base()
 {
     this.name   = name;
     this.parent = (DomainItemListAccessibleObject)parent;
 }
Ejemplo n.º 11
0
            internal Rectangle GetAccessibleObjectBounds(AccessibleObject parentAccObject)
            {
                if (this.owner == null)
                {
                    throw new InvalidOperationException(SR.GetString(SR.DataGridViewCellAccessibleObject_OwnerNotSet));
                }

                if (this.owner.OwningColumn == null)
                {
                    return Rectangle.Empty;
                }

                // use the accessibility bounds from the parent row acc obj
                Rectangle rowRect = parentAccObject.Bounds;
                Rectangle columnRect;

                int firstVisibleColumnIndex = this.owner.DataGridView.Columns.ColumnIndexToActualDisplayIndex(this.owner.DataGridView.FirstDisplayedScrollingColumnIndex, DataGridViewElementStates.Visible);
                int visibleColumnIndex = this.owner.DataGridView.Columns.ColumnIndexToActualDisplayIndex(this.owner.ColumnIndex, DataGridViewElementStates.Visible);

                bool rowHeadersVisible = this.owner.DataGridView.RowHeadersVisible;
                if (visibleColumnIndex < firstVisibleColumnIndex)
                {
                    // Get the bounds for the cell to the RIGHT
                    columnRect = parentAccObject.GetChild(visibleColumnIndex
                                                          + 1                                       // + 1 for the next cell to the RIGHT
                                                          + (rowHeadersVisible ? 1 : 0)).Bounds;    // + 1 but only if the row headers are visible

                    // From the bounds of the cell to the RIGHT decrement the width of the owning column
                    if (this.Owner.DataGridView.RightToLeft == RightToLeft.No)
                    {
                        columnRect.X -= this.owner.OwningColumn.Width;
                    }
                    else
                    {
                        columnRect.X = columnRect.Right;
                    }
                    columnRect.Width = this.owner.OwningColumn.Width;
                }
                else if (visibleColumnIndex == firstVisibleColumnIndex)
                {
                    columnRect = this.owner.DataGridView.GetColumnDisplayRectangle(this.owner.ColumnIndex, false /*cutOverflow*/);
                    int negOffset = this.owner.DataGridView.FirstDisplayedScrollingColumnHiddenWidth;

                    if (negOffset != 0)
                    {
                        if (this.owner.DataGridView.RightToLeft == RightToLeft.No)
                        {
                            columnRect.X -= negOffset;
                        }
                        columnRect.Width += negOffset;
                    }
                    columnRect = this.owner.DataGridView.RectangleToScreen(columnRect);
                }
                else
                {
                    // Get the bounds for the cell to the LEFT
                    columnRect = parentAccObject.GetChild(visibleColumnIndex
                                                          - 1                                       // -1 because we want the previous cell to the LEFT
                                                          + (rowHeadersVisible ? 1 : 0)).Bounds;    // +1 but only if the row headers are visible

                    // From the bounds of the cell to the LEFT increment the width of the owning column
                    if (this.owner.DataGridView.RightToLeft == RightToLeft.No)
                    {
                        columnRect.X = columnRect.Right;
                    }
                    else
                    {
                        columnRect.X -= this.owner.OwningColumn.Width;
                    }

                    columnRect.Width = this.owner.OwningColumn.Width;
                }

                rowRect.X = columnRect.X;
                rowRect.Width = columnRect.Width;

                return rowRect;
            }
 internal Rectangle GetAccessibleObjectBounds(AccessibleObject parentAccObject)
 {
     Rectangle columnDisplayRectangle;
     if (this.owner == null)
     {
         throw new InvalidOperationException(System.Windows.Forms.SR.GetString("DataGridViewCellAccessibleObject_OwnerNotSet"));
     }
     if (this.owner.OwningColumn == null)
     {
         return Rectangle.Empty;
     }
     Rectangle bounds = parentAccObject.Bounds;
     int num = this.owner.DataGridView.Columns.ColumnIndexToActualDisplayIndex(this.owner.DataGridView.FirstDisplayedScrollingColumnIndex, DataGridViewElementStates.Visible);
     int num2 = this.owner.DataGridView.Columns.ColumnIndexToActualDisplayIndex(this.owner.ColumnIndex, DataGridViewElementStates.Visible);
     bool rowHeadersVisible = this.owner.DataGridView.RowHeadersVisible;
     if (num2 < num)
     {
         columnDisplayRectangle = parentAccObject.GetChild((num2 + 1) + (rowHeadersVisible ? 1 : 0)).Bounds;
         if (this.Owner.DataGridView.RightToLeft == RightToLeft.No)
         {
             columnDisplayRectangle.X -= this.owner.OwningColumn.Width;
         }
         else
         {
             columnDisplayRectangle.X = columnDisplayRectangle.Right;
         }
         columnDisplayRectangle.Width = this.owner.OwningColumn.Width;
     }
     else if (num2 == num)
     {
         columnDisplayRectangle = this.owner.DataGridView.GetColumnDisplayRectangle(this.owner.ColumnIndex, false);
         int firstDisplayedScrollingColumnHiddenWidth = this.owner.DataGridView.FirstDisplayedScrollingColumnHiddenWidth;
         if (firstDisplayedScrollingColumnHiddenWidth != 0)
         {
             if (this.owner.DataGridView.RightToLeft == RightToLeft.No)
             {
                 columnDisplayRectangle.X -= firstDisplayedScrollingColumnHiddenWidth;
             }
             columnDisplayRectangle.Width += firstDisplayedScrollingColumnHiddenWidth;
         }
         columnDisplayRectangle = this.owner.DataGridView.RectangleToScreen(columnDisplayRectangle);
     }
     else
     {
         columnDisplayRectangle = parentAccObject.GetChild((num2 - 1) + (rowHeadersVisible ? 1 : 0)).Bounds;
         if (this.owner.DataGridView.RightToLeft == RightToLeft.No)
         {
             columnDisplayRectangle.X = columnDisplayRectangle.Right;
         }
         else
         {
             columnDisplayRectangle.X -= this.owner.OwningColumn.Width;
         }
         columnDisplayRectangle.Width = this.owner.OwningColumn.Width;
     }
     bounds.X = columnDisplayRectangle.X;
     bounds.Width = columnDisplayRectangle.Width;
     return bounds;
 }
Ejemplo n.º 13
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;
		}
            internal AccessibleObject GetNext(AccessibleObject child) {
                int children = GetChildCount();
                bool hit = false;

                for (int i=0; i<children; i++) {
                    if (hit) {
                        return GetChild(i);
                    }
                    if (GetChild(i) == child) {
                        hit = true;
                    }
                }

                return null;
            }
            internal AccessibleObject GetPrev(AccessibleObject child) {
                int children = GetChildCount();
                bool hit = false;

                for (int i=children-1; i>=0; i--) {
                    if (hit) {
                        return GetChild(i);
                    }
                    if (GetChild(i) == child) {
                        hit = true;
                    }
                }

                return null;
            }
Ejemplo n.º 16
0
 public DomainItemAccessibleObject(string name, AccessibleObject parent)
 {
     throw null;
 }
Ejemplo n.º 17
0
            public string GetCalendarChildName(int calendarIndex, CalendarChildType calendarChildType, AccessibleObject parentAccessibleObject = null, int index = -1)
            {
                switch (calendarChildType)
                {
                case CalendarChildType.CalendarHeader:
                    GetCalendarGridInfoText(ComCtl32.MCGIP.CALENDARHEADER, calendarIndex, 0, 0, out string text);
                    return(text);

                case CalendarChildType.TodayLink:
                    return(string.Format(SR.MonthCalendarTodayButtonAccessibleName, _owner.TodayDate.ToShortDateString()));
                }
                ;

                return(string.Empty);
            }
Ejemplo n.º 18
0
 public DomainItemAccessibleObject(string name, AccessibleObject parent)
 {
     this.name   = name;
     this.parent = parent;
 }
Ejemplo n.º 19
0
 public EnumVariantObject(AccessibleObject owner, uint currentChild)
 {
     Debug.Assert(owner != null, "Cannot create EnumVariantObject with a null owner");
     this.owner        = owner;
     this.currentChild = currentChild;
 }
Ejemplo n.º 20
0
		/// <summary>
		/// Dump a hierarchical accessibility report to the debug output window
		/// </summary>
		/// <param name="parent">The top element to report on</param>
		public static void DumpAccessibilityReport(AccessibleObject parent)
		{
			DumpAccessibilityReport(parent, "");
		}
Ejemplo n.º 21
0
 public CalendarChildAccessibleObject GetCalendarChildAccessibleObject(int calendarIndex, CalendarChildType calendarChildType, AccessibleObject parentAccessibleObject = null, int index = -1) =>
 calendarChildType switch
 {
Ejemplo n.º 22
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);
				}
			}
		}
Ejemplo n.º 23
0
		protected override AccessibleObject CreateAccessibilityInstance() {
			AccessibleObject	acc;

			acc = new AccessibleObject(this);
			acc.role = AccessibleRole.SpinButton;

			return acc;
		}
Ejemplo n.º 24
0
        void TypeShortcut(AccessibleObject item)
        {
            Sleep(1000);

            AccessibleObject parent = item.Parent;
            if (parent.Role == AccessibleRole.MenuItem)
            {
                TypeShortcut(parent);
            }
            string shortcut = item.KeyboardShortcut;
            if (!string.IsNullOrEmpty(shortcut))
            {
                SendShortcut(shortcut);
            }
            else {
                throw new NotImplementedException("InvokeAsyncMenuItem can't work without menu item shortcuts");
            }

            if (item.Role == AccessibleRole.MenuItem)
            {
                // this isn't working for some reason.
                // WaitForPopupMenu();
                Sleep(200);
            }
        }
Ejemplo n.º 25
0
 internal override void SetParent(AccessibleObject parent)
 {
     _parentAccessibleObject = parent;
 }
Ejemplo n.º 26
0
 internal override void SetDetachableChild(AccessibleObject child)
 {
     _child = child;
 }
Ejemplo n.º 27
0
		/// <summary>
		/// Turn an accessibleObject into an element in the underlying model.
		/// </summary>
		/// <param name="accessibleObject">The accessible object</param>
		/// <param name="returnShape">True to return the shape object corresponding to the
		/// accessible object instead of the underlying model element. Note that you may get
		/// a shape for a parent object if the requested accessible object is drawn as part
		/// of another object and does not have its own shape (roles, internal uniqueness constraints, etc)</param>
		/// <returns>ModelElement, or null</returns>
		public ModelElement TranslateAccessibleObject(AccessibleObject accessibleObject, bool returnShape)
		{
			DiagramItem hitItem = TranslateAccessibleObjectToDiagramItem(accessibleObject, returnShape);
			if (hitItem == null)
			{
				return null;
			}
			else if (returnShape)
			{
				return hitItem.Shape;
			}
			else
			{
				ModelElement retVal = null;
				foreach (object element in hitItem.RepresentedElements)
				{
					retVal = element as ModelElement;
					break;
				}
				PresentationElement pel = retVal as PresentationElement;
				if (pel != null)
				{
					// Resolve to a ModelElement if we don't have one already
					retVal = pel.ModelElement;
				}
				return retVal;
			}
		}
 internal InternalAccessibleObject(AccessibleObject accessibleImplemention) {
     // Get all the casts done here to catch any issues early 
     publicIAccessible = (IAccessible) accessibleImplemention;
     publicIEnumVariant = (UnsafeNativeMethods.IEnumVariant) accessibleImplemention;
     publicIOleWindow = (UnsafeNativeMethods.IOleWindow) accessibleImplemention;
     publicIReflect = (IReflect) accessibleImplemention;
     // Note: Deliberately not holding onto AccessibleObject to enforce all access through the interfaces
 }
Ejemplo n.º 29
0
		/// <summary>
		/// Click on an accessible object. The caller should make sure that the
		/// accessible object is visible before making this call.
		/// </summary>
		/// <param name="accessibleObject">A child accessible object to click on</param>
		/// <param name="clicks">The number of clicks (1 for single click, 2 for double)</param>
		public void ClickAccessibleObject(AccessibleObject accessibleObject, int clicks)
		{
			ClickAccessibleObject(accessibleObject, clicks, ClickLocation.Center, 0, 0);
		}
 public EnumVariantObject(AccessibleObject owner)
 {
     this.owner = owner;
 }
Ejemplo n.º 31
0
		/// <summary>
		/// End a drag operation with a drop on an accessible object. The caller should make sure that the
		/// accessible object is visible before making this call.
		/// </summary>
		/// <param name="accessibleObject">A child accessible object to drop on</param>
		public void DropOnAccessibleObject(AccessibleObject accessibleObject)
		{
			DropOnAccessibleObject(accessibleObject, ClickLocation.Center, 0, 0);
		}
 public EnumVariantObject(AccessibleObject owner, int currentChild)
 {
     this.owner = owner;
     this.currentChild = currentChild;
 }
Ejemplo n.º 33
0
		/// <summary>
		/// Make sure an accessible object is visible. Returns a new AccessibleObject with
		/// different bounds. Using this method with an "ORMDiagram" accessible object is not
		/// recommended (it will zoom out the diagram until the full diagram fits in the window).
		/// Use the EnsurePointVisible method instead to show a specific point on the diagram.
		/// </summary>
		/// <param name="accessibleObject">Accessible object to bring into view</param>
		/// <returns>Updated accessible object</returns>
		public AccessibleObject EnsureAccessibleObjectVisible(AccessibleObject accessibleObject)
		{
			AccessibleObject retVal = accessibleObject;
			DiagramItem hitItem = TranslateAccessibleObjectToDiagramItem(accessibleObject, false);
			if (hitItem != null)
			{
				myClientView.EnsureVisible(hitItem.AbsoluteBoundingBox);
				retVal = hitItem.GetAccessibleObject(myClientView);
				SendKeys.Flush();
			}
			return retVal;
		}
 private IAccessible AsIAccessible(AccessibleObject obj)
 {
     if ((obj != null) && obj.systemWrapper)
     {
         return obj.systemIAccessible;
     }
     return obj;
 }
Ejemplo n.º 35
0
 public EnumVariantObject(AccessibleObject owner)
 {
     Debug.Assert(owner != null, "Cannot create EnumVariantObject with a null owner");
     this.owner = owner;
 }
 private object AsVariant(AccessibleObject obj)
 {
     if (obj == this)
     {
         return 0;
     }
     return this.AsIAccessible(obj);
 }
Ejemplo n.º 37
0
            /// <summary>
            ///  Perform custom navigation between parent/child/sibling accessible objects,
            ///  using tab index order as the guide, rather than letting the system default
            ///  behavior do navigation based on z-order.
            ///
            ///  For a container control and its child controls, the accessible object tree
            ///  looks like this...
            ///
            ///  [client area of container]
            ///   [non-client area of child #1]
            ///       [random non-client elements]
            ///       [client area of child #1]
            ///       [random non-client elements]
            ///   [non-client area of child #2]
            ///       [random non-client elements]
            ///       [client area of child #2]
            ///       [random non-client elements]
            ///   [non-client area of child #3]
            ///       [random non-client elements]
            ///       [client area of child #3]
            ///       [random non-client elements]
            ///
            ///  We need to intercept first-child / last-child navigation from the container's
            ///  client object, and next-sibling / previous-sibling navigation from each child's
            ///  non-client object. All other navigation operations must be allowed to fall back
            ///  on the system's deafult behavior (provided by OLEACC.DLL).
            ///
            ///  When combined with the re-ordering behavior of GetSysChildOrder() above, this
            ///  allows us to present the end user with the illusion of accessible objects in
            ///  tab index order, even though the system behavior only supports z-order.
            /// </summary>
            internal override bool GetSysChild(AccessibleNavigation navdir, out AccessibleObject accessibleObject)
            {
                // Clear the out parameter
                accessibleObject = null;

                // Get the owning control's parent, if it has one
                Control parentControl = Owner.ParentInternal;

                // ctrls[index] will indicate the control at the destination of this navigation operation
                int index = -1;

                Control[] ctrls = null;

                // Now handle any 'appropriate' navigation requests...
                switch (navdir)
                {
                case AccessibleNavigation.FirstChild:
                    if (IsClientObject)
                    {
                        ctrls = Owner.GetChildControlsInTabOrder(true);
                        index = 0;
                    }
                    break;

                case AccessibleNavigation.LastChild:
                    if (IsClientObject)
                    {
                        ctrls = Owner.GetChildControlsInTabOrder(true);
                        index = ctrls.Length - 1;
                    }
                    break;

                case AccessibleNavigation.Previous:
                    if (IsNonClientObject && parentControl != null)
                    {
                        ctrls = parentControl.GetChildControlsInTabOrder(true);
                        index = Array.IndexOf(ctrls, Owner);
                        if (index != -1)
                        {
                            --index;
                        }
                    }
                    break;

                case AccessibleNavigation.Next:
                    if (IsNonClientObject && parentControl != null)
                    {
                        ctrls = parentControl.GetChildControlsInTabOrder(true);
                        index = Array.IndexOf(ctrls, Owner);
                        if (index != -1)
                        {
                            ++index;
                        }
                    }
                    break;
                }

                // Unsupported navigation operation for this object, or unexpected error.
                // Return false to force fall back on default system navigation behavior.
                if (ctrls == null || ctrls.Length == 0)
                {
                    return(false);
                }

                // If ctrls[index] is a valid control, return its non-client accessible object.
                // If index is invalid, return null pointer meaning "end of list reached".
                if (index >= 0 && index < ctrls.Length)
                {
                    accessibleObject = ctrls[index].NcAccessibilityObject;
                }

                // Return true to use the found accessible object and block default system behavior
                return(true);
            }
 public EnumVariantObject(AccessibleObject owner, int currentChild) {
     Debug.Assert(owner != null, "Cannot create EnumVariantObject with a null owner");
     this.owner = owner;
     this.currentChild = currentChild;
 }
Ejemplo n.º 39
0
            private void WmGetObject(ref Message m)
            {
                if (m.LParam == (IntPtr)NativeMethods.UiaRootObjectId)
                {
                    AccessibleObject uiaProvider = GetChildAccessibleObject(_childWindowType);

                    // If the requested object identifier is UiaRootObjectId,
                    // we should return an UI Automation provider using the UiaReturnRawElementProvider function.
                    InternalAccessibleObject internalAccessibleObject = new InternalAccessibleObject(uiaProvider);
                    m.Result = UiaCore.UiaReturnRawElementProvider(
                        new HandleRef(this, Handle),
                        m.WParam,
                        m.LParam,
                        internalAccessibleObject);

                    return;
                }

                // See "How to Handle WM_GETOBJECT" in MSDN
                //
                if (unchecked ((int)(long)m.LParam) == OBJID.CLIENT)
                {
                    // Get the IAccessible GUID
                    //
                    Guid IID_IAccessible = new Guid(NativeMethods.uuid_IAccessible);

                    // Get an Lresult for the accessibility Object for this control
                    //
                    IntPtr punkAcc;
                    try
                    {
                        AccessibleObject            wfAccessibleObject = null;
                        UiaCore.IAccessibleInternal iacc = null;

                        if (_accessibilityObject is null)
                        {
                            wfAccessibleObject   = GetChildAccessibleObject(_childWindowType);
                            _accessibilityObject = new InternalAccessibleObject(wfAccessibleObject);
                        }
                        iacc = (UiaCore.IAccessibleInternal)_accessibilityObject;

                        // Obtain the Lresult
                        //
                        punkAcc = Marshal.GetIUnknownForObject(iacc);

                        try
                        {
                            m.Result = Oleacc.LresultFromObject(ref IID_IAccessible, m.WParam, new HandleRef(this, punkAcc));
                        }
                        finally
                        {
                            Marshal.Release(punkAcc);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new InvalidOperationException(SR.RichControlLresult, e);
                    }
                }
                else
                {  // m.lparam != OBJID_CLIENT, so do default message processing
                    DefWndProc(ref m);
                }
            }
            private void WmGetObject(ref Message m)
            {
                if (m.LParam == (IntPtr)NativeMethods.UiaRootObjectId &&
                    // Managed UIAutomation providers are supplied for child list windows but not for the child edit window.
                    // Child list accessibility object provides all necessary patterns and UIAutomation notifications,
                    // so there is no need to native provider supplement.
                    // Child edit accessibility object has only partial support of edit box accessibility, most of the patterns
                    // and notifications for child edit window are supplied by native providers, so here is no need to
                    // override root UIA object for child edit window.
                    (_childWindowType == ChildWindowType.ListBox || _childWindowType == ChildWindowType.DropDownList))
                {
                    AccessibleObject uiaProvider = GetChildAccessibleObject(_childWindowType);

                    // If the requested object identifier is UiaRootObjectId,
                    // we should return an UI Automation provider using the UiaReturnRawElementProvider function.
                    InternalAccessibleObject internalAccessibleObject = new InternalAccessibleObject(uiaProvider);
                    m.Result = UiaCore.UiaReturnRawElementProvider(
                        new HandleRef(this, Handle),
                        m.WParam,
                        m.LParam,
                        internalAccessibleObject);

                    return;
                }

                // See "How to Handle WM_GETOBJECT" in MSDN
                //
                if (unchecked ((int)(long)m.LParam) == OBJID.CLIENT)
                {
                    // Get the IAccessible GUID
                    //
                    Guid IID_IAccessible = new Guid(NativeMethods.uuid_IAccessible);

                    // Get an Lresult for the accessibility Object for this control
                    //
                    IntPtr punkAcc;
                    try
                    {
                        AccessibleObject            wfAccessibleObject = null;
                        UiaCore.IAccessibleInternal iacc = null;

                        if (_accessibilityObject is null)
                        {
                            wfAccessibleObject   = GetChildAccessibleObject(_childWindowType);
                            _accessibilityObject = new InternalAccessibleObject(wfAccessibleObject);
                        }
                        iacc = (UiaCore.IAccessibleInternal)_accessibilityObject;

                        // Obtain the Lresult
                        //
                        punkAcc = Marshal.GetIUnknownForObject(iacc);

                        try
                        {
                            m.Result = Oleacc.LresultFromObject(ref IID_IAccessible, m.WParam, new HandleRef(this, punkAcc));
                        }
                        finally
                        {
                            Marshal.Release(punkAcc);
                        }
                    }
                    catch (Exception e)
                    {
                        throw new InvalidOperationException(SR.RichControlLresult, e);
                    }
                }
                else
                {  // m.lparam != OBJID_CLIENT, so do default message processing
                    DefWndProc(ref m);
                }
            }
Ejemplo n.º 41
0
 /// <include file='doc\DomainUpDown.uex' path='docs/doc[@for="DomainUpDown.DomainItemAccessibleObject.DomainItemAccessibleObject"]/*' />
 /// <devdoc>
 ///    <para>[To be supplied.]</para>
 /// </devdoc>
 public DomainItemAccessibleObject(string name, AccessibleObject parent) : base() {
     this.name = name;
     this.parent = (DomainItemListAccessibleObject)parent;
 }
Ejemplo n.º 42
0
 public CalendarCellAccessibleObject(MonthCalendarAccessibleObject calendarAccessibleObject, int calendarIndex, AccessibleObject parentAccessibleObject, int rowIndex, int columnIndex, string name)
     : base(calendarAccessibleObject, calendarIndex, CalendarChildType.CalendarCell, parentAccessibleObject, rowIndex * columnIndex)
 {
     _rowIndex    = rowIndex;
     _columnIndex = columnIndex;
     _name        = name;
 }
Ejemplo n.º 43
0
			public DomainItemAccessibleObject(string name, AccessibleObject parent) {
				this.name = name;
				this.parent = parent;
			}
Ejemplo n.º 44
0
            public AutoHideStripAccessibleObject(AutoHideStrip strip, DockState state, AccessibleObject parent)
            {
                _strip = strip;
                _state = state;

                Parent = parent;
            }