示例#1
0
        public int UpdateUI()
        {
            //return 0;
            //Debug.WriteLine("UpdateUI");
            if (this.mFullyActive && (this.m_document != null) && (this.container.mDesignMode == true))
            {
                try
                {
                    HTMLDocument thisdoc = (HTMLDocument)m_document;

                    //we need IDisplayServices to get the caret position
                    IDisplayServices ds = (IDisplayServices)thisdoc;

                    if (ds == null)
                    {
                        return(HRESULT.S_OK);
                    }


                    IHTMLCaret caret;
                    int        iRetVal = ds.GetCaret(out caret);

                    if (caret == null)
                    {
                        return(HRESULT.S_OK);
                    }

                    win32POINT pt = new win32POINT();

                    caret.GetLocation(out pt, true);

                    IHTMLDocument2 htmldoc = (IHTMLDocument2)this.m_document;

                    IHTMLElement el = htmldoc.ElementFromPoint(pt.x, pt.y);

                    if (el == null)
                    {
                        return(HRESULT.S_OK);
                    }

                    container.mcurrentElement = el;
                    container.InvokeUpdateUI(el);
                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message + e.StackTrace);
                }
            }

            //should always return S_OK unless error
            return(HRESULT.S_OK);
        }
示例#2
0
        // IDocHostUIHandler Implementation

        public int ShowContextMenu(uint dwID, ref win32POINT ppt,
                                   [MarshalAs(UnmanagedType.IUnknown)] object pcmdtReserved,
                                   [MarshalAs(UnmanagedType.IDispatch)] object pdispReserved)
        {
            if (container.IsContextMenuEnabled)
            {
                if (
                    (container.ContextMenu != null)
                    ||
                    (container.ContextMenuStrip != null)
                    )
                {
                    //show the assigned ContextMenu
                    System.Drawing.Point pt = new System.Drawing.Point(ppt.x, ppt.y);
                    pt = container.PointToClient(pt);
                    if (container.ContextMenuStrip != null)
                    {
                        container.ContextMenuStrip.Show(container, pt);
                    }
                    else
                    {
                        container.ContextMenu.Show(container, pt);
                    }
                    return(HRESULT.S_OK);
                }
                else
                {
                    //show the default IE ContextMenu
                    Debug.WriteLine("Show context menu");
                    return(HRESULT.S_FALSE);
                }
            }
            else
            {
                return(HRESULT.S_OK);
            }
        }
示例#3
0
 public int ShowHelp(IntPtr hwnd, String lpHelpFile,
                     uint uCommand, uint dwData, win32POINT ptMouse,
                     Object pDispatchObjectHit)
 {
     return(HRESULT.E_NOTIMPL);
 }
示例#4
0
        public int ShowHelp(IntPtr hwnd, String lpHelpFile,
            uint uCommand, uint dwData, win32POINT ptMouse,
            Object pDispatchObjectHit)
        {

            return HRESULT.E_NOTIMPL;
        }
示例#5
0
        public int UpdateUI()
        {

            //return 0;
            //Debug.WriteLine("UpdateUI");
            if (this.mFullyActive && (this.m_document != null) && (this.container.mDesignMode == true))
            {

                try
                {
                    HTMLDocument thisdoc = (HTMLDocument)m_document;

                    //we need IDisplayServices to get the caret position
                    IDisplayServices ds = (IDisplayServices)thisdoc;

                    if (ds == null)
                    {
                        return HRESULT.S_OK;
                    }


                    IHTMLCaret caret;
                    int iRetVal = ds.GetCaret(out caret);

                    if (caret == null)
                    {
                        return HRESULT.S_OK;
                    }

                    win32POINT pt = new win32POINT();

                    caret.GetLocation(out pt, true);

                    IHTMLDocument2 htmldoc = (IHTMLDocument2)this.m_document;

                    IHTMLElement el = htmldoc.ElementFromPoint(pt.x, pt.y);

                    if (el == null)
                    {
                        return HRESULT.S_OK;
                    }

                    container.mcurrentElement = el;
                    container.InvokeUpdateUI(el);

                }
                catch (Exception e)
                {
                    Debug.WriteLine(e.Message + e.StackTrace);

                }

            }

            //should always return S_OK unless error
            return HRESULT.S_OK;
        }
示例#6
0
        // IDocHostUIHandler Implementation

        public int ShowContextMenu(uint dwID, ref win32POINT ppt,
            [MarshalAs(UnmanagedType.IUnknown)] object pcmdtReserved,
            [MarshalAs(UnmanagedType.IDispatch)]object pdispReserved)
        {

            if (container.IsContextMenuEnabled)
            {
                if (
                    (container.ContextMenu != null)
                    ||
                    (container.ContextMenuStrip != null)
                    )
                {
                    //show the assigned ContextMenu
                    System.Drawing.Point pt = new System.Drawing.Point(ppt.x, ppt.y);
                    pt = container.PointToClient(pt);
                    if (container.ContextMenuStrip != null)
                    {
                        container.ContextMenuStrip.Show(container, pt);
                    }
                    else
                    {
                        container.ContextMenu.Show(container, pt);
                    }
                    return HRESULT.S_OK;
                }
                else
                {
                    //show the default IE ContextMenu
                    Debug.WriteLine("Show context menu");
                    return HRESULT.S_FALSE;
                }

            }
            else
            {
                return HRESULT.S_OK;
            }
        }