void ContentMenu_EventHandler(object sender, HtmlEventArgs e)
 {
     e.PreventDefault();
     e.StopPropagation();
     Point point = new Point(e.OffsetX, e.OffsetY);
     if (AgControlBase.GetSLBounds(this).Contains(point))
     {
         OnShowContextMenu(point);
     }
 }
            private void HandleMouseWheel(object sender, HtmlEventArgs args)
            {
                double delta = 0;

                ScriptObject eventObj = args.EventObject;

                if (eventObj.GetProperty("wheelDelta") != null)
                {
                    delta = ((double)eventObj.GetProperty("wheelDelta")) / 120;


                    if (HtmlPage.Window.GetProperty("opera") != null)
                        delta = -delta;
                }
                else if (eventObj.GetProperty("detail") != null)
                {
                    delta = -((double)eventObj.GetProperty("detail")) / 3;

                    if (HtmlPage.BrowserInformation.UserAgent.IndexOf("Macintosh") != -1)
                        delta = delta * 3;
                }

                if (delta != 0 && this.Moved != null)
                {
                    MouseWheelEventArgs wheelArgs = new MouseWheelEventArgs(delta);
                    wheelArgs.IsHorizontal = args.ShiftKey;
                    this.Moved(this, wheelArgs);

                    if (wheelArgs.BrowserEventHandled)
                        args.PreventDefault();
                }
            }
 void ContentMenu_EventHandler(object sender, HtmlEventArgs e)
 {
     Rect bounds = AgControlBase.GetSLBounds(this);
     if (bounds.Contains(new Point(e.ClientX, e.ClientY)))
     {
         e.PreventDefault();
         e.StopPropagation();
         this.ContextMenu.SetLocation(new Point(e.OffsetX, e.OffsetY));
         this.ContextMenu.IsDropDownOpen = true;
     }
 }
        /// <summary>
        /// Handles the mouse wheel.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="args">Html Event args.</param>
        private void HandleMouseWheel(object sender, HtmlEventArgs args)
        {
            double delta = 0;

            ScriptObject eventObj = args.EventObject;

            if (eventObj.GetProperty("wheelDelta") != null)
            {
                delta = ((double)eventObj.GetProperty("wheelDelta")) / 120;

                if (HtmlPage.Window.GetProperty("opera") != null)
                {
                    delta = -delta;
                }
            }
            else if (eventObj.GetProperty("detail") != null)
            {
                delta = -((double)eventObj.GetProperty("detail")) / 3;

                if (HtmlPage.BrowserInformation.UserAgent.IndexOf("Macintosh") != -1)
                {
                    delta = delta * 3;
                }
            }

            if (delta != 0)
            {
                if (this.OnMouseWheel(delta, args))
                {
                    args.PreventDefault();
                }
            }
        }
示例#5
0
		private void OnContextMenu(object sender, HtmlEventArgs e)
		{
			// Cancels the event if it is cancelable
			e.PreventDefault();
			Helper.Alert("Right Clicked Blocked at " + e.OffsetX + "," + e.OffsetY);
		}
 private void OnIEContextMenu(object sender, HtmlEventArgs e)
 {
     e.PreventDefault();
     e.StopPropagation();
     HtmlPage.Document.DetachEvent("oncontextmenu", new EventHandler<HtmlEventArgs>(this.OnIEContextMenu));
     this.OnRightClick(new Point((double)e.OffsetX, (double)e.OffsetY));
 }
