Exemplo n.º 1
0
        protected override void WndProc(ref Message m)
        {
            switch (m.Msg)
            {
            case WM_NOTIFY:
                var nmhdr = (NMHDR)Marshal.PtrToStructure(m.LParam, typeof(NMHDR));
                switch (nmhdr.code)
                {
                case NM_RCLICK:
                    OnContextMenu.Raise(this, new EventArgs());
                    break;

                case TVN_SELCHANGED:
                    OnSelectionChanged.Raise(this, new EventArgs());
                    break;
                }
                break;

            case WM_CONTEXTMENU:
                OnContextMenu.Raise(this, new EventArgs());
                break;
            }

            base.WndProc(ref m);
        }
Exemplo n.º 2
0
        void OnMouseUp(MouseUpEvent evt)
        {
            if (evt.clickCount != 1)
            {
                return;
            }

            if (evt.button == (int)MouseButton.RightMouse)
            {
                if (OnContextMenu != null)
                {
                    OnContextMenu.Invoke();
                }
            }

            evt.StopImmediatePropagation();
        }
        internal void DispatchEvent(Map map, HtmlMarkerJsEventArgs eventArgs)
        {
            if (eventArgs.Options != null)
            {
                var popupOptions = Options.Popup;
                Options       = eventArgs.Options;
                Options.Popup = popupOptions;
            }

            switch (eventArgs.Type)
            {
            case "click":
                OnClick?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "contextmenu":
                OnContextMenu?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "dblclick":
                OnDblClick?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "drag":
                OnDrag?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "dragend":
                OnDragEnd?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "dragstart":
                OnDragStart?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "keydown":
                OnKeyDown?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "keypress":
                OnKeyPress?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "keyup":
                OnKeyUp?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "mousedown":
                OnMouseDown?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "mouseenter":
                OnMouseEnter?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "mouseleave":
                OnMouseLeave?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "mousemove":
                OnMouseMove?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "mouseout":
                OnMouseOut?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "mouseover":
                OnMouseOver?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;

            case "mouseup":
                OnMouseUp?.Invoke(new HtmlMarkerEventArgs(map, eventArgs.Type, this));
                break;
            }
        }
        internal void DispatchEvent(Map map, MapJsEventArgs eventArgs)
        {
            switch (eventArgs.Type)
            {
            case "click":
                OnClick?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "contextmenu":
                OnContextMenu?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "dblclick":
                OnDblClick?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "layeradded":
                OnLayerAdded?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;

            case "layerremoved":
                OnLayerRemoved?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;

            case "mousedown":
                OnMouseDown?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseenter":
                OnMouseEnter?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseleave":
                OnMouseLeave?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mousemove":
                OnMouseMove?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseout":
                OnMouseOut?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseover":
                OnMouseOver?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "mouseup":
                OnMouseUp?.Invoke(new MapMouseEventArgs(map, eventArgs));
                break;

            case "touchcancel":
                OnTouchCancel?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchend":
                OnTouchEnd?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchmove":
                OnTouchMove?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "touchstart":
                OnTouchStart?.Invoke(new MapTouchEventArgs(map, eventArgs));
                break;

            case "wheel":
                OnWheel?.Invoke(new MapEventArgs(map, eventArgs.Type));
                break;
            }
        }
Exemplo n.º 5
0
 public void NotifyContextMenu(MouseEvent eventArgs)
 {
     OnContextMenu?.Invoke(this, eventArgs);
 }
Exemplo n.º 6
0
        /// <summary> Adds the events for this html element directly to the text writer output </summary>
        /// <param name="Output"> Output to write directly to </param>
        public void Add_Events_HTML(TextWriter Output)
        {
            if (!String.IsNullOrWhiteSpace(OnClick))
            {
                Output.Write("onclick=\"" + OnClick.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnContextMenu))
            {
                Output.Write("oncontextmenu=\"" + OnContextMenu.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnDblClick))
            {
                Output.Write("ondblclick=\"" + OnDblClick.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseDown))
            {
                Output.Write("onmousedown=\"" + OnMouseDown.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseEnter))
            {
                Output.Write("onmouseenter=\"" + OnMouseEnter.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseLeave))
            {
                Output.Write("onmouseleave=\"" + OnMouseLeave.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseMove))
            {
                Output.Write("onmousemove=\"" + OnMouseMove.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseOver))
            {
                Output.Write("onmouseover=\"" + OnMouseOver.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseOut))
            {
                Output.Write("onmouseout=\"" + OnMouseOut.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnMouseUp))
            {
                Output.Write("onmouseup=\"" + OnMouseUp.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnKeyDown))
            {
                Output.Write("onkeydown=\"" + OnKeyDown.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnKeyPress))
            {
                Output.Write("onkeypress=\"" + OnKeyPress.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnKeyUp))
            {
                Output.Write("onkeyup=\"" + OnKeyUp.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnLoad))
            {
                Output.Write("onload=\"" + OnLoad.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnSelect))
            {
                Output.Write("onselect=\"" + OnSelect.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnChange))
            {
                Output.Write("onchange=\"" + OnChange.Replace("\"", "'") + "\" ");
            }

            if (!String.IsNullOrWhiteSpace(OnWheel))
            {
                Output.Write("onwheel=\"" + OnWheel.Replace("\"", "'") + "\" ");
            }
        }
