public Element (Accessible accessible) { extraChildren = new List<Element> (); if (!elements.ContainsKey (accessible)) elements [accessible] = this; patterns = new List<ISourceEventHandler> (); this.accessible = accessible; runtimeId = -1; if (accessible.Role == Role.Dialog && accessible.Parent.Role == Role.Application && accessible.QueryComponent () != null) { // Try to figure out if the dialog is painted // on top of another window BoundingBox curExtents = accessible.QueryComponent ().GetExtents (CoordType.Screen); int count = accessible.Parent.Children.Count; for (int i = 0; i < count; i++) { Accessible child = accessible.Parent.Children [i]; if (child == null || child.Role != Role.Frame) continue; Component childComponent = child.QueryComponent (); if (childComponent == null) continue; BoundingBox windowExtents = childComponent.GetExtents (CoordType.Screen); if (windowExtents.X <= curExtents.X && windowExtents.Y <= curExtents.Y && (windowExtents.X + windowExtents.Width) > curExtents.X && (windowExtents.Y + windowExtents.Height) > curExtents.Y) { parent = GetElement (child); parent.extraChildren.Add (this); break; } } } if (parent == null) parent = GetElement (accessible.Parent); AddEvents (true); }