internal void OnMouseDown(Point cursorPos) { int num = this.popups.Count - 1; bool flag1 = false; while (num > -1 && this.popups.Count > 0) { IPopupControl popup = this.popups[num--]; bool flag2 = popup.Bounds.Contains(cursorPos); if (!flag1 && !flag2) { if (popup.CanClosePopup(RadPopupCloseReason.Mouse)) { PopupCloseInfo closeInfo = new PopupCloseInfo(RadPopupCloseReason.Mouse, (object)null); popup.ClosePopup(closeInfo); flag1 = !closeInfo.Closed; } else { flag1 = true; } } else if (popup.OwnerPopup == null) { flag1 = false; } else if (flag2) { flag1 = true; } } }
public bool ClosePopup(IPopupControl popup) { if (!this.ContainsPopup(popup) || !popup.CanClosePopup(RadPopupCloseReason.CloseCalled)) { return(false); } PopupCloseInfo closeInfo = new PopupCloseInfo(RadPopupCloseReason.CloseCalled, (object)null); popup.ClosePopup(closeInfo); return(closeInfo.Closed); }
/// <summary> /// Closes all popups from a leaf to the root. /// </summary> /// <param name="reason">The reason why popups are closed.</param> /// <param name="leaf">The leaf popup from which to start closing the hierarchy.</param> public void CloseAllToRoot(RadPopupCloseReason reason, IPopupControl leaf) { if (leaf.Children.Count > 0) { throw new InvalidOperationException("The provided IPopupControl is not a leaf"); } bool finished = false; if (leaf.CanClosePopup(reason)) { PopupCloseInfo info = new PopupCloseInfo(reason, null); leaf.ClosePopup(info); if (!info.Closed) { return; } } else { return; } IPopupControl parent = leaf.OwnerPopup; while (!finished) { if (parent != null && parent.CanClosePopup(reason)) { PopupCloseInfo info = new PopupCloseInfo(reason, null); parent.ClosePopup(info); if (!info.Closed) { finished = true; } parent = parent.OwnerPopup; } else { finished = true; } } }
/// <summary> /// This method begins to close all IPopupControl instances /// starting from the end of the collection. If a IPopupControl /// cannot be closed, the iteration stops and all popups previously added /// to the collection will not be closed. /// </summary> internal void OnMouseDown(Point cursorPos) { System.Diagnostics.Debug.Assert(this.popups.Count != 0, "Popup count must not be equal to zero when receiving this event!"); int i = this.popups.Count - 1; bool blockOwners = false; while (i > -1 && this.popups.Count > 0) { IPopupControl currentPopup = this.popups[i--]; bool containsMouse = currentPopup.Bounds.Contains(cursorPos); if (!blockOwners && !containsMouse) { if (currentPopup.CanClosePopup(RadPopupCloseReason.Mouse)) { PopupCloseInfo closeInfo = new PopupCloseInfo(RadPopupCloseReason.Mouse, null); currentPopup.ClosePopup(closeInfo); blockOwners = !closeInfo.Closed; } else { blockOwners = true; } } else { if (currentPopup.OwnerPopup == null) { blockOwners = false; } else if (containsMouse) { blockOwners = true; } } } }
public void CloseAllToRoot(RadPopupCloseReason reason, IPopupControl leaf) { if (leaf.Children.Count > 0) { return; } bool flag = false; if (!leaf.CanClosePopup(reason)) { return; } PopupCloseInfo closeInfo1 = new PopupCloseInfo(reason, (object)null); leaf.ClosePopup(closeInfo1); if (!closeInfo1.Closed) { return; } IPopupControl ownerPopup = leaf.OwnerPopup; while (!flag) { if (ownerPopup != null && ownerPopup.CanClosePopup(reason)) { PopupCloseInfo closeInfo2 = new PopupCloseInfo(reason, (object)null); ownerPopup.ClosePopup(closeInfo2); if (!closeInfo2.Closed) { flag = true; } ownerPopup = ownerPopup.OwnerPopup; } else { flag = true; } } }