Exemple #1
0
 private void OnIEContextMenu(object sender, HtmlEventArgs e)
 {
     e.PreventDefault();
     e.StopPropagation();
     HtmlPage.Document.DetachEvent("oncontextmenu", new EventHandler <HtmlEventArgs>(this.OnIEContextMenu));
     this.OnRightClick(new Point((double)e.OffsetX, (double)e.OffsetY));
 }
Exemple #2
0
 private void MouseDownHandler(object sender, HtmlEventArgs e)
 {
     if (e.MouseButton == MouseButtons.Right)
     {
         if (!IsIE)
         {
             if (!m_IsInjected)
             {
                 string      id      = HtmlPage.Plugin.Id;
                 string      script  = OverflowScript.Replace("<%=Xaml.ClientID%>", id);
                 HtmlElement element = HtmlPage.Document.CreateElement("div");
                 element.Id = "overflow";
                 element.SetStyleAttribute("position", "absolute");
                 element.SetStyleAttribute("backgroundColor", "transparent");
                 element.SetStyleAttribute("width", "100%");
                 element.SetStyleAttribute("height", "100%");
                 element.SetStyleAttribute("left", "0");
                 element.SetStyleAttribute("top", "0");
                 element.SetStyleAttribute("zIndex", "1");
                 HtmlPage.Document.Body.AppendChild(element);
                 HtmlElement element2 = HtmlPage.Document.CreateElement("script");
                 element2.Id = "overflow_js";
                 element2.SetAttribute("type", "text/javascript");
                 element2.SetProperty("text", script);
                 HtmlPage.Document.DocumentElement.AppendChild(element2);
                 m_IsInjected = true;
             }
         }
         else
         {
             HtmlPage.Document.DetachEvent("oncontextmenu", new EventHandler <HtmlEventArgs>(this.OnIEContextMenu));
             HtmlPage.Document.AttachEvent("oncontextmenu", new EventHandler <HtmlEventArgs>(this.OnIEContextMenu));
         }
     }
 }
Exemple #3
0
 void Document_OnKeyDown(object sender, HtmlEventArgs e)
 {
     if (e != null && e.CharacterCode == 27) //Escape
     {
         Close(DialogResult.Cancel);
     }
 }
Exemple #4
0
 /// <summary>
 /// This calls the Click event handler.
 /// </summary>
 /// <remarks>
 /// The target of the Click will be the managed HtmlAnchor object
 /// instance and NOT the actual HtmlElement.
 /// </remarks>
 /// <param name="sender">The event sender.</param>
 /// <param name="e">The event arguments.</param>
 private void OnClick(object sender, HtmlEventArgs e)
 {
     if (Click != null)
     {
         Click(this, e);
     }
 }
        protected virtual void OnKeyDown(HtmlEventArgs e)
        {
            bool shiftKey = (Control.ModifierKeys & Keys.Shift) > 0;
            bool altKey   = (Control.ModifierKeys & Keys.Alt) > 0;

            if (!altKey) //alt+nav key has special handling for control selections
            {
                //adjust the selection as appropriate for making the cursor keys work as expected
                switch (e.htmlEvt.keyCode)
                {
                case (int)Keys.Left:
                    PrepareForKeyboardNavigation(MarkupDirection.Left, shiftKey);
                    break;

                case (int)Keys.Right:
                    PrepareForKeyboardNavigation(MarkupDirection.Right, shiftKey);
                    break;

                case (int)Keys.Up:
                    PrepareForKeyboardNavigation(MarkupDirection.Left, shiftKey);
                    break;

                case (int)Keys.Down:
                    PrepareForKeyboardNavigation(MarkupDirection.Right, shiftKey);
                    break;
                }
            }
        }
Exemple #6
0
 private void EditorContext_KeyUp(object o, HtmlEventArgs e)
 {
     if (Selected)
     {
         OnKeyUp(o, e);
     }
 }
 private void editorContext_KeyDown(object o, HtmlEventArgs e)
 {
     if (Selected)
     {
         OnKeyDown(e);
     }
 }
 private void EditorContext_KeyDown(object o, HtmlEventArgs e)
 {
     if (Attached && e.htmlEvt.keyCode == (int)Keys.Enter)
     {
         HandleEnterKey(e);
     }
 }
