public PresentationSource(UIElement rootElement, HtmlRenderElementFactory htmlRenderElementFactory, HtmlValueConverter converter, ImageElementContainer imageElementContainer, SvgDefinitionContainer svgDefinitionContainer) { this.RootElement = rootElement; this.converter = converter; RootElement.IsRootElement = true; MouseDevice = new MouseDevice(this); KeyboardDevice = new KeyboardDevice(this); window = Bridge.Html5.Window.Instance; MouseDevice.CursorChanged += (sender, e) => Bridge.Html5.Window.Document.Body.SetHtmlStyleProperty("cursor", converter.ToCursorString(MouseDevice.Cursor, htmlRenderElementFactory)); Bridge.Html5.Window.Document.Body.SetHtmlStyleProperty("cursor", converter.ToCursorString(MouseDevice.Cursor, htmlRenderElementFactory)); Bridge.Html5.Window.OnKeyDown = OnKeyDown; Bridge.Html5.Window.OnKeyUp = OnKeyUp; Bridge.Html5.Window.OnKeyPress = PreventKeyboardHandled; Bridge.Html5.Window.OnMouseMove = OnMouseMove; Bridge.Html5.Window.OnMouseDown = OnMouseDown; Bridge.Html5.Window.OnMouseUp = OnMouseUp; Bridge.Html5.Window.OnScroll = OnMouseWheel; Bridge.Html5.Window.OnFocus = e => MouseDevice.Activate(); Bridge.Html5.Window.OnBlur = e => MouseDevice.Deactivate(); Bridge.Html5.Window.OnResize = e => SetRootElementSize(); Bridge.Html5.Window.OnClick = PreventMouseHandled; Bridge.Html5.Window.OnContextMenu = PreventMouseHandled; Bridge.Html5.Window.AddEventListener("ondblclick", PreventMouseHandled); Bridge.Html5.Window.AddEventListener("wheel", OnMouseWheel); SetRootElementSize(); ((FrameworkElement)RootElement).Arrange(new Rect(window.InnerWidth, window.InnerHeight)); IHtmlRenderElement renderElement = ((IHtmlRenderElement)RootElement.GetRenderElement(htmlRenderElementFactory)); renderElement.Load(); Bridge.Html5.Window.Document.Body.Style.Overflow = Overflow.Hidden; Bridge.Html5.Window.Document.Body.AppendChild(imageElementContainer.HtmlElement); Bridge.Html5.Window.Document.Body.AppendChild(svgDefinitionContainer.HtmlElement); Bridge.Html5.Window.Document.Body.AppendChild(renderElement.HtmlElement); MouseDevice.Activate(); KeyboardDevice.Activate(); }
public PresentationSource(UIElement rootElement, IHtmlValueConverter converter) { this.RootElement = rootElement; this.converter = converter; RootElement.IsRootElement = true; MouseDevice = new MouseDevice(this); KeyboardDevice = new KeyboardDevice(this); window = Bridge.Html5.Window.Instance; MouseDevice.CursorChanged += (sender, e) => Bridge.Html5.Window.Document.Body.Style.SetProperty("cursor", converter.ToCursorString(MouseDevice.Cursor)); Bridge.Html5.Window.Document.Body.Style.SetProperty("cursor", converter.ToCursorString(MouseDevice.Cursor)); Bridge.Html5.Window.OnKeyDown = OnKeyDown; Bridge.Html5.Window.OnKeyUp = OnKeyUp; Bridge.Html5.Window.OnKeyPress = PreventKeyboardHandled; Bridge.Html5.Window.OnMouseMove = OnMouseMove; Bridge.Html5.Window.OnMouseDown = OnMouseDown; Bridge.Html5.Window.OnMouseUp = OnMouseUp; Bridge.Html5.Window.OnScroll = OnMouseWheel; Bridge.Html5.Window.OnFocus = e => MouseDevice.Activate(); Bridge.Html5.Window.OnBlur = e => MouseDevice.Deactivate(); Bridge.Html5.Window.OnResize = e => SetRootElementSize(); Bridge.Html5.Window.OnClick = PreventMouseHandled; Bridge.Html5.Window.OnContextMenu = PreventMouseHandled; Bridge.Html5.Window.AddEventListener("ondblclick", PreventMouseHandled); Bridge.Html5.Window.AddEventListener("wheel", OnMouseWheel); SetRootElementSize(); Bridge.Html5.Window.Document.Body.Style.Overflow = Overflow.Hidden; Bridge.Html5.Window.Document.Body.AppendChild(((HtmlRenderElement)RootElement.GetRenderElement(HtmlRenderElementFactory.Default)).HtmlElement); MouseDevice.Activate(); KeyboardDevice.Activate(); }
public static jQuery Element(WindowInstance window) { return null; }
/// <summary> /// Intializes the value of a mouse event once it's been created (normally using document.createEvent method). /// </summary> /// <param name="type">the string to set the event's type to. Possible types for mouse events include: click, mousedown, mouseup, mouseover, mousemove, mouseout.</param> /// <param name="canBubble">whether or not the event can bubble.</param> /// <param name="cancelable">whether or not the event's default action can be prevented.</param> /// <param name="view">the Event's AbstractView. You should pass the window object here. </param> /// <param name="detail">the Event's mouse click count.</param> /// <param name="screenX">the Event's screen x coordinate.</param> /// <param name="screenY">the Event's screen y coordinate. </param> /// <param name="clientX">the Event's client x coordinate.</param> /// <param name="clientY">the Event's client y coordinate. </param> /// <param name="ctrlKey">whether or not control key was depressed during the Event. </param> /// <param name="altKey">whether or not alt key was depressed during the Event.</param> /// <param name="shiftKey">whether or not shift key was depressed during the Event.</param> /// <param name="metaKey">whether or not meta key was depressed during the Event.</param> /// <param name="button">the Event's mouse event.button.</param> /// <param name="relatedTarget">the Event's related EventTarget. Only used with some event types (e.g. mouseover and mouseout). In other cases, pass null.</param> public virtual void InitMouseEvent(string type, bool canBubble, bool cancelable, WindowInstance view, int detail, int screenX, int screenY, int clientX, int clientY, bool ctrlKey, bool altKey, bool shiftKey, bool metaKey, short button, Element relatedTarget) { }