Esempio n. 1
0
		protected void HandleDomClick(object sender, DomMouseEventArgs e)
		{
			if (sender == null || e == null || e.Target == null)
				return;

			GeckoElement elem = e.Target.CastToGeckoElement();
			int hvo;
			if (TryGetHvo(elem, out hvo))
				JumpToToolBasedOnHvo(hvo);

			if (elem.TagName.Equals("input", StringComparison.InvariantCultureIgnoreCase)
				&& elem.GetAttribute("type").Equals("button", StringComparison.InvariantCultureIgnoreCase))
			{
				switch (elem.GetAttribute("name"))
				{
					case "ShowWordGrammarDetail":
						ShowWordGrammarDetail(elem.GetAttribute("id"));
						break;

					case "TryWordGrammarAgain":
						TryWordGrammarAgain(elem.GetAttribute("id"));
						break;

					case "GoToPreviousWordGrammarPage":
						GoToPreviousWordGrammarPage();
						break;
				}
			}
		}
        public static DomEventArgs Create(nsIDOMEvent ev)
        {
            var type = nsString.Get(ev.GetTypeAttribute).ToLowerInvariant();

            // search by name and create child class wrappers
            switch (type)
            {
            case "keydown":
            case "keyup":
            case "keypress":
                return(DomKeyEventArgs.Create((nsIDOMKeyEvent)ev));

            case "mousedown":
            case "mouseup":
            case "mousemove":
            case "mouseover":
            case "mouseout":
            case "contextmenu":
                return(DomMouseEventArgs.Create((nsIDOMMouseEvent)ev));

            case "dommousescroll":
                return(DomMouseScrollEventArgs.Create((nsIDOMMouseScrollEvent)ev));

            case "dragstart":
            case "dragenter":
            case "dragover":
            case "dragleave":
            case "drag":
            case "drop":
            case "dragend":
                return(DomDragEventArgs.Create((nsIDOMDragEvent)ev));

            case "hashchange":
                return(DomHashChangeEventArgs.Create(( nsIDOMHashChangeEvent )ev));
            }
            // search by type
            if (ev is nsIDOMUIEvent)
            {
                return(DomUIEventArgs.Create((nsIDOMUIEvent)ev));
            }
            if (ev is nsIDOMMessageEvent)
            {
                return(DomMessageEventArgs.Create((nsIDOMMessageEvent)ev));
            }
            if (ev is nsIDOMSVGEvent)
            {
                return(DomSvgEvent.Create(( nsIDOMSVGEvent )ev));
            }
            return(new DomEventArgs(ev));
        }
		/// <summary>Raises the <see cref="DomContextMenu"/> event.</summary>
		/// <param name="e">The data for the event.</param>
		protected virtual void OnDomContextMenu(DomMouseEventArgs e)
		{
			var evnt = (EventHandler<DomMouseEventArgs>)Events[DomContextMenuEvent];
			if (evnt != null)evnt(this, e);
		}
		/// <summary>Raises the <see cref="DomMouseScroll"/> event.</summary>
		/// <param name="e">The data for the event.</param>
		protected virtual void OnDomMouseScroll(DomMouseEventArgs e)
		{
			var evnt = (EventHandler<DomMouseEventArgs>)Events[DomMouseScrollEvent];
			if (evnt != null) evnt(this, e);
		}
		/// <summary>Raises the <see cref="DomDoubleClick"/> event.</summary>
		/// <param name="e">The data for the event.</param>
		protected virtual void OnDomDoubleClick(DomMouseEventArgs e)
		{
			var evnt = (EventHandler<DomMouseEventArgs>)Events[DomDoubleClickEvent];
			if (evnt != null) evnt(this, e);
		}
		/// <summary>Raises the <see cref="DomMouseOver"/> event.</summary>
		/// <param name="e">The data for the event.</param>
		protected virtual void OnDomMouseOver(DomMouseEventArgs e)
		{
			var evnt = (EventHandler<DomMouseEventArgs>)this.Events[DomMouseOverEvent];
			if (evnt != null) evnt(this, e);
		}
 /// <summary>Raises the <see cref="DomDoubleClick"/> event.</summary>
 /// <param name="e">The data for the event.</param>
 protected virtual void OnDomDoubleClick(DomMouseEventArgs e)
 {
     RaiseEvent(new RoutedEventArgs(DomDoubleClickEvent, e));
 }
Esempio n. 8
0
        /// <summary>Browsers the on DOM mouse scroll.</summary>
        /// <param name="sender">The sender.</param>
        /// <param name="domMouseEventArgs">The <see cref="DomMouseEventArgs"/> instance containing the event data.</param>
        private void BrowserOnDomMouseScroll(object sender, DomMouseEventArgs domMouseEventArgs)
        {
            // See https://developer.mozilla.org/zh-CN/docs/DOM/DOM_event_reference/DOMMouseScroll
            if (!domMouseEventArgs.CtrlKey)
            {
                return;
            }

            this.config.ZoomLevel = this.browser.GetMarkupDocumentViewer().GetTextZoomAttribute();
        }
 /// <summary>Raises the <see cref="DomMouseScroll"/> event.</summary>
 /// <param name="e">The data for the event.</param>
 protected virtual void OnDomMouseScroll(DomMouseEventArgs e)
 {
     RaiseEvent(new RoutedEventArgs(DomMouseScrollEvent, e));
 }
 /// <summary>Raises the <see cref="DomContextMenu"/> event.</summary>
 /// <param name="e">The data for the event.</param>
 protected virtual void OnDomContextMenu(DomMouseEventArgs e)
 {
     RaiseEvent(new RoutedEventArgs(DomContextMenuEvent, e));
 }
 /// <summary>Raises the <see cref="DomMouseMove"/> event.</summary>
 /// <param name="e">The data for the event.</param>
 protected virtual void OnDomMouseMove(DomMouseEventArgs e)
 {
     RaiseEvent(new RoutedEventArgs(DomMouseMoveEvent, e));
 }
 /// <summary>Raises the <see cref="DomMouseUp"/> event.</summary>
 /// <param name="e">The data for the event.</param>
 protected virtual void OnDomMouseUp(DomMouseEventArgs e)
 {
     var evnt = (EventHandler<DomMouseEventArgs>)_eventList[DomMouseUpEvent];
     if (evnt != null) evnt(this, e);
 }
Esempio n. 13
0
        void wbBrowser_DomContextMenu(object sender, DomMouseEventArgs e)
        {
            if (e.Button.ToString().IndexOf("Right") != -1)
            {
                contextMenuBrowser.Show(Cursor.Position);

                GeckoWebBrowser wb = (GeckoWebBrowser)GetCurrentWB();
                if (wb != null)
                {
                    htmlElm = wb.Document.ElementFromPoint(e.ClientX, e.ClientY);
                }
            }
        }