Exemple #9
0
        private void paragraph_Click(object sender, HtmlEventArgs e)
        {
            HtmlElement element = (HtmlElement)sender;

            element.SetProperty("innerHTML", "You clicked this HTML element, and Silverlight handled it.");
            element.SetStyleAttribute("background", "#00ff00");
        }
        /// <summary>
        /// Handles the mouse wheel.
        /// </summary>
        /// <param name="sender">The sender object.</param>
        /// <param name="args">Html Event args.</param>
        private void HandleMouseWheel(object sender, HtmlEventArgs args)
        {
            double delta = 0;

            ScriptObject eventObj = args.EventObject;

            if (eventObj.GetProperty("wheelDelta") != null)
            {
                delta = ((double)eventObj.GetProperty("wheelDelta")) / 120;

                if (HtmlPage.Window.GetProperty("opera") != null)
                {
                    delta = -delta;
                }
            }
            else if (eventObj.GetProperty("detail") != null)
            {
                delta = -((double)eventObj.GetProperty("detail")) / 3;

                if (HtmlPage.BrowserInformation.UserAgent.IndexOf("Macintosh") != -1)
                {
                    delta = delta * 3;
                }
            }

            if (delta != 0)
            {
                if (this.OnMouseWheel(delta, args))
                {
                    args.PreventDefault();
                }
            }
        }
 void Document_OnKeyDown(object sender, HtmlEventArgs e)
 {
     if (e != null && e.CharacterCode == 27) //Escape
     {
         IsDropDownOpen = false;
     }
 }
        protected override void OnKeyDown(object o, HtmlEventArgs e)
        {
            // this is orthoganal to keyboard processing (never cancels) so want to make
            // sure that we always do it if requested)
            if (HtmlEditorSettings.AggressivelyInvalidate)
            {
                Invalidate();
            }

            if (e.htmlEvt.altKey)
            {
                Keys keys = (Keys)e.htmlEvt.keyCode;
                //alt+Left/Right is the control navigation shortcut
                if (keys == Keys.Right || keys == Keys.Left)
                {
                    bool forward = keys == Keys.Right;
                    SelectNextControlElement(forward);
                    e.htmlEvt.cancelBubble = true;
                    return;
                }
            }

            base.OnKeyDown(o, e);

            if (e.WasCancelled)
            {
                return;
            }
        }
Exemple #13
0
 private void EditorContext_DoubleClick(object sender, HtmlEventArgs e)
 {
     if (Selected)
     {
         EditorContext.CommandManager.Execute(CommandId.ActivateContextualTab);
     }
 }
Exemple #14
0
    async void UpdatePosition(object sender, HtmlEventArgs e)
    {
        X += e.MovementX;
        Y += e.MovementY;

        if (X > canvasWidth + RADIUS)
        {
            X = -RADIUS;
        }
        if (Y > canvasHeight + RADIUS)
        {
            Y = -RADIUS;
        }
        if (X < -RADIUS)
        {
            X = canvasWidth + RADIUS;
        }
        if (Y < -RADIUS)
        {
            Y = canvasHeight + RADIUS;
        }

        await tracker.SetProperty("textContent", $"X position: {X} Y position: {Y}");

        if (animation == null)
        {
            animation = animationCallback;
            await window.Invoke <object>("requestAnimationFrame", animation);
        }
    }
        protected override void OnKeyUp(object o, HtmlEventArgs e)
        {
            base.OnKeyUp(o, e);

            //fire a title changed event
            this.OnTitleChanged(EventArgs.Empty);
        }
    private void xrLabel2_HtmlItemCreated(object sender, HtmlEventArgs e)
    {
        DXHtmlLiteralControl link = new DXHtmlLiteralControl();

        link.Text = string.Format("<a id='cat{0}' href='javascript:DXReportViewerWindow.UpdateProductsInfo({0})' style='color:blue; cursor:pointer;'>{1}</a>", e.Brick.Value.ToString(), e.Brick.TextValue);
        e.ContentCell.Controls.Clear();
        e.ContentCell.Controls.Add(link);
    }
Exemple #17
0
        //Calls when specified html-link clicked
        public void OnHtmlLinkClick(object sender, HtmlEventArgs args)
        {
            string link = (sender as HtmlElement).GetProperty("href").ToString();

            link = link.Substring(link.IndexOf('#') + 1);
            link = String.Format("http://{0}:{1}/{2}", doc.DocumentUri.Host, doc.DocumentUri.Port.ToString(), link);
            playFile(link);
        }
        protected override void OnKeyDown(object o, HtmlEventArgs e)
        {
            base.OnKeyDown(o, e);

            if (HtmlEditorSettings.AggressivelyInvalidate)
            {
                Invalidate();
            }
        }
