AtspiUiaSource.AutomationSource.GetElementFromHandle C# (CSharp) Method

GetElementFromHandle() public method

public GetElementFromHandle ( IntPtr handle ) : IElement
handle System.IntPtr
return IElement
		public IElement GetElementFromHandle (IntPtr handle)
		{
			var win = Gdk.Window.ForeignNew ((uint) handle);
			if (win == null)
				return null;
			int x, y, width, height, depth;
			win.GetGeometry (out x, out y, out width, out height, out depth);
			win.GetOrigin (out x, out y);
			foreach (IElement element in GetRootElements ()) {
				Component component = ((Element)element).Accessible.QueryComponent ();
				if (component != null) {
					BoundingBox extents = component.GetExtents (CoordType.Screen);
					if (SizeFits (extents, x, y, width, height)) {
						Accessible ret = component.GetAccessibleAtPoint (x, y, CoordType.Screen);
						if (ret == null)
							return element;
						return Element.GetElement (ret);
					}
				}
			}
			return null;
		}