示例#1
0
文件: Node.cs 项目: pmq20/mono_forked
        public virtual void FireEvent(string eventName)
        {
            nsIDOMDocument doc;

            this.node.getOwnerDocument(out doc);

            nsIDOMDocumentEvent docEvent = (nsIDOMDocumentEvent)doc;
            nsIDOMDocumentView  docView  = (nsIDOMDocumentView)doc;
            nsIDOMAbstractView  abstractView;

            docView.getDefaultView(out abstractView);
            nsIDOMEventTarget target = (nsIDOMEventTarget)this.node;
            bool ret = false;

            string eventType;

            switch (eventName)
            {
            case "mousedown":
            case "mouseup":
            case "click":
            case "dblclick":
            case "mouseover":
            case "mouseout":
            case "mousemove":
            case "contextmenu":
                eventType = "mouseevents";
                nsIDOMEvent evtMouse;
                Base.StringSet(storage, eventType);
                docEvent.createEvent(storage, out evtMouse);
                nsIDOMMouseEvent domEventMouse = evtMouse as nsIDOMMouseEvent;
                Base.StringSet(storage, eventName);
                domEventMouse.initMouseEvent(storage, true, true, abstractView, 1, 0, 0, 0, 0, false, false, false, false, 0, target);
                target.dispatchEvent(domEventMouse, out ret);
                break;

            case "keydown":
            case "keyup":
            case "keypress":
                eventType = "keyevents";
                nsIDOMEvent evtKey;
                Base.StringSet(storage, eventType);
                docEvent.createEvent(storage, out evtKey);
                Base.StringSet(storage, eventName);
                nsIDOMKeyEvent domEventKey = evtKey as nsIDOMKeyEvent;
                domEventKey.initKeyEvent(storage, true, true, abstractView, false, false, false, false, 0, 0);
                target.dispatchEvent(domEventKey, out ret);
                break;

            case "DOMActivate":
            case "DOMFocusIn":
            case "DOMFocusOut":
            case "input":
                eventType = "uievents";
                nsIDOMEvent evtUI;
                Base.StringSet(storage, eventType);
                docEvent.createEvent(storage, out evtUI);
                Base.StringSet(storage, eventName);
                nsIDOMUIEvent domEventUI = evtUI as nsIDOMUIEvent;
                domEventUI.initUIEvent(storage, true, true, abstractView, 1);
                target.dispatchEvent(domEventUI, out ret);
                break;

            case "focus":
            case "blur":
            case "submit":
            case "reset":
            case "change":
            case "select":
            case "load":
            case "beforeunload":
            case "unload":
            case "abort":
            case "error":
            default:
                eventType = "events";
                nsIDOMEvent domEvent;
                Base.StringSet(storage, eventType);
                docEvent.createEvent(storage, out domEvent);
                Base.StringSet(storage, eventName);
                domEvent.initEvent(storage, true, true);
                target.dispatchEvent(domEvent, out ret);
                break;
            }
        }
示例#2
0
		public static nsIDOMDocumentView GetProxy (Mono.WebBrowser.IWebBrowser control, nsIDOMDocumentView obj)
		{
			object o = Base.GetProxyForObject (control, typeof(nsIDOMDocumentView).GUID, obj);
			return o as nsIDOMDocumentView;
		}
示例#3
0
        public static nsIDOMDocumentView GetProxy(Mono.WebBrowser.IWebBrowser control, nsIDOMDocumentView obj)
        {
            object o = Base.GetProxyForObject(control, typeof(nsIDOMDocumentView).GUID, obj);

            return(o as nsIDOMDocumentView);
        }