Exemple #19
0
        void Document_OnMouseMove(object sender, HtmlEventArgs e)
        {
            EventHandler handler = MouseMoved;

            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }
        public void OnKeyPress(HtmlEventArgs e)
        {
            OnDamage();

            if (CharIsWordSeparator(Convert.ToChar(e.htmlEvt.keyCode)))
            {
                ExpandDamageToAdjacentWords(_currentSelectionDamage);
            }
        }
Exemple #21
0
        private void OnBrowserDOMMouseScroll(object sender, HtmlEventArgs e)
        {
            // Handles DOMMouseScroll on Firefox

            double delta = (double)e.EventObject.GetProperty("detail") / -3;

            UpdateScrollOffset(delta);

            e.PreventDefault();
        }
Exemple #22
0
        private void OnBrowserMouseWheel(object sender, HtmlEventArgs e)
        {
            // Handles onmousewheel on non-Firefox browsers

            double delta = (double)e.EventObject.GetProperty("wheelDelta") / 120;

            UpdateScrollOffset(delta);

            e.EventObject.SetProperty("returnValue", false);
        }
Exemple #23
0
        void ContentMenu_EventHandler(object sender, HtmlEventArgs e)
        {
            e.PreventDefault();
            e.StopPropagation();
            Point point = new Point(e.OffsetX, e.OffsetY);

            if (AgControlBase.GetSLBounds(this).Contains(point))
            {
                OnShowContextMenu(point);
            }
        }
Exemple #24
0
        public void HtmlSelected(object sender, HtmlEventArgs e)
        {
            EditorTab editorTab = MainForm.mainForm.ActiveDocumentTab as EditorTab;

            if (editorTab != null)
            {
                TextLocation tl = editorTab.editor.Document.OffsetToPosition(e.Item.StreamPosition);
                editorTab.editor.Caret.Position = tl;
                editorTab.editor.Focus();
            }
        }
 private static void OnBrowserContextMenu(object sender, HtmlEventArgs e)
 {
     if (SuppressBrowserContextMenu)
     {
         e.PreventDefault();
     }
     else
     {
         PopupManager.CloseActivePopup();
     }
 }
Exemple #26
0
        void ContentMenu_EventHandler(object sender, HtmlEventArgs e)
        {
            e.PreventDefault();
            e.StopPropagation();
            Point point = new Point(e.OffsetX, e.OffsetY);

            if (SLBounds.Contains(point))
            {
                Raise_ShowContextMenu(new PositionArgs(point));
            }
        }
Exemple #27
0
        private void xrLabel1_HtmlItemCreated(object sender, HtmlEventArgs e)
        {
            DXHtmlTableCell currentCell = (DXHtmlTableCell)e.ContentCell;
            DXHtmlAnchor    link        = new DXHtmlAnchor();

            link.HRef      = ((XRLabel)sender).NavigateUrl;
            link.InnerText = e.Brick.Text;
            currentCell.Controls.Clear();
            currentCell.Controls.Add(link);
            currentCell.Attributes.Remove("onmousedown");
            currentCell.Attributes.CssStyle.Remove("cursor");
        }
Exemple #28
0
        void ContentMenu_EventHandler(object sender, HtmlEventArgs e)
        {
            Rect bounds = AgControlBase.GetSLBounds(this);

            if (bounds.Contains(new Point(e.ClientX, e.ClientY)))
            {
                e.PreventDefault();
                e.StopPropagation();
                this.ContextMenu.SetLocation(new Point(e.OffsetX, e.OffsetY));
                this.ContextMenu.IsDropDownOpen = true;
            }
        }
Exemple #29
0
 protected override void OnKeyDown(HtmlEventArgs e)
 {
     base.OnKeyDown(e);
     if (((Keys)e.htmlEvt.keyCode) == Keys.Back)
     {
         using (IUndoUnit undo = EditorContext.CreateUndoUnit())
         {
             (HTMLElement as IHTMLDOMNode).removeNode(true);
             undo.Commit();
         }
         e.Cancel();
     }
 }
        public override void OnKeyPress(HtmlEventArgs e)
        {
            char ch = (char)e.htmlEvt.keyCode;

            if (!Char.IsLetterOrDigit(ch))
            {
                // Do not commit if we're backing in a correct region
                if ((Keys)e.htmlEvt.keyCode == Keys.Back && !_editor.IsSelectionMisspelled())
                {
                    return;
                }

                OnCommitDamage(EventArgs.Empty);
            }
        }