Пример #1
0
        /// <summary>
        /// Removes the provided popup from the popups of the PopupManager and unregisters the message hook
        /// if there are no more popups.
        /// </summary>
        /// <param name="form">The popup to remove.</param>
        public void RemovePopup(IPopupControl form)
        {
            if (popups.Contains(form))
            {
                while (form.Children.Count > 0)
                {
                    IPopupControl child = form.Children[form.Children.Count - 1];

                    child.ClosePopup(RadPopupCloseReason.ParentClosed);
                }

                IPopupControl ownerPopup = form.OwnerPopup;

                if (ownerPopup != null)
                {
                    System.Diagnostics.Debug.Assert(
                        ownerPopup.Children.Contains(form),
                        "Not contained in owner's Children collection!");
                    ownerPopup.Children.Remove(form);
                }

                popups.Remove(form);
            }

            if (popups.Count == 0)
            {
                this.lastActivatedPopup = null;
                RadMessageFilter.Instance.RemoveListener(this);
                this.hooked = false;
            }
            else
            {
                this.lastActivatedPopup = this.popups[this.popups.Count - 1];
            }
        }
Пример #2
0
        protected void CheckMouseDown(Control control, Point mousePosition)
        {
            Control       popup = Popup as Control;
            IPopupControl pc    = Popup;

            if (pc == null || !popup.Created || !popup.Visible || pc.PopupWindow == null || !pc.PopupWindow.Visible)
            {
                return;
            }

            Control parent = GetParent(pc.PopupWindow);

            if (parent.Contains(control) || parent == control || popup == control || popup.Contains(control))
            {
                return;
            }

            if (IsPopupMenu(control))
            {
                return;
            }

            if (!pc.AllowMouseClick(control, mousePosition))
            {
                pc.ClosePopup();
            }
        }
Пример #3
0
        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;
                }
            }
        }
Пример #4
0
        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);
        }
Пример #5
0
        /// <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;
                }
            }
        }
Пример #6
0
        /// <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;
                    }
                }
            }
        }
Пример #7
0
        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;
                }
            }
        }
Пример #8
0
 protected void ClosePopups()
 {
     Popup.ClosePopup();
 }