示例#1
0
        /// <summary>
        /// Handle mouse up to handle selection and link click.
        /// </summary>
        /// <param name="parent">the control hosting the html to invalidate</param>
        /// <param name="e">the mouse event args</param>
        public void HandleMouseUp(Control parent, MouseEventArgs e)
        {
            ArgChecker.AssertArgNotNull(parent, "parent");
            ArgChecker.AssertArgNotNull(e, "e");

            try
            {
                if (_selectionHandler != null && IsMouseInContainer(e.Location))
                {
                    bool ignore = _selectionHandler.HandleMouseUp(parent, e.Button);
                    if (!ignore && (e.Button & MouseButtons.Left) != 0)
                    {
                        Point  loc  = OffsetByScroll(e.Location);
                        CssBox link = DomUtils.GetLinkBox(_root, loc);
                        if (link != null)
                        {
                            HandleLinkClicked(parent, e, link);
                        }
                    }
                }
            }
            catch (HtmlLinkClickedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                ReportError(HtmlRenderErrorType.KeyboardMouse, "Failed mouse up handle", ex);
            }
        }
示例#2
0
        /// <summary>
        /// Handle mouse up to handle selection and link click.
        /// </summary>
        /// <param name="parent">the control hosting the html to invalidate</param>
        /// <param name="location">the location of the mouse</param>
        /// <param name="e">the mouse event data</param>
        public void HandleMouseUp(RControl parent, RPoint location, RMouseEvent e)
        {
            ArgChecker.AssertArgNotNull(parent, "parent");

            try
            {
                if (_selectionHandler != null && IsMouseInContainer(location))
                {
                    var ignore = _selectionHandler.HandleMouseUp(parent, e.LeftButton);
                    if (!ignore && e.LeftButton)
                    {
                        var loc  = OffsetByScroll(location);
                        var link = DomUtils.GetLinkBox(_root, loc);
                        if (link != null)
                        {
                            HandleLinkClicked(parent, location, link);
                        }
                    }
                }
            }
            catch (HtmlLinkClickedException)
            {
                throw;
            }
            catch (Exception ex)
            {
                ReportError(HtmlRenderErrorType.KeyboardMouse, "Failed mouse up handle", ex);
            }
        }
示例#3
0
        /// <summary>
        /// Handle mouse up to handle selection and link click.
        /// </summary>
        /// <param name="parent">the control hosting the html to invalidate</param>
        /// <param name="e">the mouse event args</param>
        public void HandleMouseUp(Control parent, MouseEventArgs e)
        {
            ArgChecker.AssertArgNotNull(parent, "parent");
            ArgChecker.AssertArgNotNull(e, "e");

            if (_selectionHandler != null)
            {
                var inSelection = _selectionHandler.HandleMouseUp(parent, e.Button);
                if (!inSelection && (e.Button & MouseButtons.Left) != 0)
                {
                    var loc  = OffsetByScroll(e.Location);
                    var link = DomUtils.GetLinkBox(_root, loc);
                    if (link != null)
                    {
                        if (LinkClicked != null)
                        {
                            var args = new HtmlLinkClickedEventArgs(link.GetAttribute("href"));
                            LinkClicked(this, args);
                            if (args.Handled)
                            {
                                return;
                            }
                        }

                        CssValueParser.GoLink(link.GetAttribute("href", string.Empty), Bridge);
                    }
                }
            }
        }