/// <summary> /// Enqueues a popup at the next position within the queue. /// </summary> /// <param name="popup">The popup to enqueue.</param> public void Enqueue(Popup popup) { Contract.Require(popup, "popup"); if (next == null) { queue.AddLast(popup); } else { queue.AddBefore(next, popup); } }
/// <summary> /// Performs a hit test against the contents of the queue. /// </summary> /// <param name="point">A point in device-independent screen space to test against the contents of the queue.</param> /// <param name="popup">The popup that contains the resulting visual.</param> /// <returns>The topmost <see cref="Visual"/> that contains the specified point, /// or <c>null</c> if none of the items in the queue contain the point.</returns> public Visual HitTest(Point2D point, out Popup popup) { if (queue.Count == 0) { popup = null; return null; } for (var current = queue.Last; current != null; current = current.Previous) { if (current.Value.IsHitTestVisible) { var match = current.Value.PopupHitTest(point); if (match != null) { popup = current.Value; return match; } } } popup = null; return null; }
/// <summary> /// Gets a value indicating whether the queue is currently drawing the specified popup. /// </summary> /// <param name="popup">The popup to evaluate.</param> /// <returns><c>true</c> if the queue is currently drawing the specified popup; otherwise, <c>false</c>.</returns> public Boolean IsDrawingPopup(Popup popup) { return position != null && position.Value == popup; }