示例#7
0
        private void Main_MouseWheelTurned(object sender, HtmlEventArgs args)
        {
            double delta = 0;
            ScriptObject e = args.EventObject;

            //browser specific mouse wheel data
            if(e.GetProperty("wheelDelta") != null) // IE and Opera
            {
                delta = ((double)e.GetProperty("wheelDelta"));
                if(HtmlPage.Window.GetProperty("opera") != null)
                {
                    delta = -delta;
                }
            }

            else if(e.GetProperty("detail") != null) // Mozilla and Safari
            {
                delta = -((double)e.GetProperty("detail"));
            }

            double scrollOffset = 0.0;

            //scroll up or down
            if(delta > 0)
            {
                scrollOffset = -100.0;
            }
            else if(delta < 0)
            {
                scrollOffset = 100.0;
            }

            //set the scroll viewer to the new offset
            if(scrollOffset != 0.0)
            {
                scrollOffset += surfaceContainer.VerticalOffset;

                if(scrollOffset < 0.0)
                {
                    scrollOffset = 0.0;
                }
                else if(scrollOffset > surfaceContainer.ScrollableHeight)
                {
                    scrollOffset = surfaceContainer.ScrollableHeight;
                }

                surfaceContainer.ScrollToVerticalOffset(scrollOffset);
            }

            //prevent the browser from doing what it normally does on mousewheel
            if(delta != 0)
            {
                args.PreventDefault();
                e.SetProperty("returnValue", false);
            }
        }
            /// <summary>
            /// Handles the mouse wheel.
            /// </summary>
            /// <param name="sender">The sender.</param>
            /// <param name="args">The <see cref="System.Windows.Browser.HtmlEventArgs"/> instance containing the event data.</param>
            private void HandleMouseWheel(object sender, HtmlEventArgs args)
            {
                double delta = 0;
                ScriptObject eventObj = args.EventObject;

                if(eventObj.GetProperty("wheelDelta") != null)
                {
                    delta = ((double)eventObj.GetProperty("wheelDelta"));

                    if(HtmlPage.Window.GetProperty("opera") != null)
                        delta = -delta;

                    if(HtmlPage.BrowserInformation.UserAgent.Contains("Chrome"))
                        delta /= 140;
                    else
                        delta /= 120;
                }
                else if(eventObj.GetProperty("detail") != null)
                {
                    delta = -((double)eventObj.GetProperty("detail"));

                    if(!HtmlPage.BrowserInformation.UserAgent.Contains("Macintosh"))
                        delta /= 2;
                }

                if(delta == 0 || Moved == null) return;
                var wheelArgs = new MouseWheelEventArgs(delta);
                if(Moved != null) Moved(this, wheelArgs);

                if(wheelArgs.Handled)
                    args.PreventDefault();
            }
示例#9
0
        /// <summary>
        /// Handles mouse wheel events for Firefox.
        /// </summary>
        /// <param name="sender">The HTML element for the plug-in.</param>
        /// <param name="e">The HTML event arguments.</param>
        private void OnMouseWheelFirefox(object sender, HtmlEventArgs e)
        {
            if(_IsMouseOver == false)
            {
                return;
            }

            if(IsWheelEnabled == false)
            {
                e.PreventDefault();
                return;
            }

            double delta = (double)e.EventObject.GetProperty("detail") / -3;
            var args = new DeepEarth.Events.MouseWheelEventArgs(delta);
            MapInstance.Events.MouseWheel(MapInstance, args);

            if(args.Handled)
            {
                e.PreventDefault();
            }
        }
示例#10
0
        private void HandleHtmlKeyDown(object sender, HtmlEventArgs args)
        {
            if (!this.IsReadOnly)
            {
                // Ctrl + B or Ctrl + G
                if (args.CtrlKey && (args.CharacterCode == 66 || args.CharacterCode == 71))
                {
                    args.PreventDefault();
                    args.StopPropagation();

                    DoBold();
                }
                // Ctrl + I
                else if (args.CtrlKey && args.CharacterCode == 73)
                {
                    args.PreventDefault();
                    args.StopPropagation();

                    DoItalic();
                }
                // Ctrl + U
                else if (args.CtrlKey && args.CharacterCode == 85)
                {
                    args.PreventDefault();
                    args.StopPropagation();

                    DoUnderline();
                }
                // ENTER
                else if (args.KeyCode == 13)
                {
                    DoBreak();
                }
                // TAB
                else if (args.KeyCode == 9)
                {
                    args.PreventDefault();
                    args.StopPropagation();

                    if (args.ShiftKey)
                    {
                        DoOutdent();
                    }
                    else
                    {
                        DoIndent();
                    }
                }
            }
        }
示例#11
0
 private static void OnBrowserContextMenu(object sender, HtmlEventArgs e)
 {
     if (SuppressBrowserContextMenu)
         e.PreventDefault();
     else
         PopupManager.CloseActivePopup();
 }