/// <summary>Raises the <see cref="DomMouseDown"/> event.</summary> /// <param name="e">The data for the event.</param> protected virtual void OnDomMouseDown(GeckoDomMouseEventArgs e) { WebBrowserFocus.Activate(); if (((GeckoDomMouseEventHandler)this.Events[DomMouseDownEvent]) != null) ((GeckoDomMouseEventHandler)this.Events[DomMouseDownEvent])(this, e); }
/// <summary>Raises the <see cref="DomMouseUp"/> event.</summary> /// <param name="e">The data for the event.</param> protected virtual void OnDomMouseUp(GeckoDomMouseEventArgs e) { if (((GeckoDomMouseEventHandler)this.Events[DomMouseUpEvent]) != null) ((GeckoDomMouseEventHandler)this.Events[DomMouseUpEvent])(this, e); }
void nsIDOMEventListener.HandleEvent(nsIDOMEvent e) { string type; using (nsAString str = new nsAString()) { e.GetType(str); type = str.ToString(); } GeckoDomEventArgs ea = null; switch (type) { case "keydown": OnDomKeyDown((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "keyup": OnDomKeyUp((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "mousedown": OnDomMouseDown((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseup": OnDomMouseUp((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mousemove": OnDomMouseMove((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseover": OnDomMouseOver((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseout": OnDomMouseOut((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "click": OnDomClick(ea = new GeckoDomEventArgs(e)); break; case "submit": OnDomSubmit(ea = new GeckoDomEventArgs(e)); break; } if (ea != null && ea.Cancelable && ea.Handled) e.PreventDefault(); }
/// <summary> /// When the user moves his mouse over the renderer, if the DOM element under the cursor /// changes, notifies the server of the identity of the new element under the mouse /// so that the clients can scroll there. /// </summary> protected override void renderer_DomMouseMove(object sender, GeckoDomMouseEventArgs e) { base.renderer_DomMouseMove (sender, e); if (!e.Target.Equals (currentNode)) { currentNode = e.Target; if (currentNode != null) { CurrentNodeChangedEventArgs args = null; string tagId = null; if (currentNode is GeckoElement) tagId = (currentNode as GeckoElement).Id; if (string.IsNullOrEmpty (tagId)) { int domId = renderer.Document.DocumentElement.GetDomId (currentNode); if (domId != 0) //throw new InvalidOperationException ("GetDomId returned a 0, this should never happen!"); args = new CurrentNodeChangedEventArgs (TabData, domId); } else { args = new CurrentNodeChangedEventArgs (TabData, tagId); } if (args != null) RaiseEvent (args); } } }
void nsIDOMEventListener.HandleEvent(nsIDOMEvent e) { string type; using (nsAString str = new nsAString()) { e.GetTypeAttribute(str); type = str.ToString(); } GeckoDomEventArgs ea = null; switch (type) { case "keydown": OnDomKeyDown((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "keyup": OnDomKeyUp((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "keypress": OnDomKeyPress((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "mousedown": OnDomMouseDown((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseup": OnDomMouseUp((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mousemove": OnDomMouseMove((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseover": OnDomMouseOver((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseout": OnDomMouseOut((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "click": OnDomClick(ea = new GeckoDomEventArgs(e)); break; case "submit": OnDomSubmit(ea = new GeckoDomEventArgs(e)); break; case "compositionstart": OnDomCompositionStart(ea = new GeckoDomEventArgs(e)); break; case "compositionend": OnDomCompositionEnd(ea = new GeckoDomEventArgs(e)); break; case "contextmenu": OnDomContextMenu((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "DOMMouseScroll": OnDomMouseScroll((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "focus": OnDomFocus(ea = new GeckoDomEventArgs(e)); break; } if (ea != null && ea.Cancelable && ea.Handled) e.PreventDefault(); }
/// <summary> /// Method that executes whenever the DomMouseMove event occurs inside the renderer /// active document. It is the only way to capture MouseMove behaviour over the /// GeckoFx control. /// </summary> protected virtual void renderer_DomMouseMove(object sender, GeckoDomMouseEventArgs e) { }
void nsIDOMEventListener.HandleEvent(nsIDOMEvent e) { string type; using (nsAString str = new nsAString()) { e.GetTypeAttribute(str); type = str.ToString(); } GeckoDomEventArgs ea = null; switch (type) { case "keydown": OnDomKeyDown((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "keyup": OnDomKeyUp((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "keypress": OnDomKeyPress((GeckoDomKeyEventArgs)(ea = new GeckoDomKeyEventArgs((nsIDOMKeyEvent)e))); break; case "mousedown": OnDomMouseDown((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseup": OnDomMouseUp((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mousemove": OnDomMouseMove((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseover": OnDomMouseOver((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "mouseout": OnDomMouseOut((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "click": OnDomClick(ea = new GeckoDomEventArgs(e)); break; case "dblclick": OnDomDoubleClick(ea = new GeckoDomEventArgs(e)); break; case "submit": OnDomSubmit(ea = new GeckoDomEventArgs(e)); break; case "compositionstart": OnDomCompositionStart(ea = new GeckoDomEventArgs(e)); break; case "compositionend": OnDomCompositionEnd(ea = new GeckoDomEventArgs(e)); break; case "contextmenu": OnDomContextMenu((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "DOMMouseScroll": OnDomMouseScroll((GeckoDomMouseEventArgs)(ea = new GeckoDomMouseEventArgs((nsIDOMMouseEvent)e))); break; case "focus": OnDomFocus(ea = new GeckoDomEventArgs(e)); break; case "load": OnLoad(ea = new GeckoDomEventArgs(e)); break; case "change": OnDomContentChanged(ea = new GeckoDomEventArgs(e)); break; default: Action<string> action; if(_messageEventListeners.TryGetValue(type, out action)) { action.Invoke(new GeckoDomMessageEventArgs((nsIDOMMessageEvent)e).Message); } break; } if (ea != null && ea.Cancelable && ea.Handled) e.PreventDefault(); }