Exemplo n.º 7
0
        public override async Task EventCallback(string eventName, string eventJson)
        {
            var jsonOptions = new JsonSerializerOptions {
                PropertyNamingPolicy = JsonNamingPolicy.CamelCase
            };

            switch (eventName)
            {
            case "OnDidCompositionEnd":
                await OnDidCompositionEnd.InvokeAsync(this);

                break;

            case "OnDidCompositionStart":
                await OnDidCompositionStart.InvokeAsync(this);

                break;

            case "OnContextMenu":
                if (eventJson != null)
                {
                    await OnContextMenu.InvokeAsync(
                        JsonSerializer.Deserialize <EditorMouseEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnDidBlurEditorText":
                await OnDidBlurEditorText.InvokeAsync(this);

                break;

            case "OnDidBlurEditorWidget":
                await OnDidBlurEditorWidget.InvokeAsync(this);

                break;

            case "OnDidChangeConfiguration":
                await OnDidChangeConfiguration.InvokeAsync(this);

                break;

            case "OnDidChangeCursorPosition":
                await OnDidChangeCursorPosition.InvokeAsync(
                    JsonSerializer.Deserialize <CursorPositionChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidChangeCursorSelection":
                await OnDidChangeCursorSelection.InvokeAsync(
                    JsonSerializer.Deserialize <CursorSelectionChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidChangeModel":
                await OnDidChangeModel.InvokeAsync(
                    JsonSerializer.Deserialize <ModelChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidChangeModelContent":
                await OnDidChangeModelContent.InvokeAsync(
                    JsonSerializer.Deserialize <ModelContentChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidChangeModelDecorations":
                await OnDidChangeModelDecorations.InvokeAsync(
                    JsonSerializer.Deserialize <ModelDecorationsChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidChangeModelLanguage":
                await OnDidChangeModelLanguage.InvokeAsync(
                    JsonSerializer.Deserialize <ModelLanguageChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidChangeModelLanguageConfiguration":
                await OnDidChangeModelLanguageConfiguration.InvokeAsync(
                    JsonSerializer.Deserialize <ModelLanguageConfigurationChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidChangeModelOptions":
                await OnDidChangeModelOptions.InvokeAsync(
                    JsonSerializer.Deserialize <ModelOptionsChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidContentSizeChange":
                await OnDidContentSizeChange.InvokeAsync(
                    JsonSerializer.Deserialize <ContentSizeChangedEvent>(eventJson, jsonOptions));

                break;

            case "OnDidFocusEditorText":
                await OnDidFocusEditorText.InvokeAsync(this);

                break;

            case "OnDidFocusEditorWidget":
                await OnDidFocusEditorWidget.InvokeAsync(this);

                break;

            case "OnDidLayoutChange":
                if (eventJson != null)
                {
                    await OnDidLayoutChange.InvokeAsync(
                        JsonSerializer.Deserialize <EditorLayoutInfo>(eventJson, jsonOptions));
                }
                break;

            case "OnDidPaste":
                if (eventJson != null)
                {
                    await OnDidPaste.InvokeAsync(JsonSerializer.Deserialize <PasteEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnDidScrollChange":
                if (eventJson != null)
                {
                    await OnDidScrollChange.InvokeAsync(
                        JsonSerializer.Deserialize <ScrollEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnKeyDown":
                if (eventJson != null)
                {
                    await OnKeyDown.InvokeAsync(JsonSerializer.Deserialize <KeyboardEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnKeyUp":
                if (eventJson != null)
                {
                    await OnKeyUp.InvokeAsync(JsonSerializer.Deserialize <KeyboardEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnMouseDown":
                if (eventJson != null)
                {
                    await OnMouseDown.InvokeAsync(
                        JsonSerializer.Deserialize <EditorMouseEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnMouseLeave":
                if (eventJson != null)
                {
                    await OnMouseLeave.InvokeAsync(
                        JsonSerializer.Deserialize <EditorMouseEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnMouseMove":
                if (eventJson != null)
                {
                    await OnMouseMove.InvokeAsync(
                        JsonSerializer.Deserialize <EditorMouseEvent>(eventJson, jsonOptions));
                }
                break;

            case "OnMouseUp":
                if (eventJson != null)
                {
                    await OnMouseUp.InvokeAsync(
                        JsonSerializer.Deserialize <EditorMouseEvent>(eventJson, jsonOptions));
                }
                break;
            }

            await base.EventCallback(eventName, eventJson);
        }