Beispiel #1
0
 internal unsafe void To(cef_rect_t* ptr)
 {
     ptr->x = this.x;
     ptr->y = this.y;
     ptr->width = this.width;
     ptr->height = this.height;
 }
Beispiel #2
0
 internal unsafe CefRect(cef_rect_t* ptr)
 {
     this.x = ptr->x;
     this.y = ptr->y;
     this.width = ptr->width;
     this.height = ptr->height;
 }
        /// <summary>
        /// Called to report find results returned by CefBrowser::Find().
        /// |identifer| is the identifier passed to CefBrowser::Find(), |count|
        /// is the number of matches currently identified, |selectionRect| is the
        /// location of where the match was found (in window coordinates),
        /// |activeMatchOrdinal| is the current position in the search results,
        /// and |finalUpdate| is true if this is the last find notification.
        /// </summary>
        private void on_find_result(cef_find_handler_t* self, cef_browser_t* browser, int identifier, int count, /*const*/ cef_rect_t* selectionRect, int activeMatchOrdinal, int finalUpdate)
        {
            ThrowIfObjectDisposed();

            var m_browser = CefBrowser.From(browser);
            var m_selectionRect = CefRect.From(selectionRect);
            var m_finalUpdate = finalUpdate != 0;

            this.OnFindResult(m_browser, identifier, count, m_selectionRect, activeMatchOrdinal, m_finalUpdate);
        }
        /// <summary>
        /// Called when the browser wants to move or resize the popup widget.
        /// |rect| contains the new location and size.
        /// </summary>
        private void on_popup_size(cef_render_handler_t* self, cef_browser_t* browser, /*const*/ cef_rect_t* rect)
        {
            ThrowIfObjectDisposed();

            var m_browser = CefBrowser.From(browser);
            var m_rect = CefRect.From(rect);

            this.OnPopupSize(m_browser, m_rect);
        }
        /// <summary>
        /// Called when an element should be painted. |type| indicates whether
        /// the element is the view or the popup widget. |buffer| contains the
        /// pixel data for the whole image. |dirtyRects| contains the set of
        /// rectangles that need to be repainted. On Windows |buffer| will be
        /// width*height*4 bytes in size and represents a BGRA image with an
        /// upper-left origin.
        /// </summary>
        private void on_paint(cef_render_handler_t* self, cef_browser_t* browser, cef_paint_element_type_t type, int dirtyRectCount, cef_rect_t* dirtyRects, /*const*/ void* buffer)
        {
            ThrowIfObjectDisposed();

            var m_browser = CefBrowser.From(browser);
            var m_type = (CefPaintElementType)type;
            var m_dirtyRects = new CefRect[dirtyRectCount];
            for (int i = 0; i < m_dirtyRects.Length; i++)
            {
                m_dirtyRects[i] = CefRect.From(dirtyRects);
                dirtyRects++;
            }
            var m_buffer = (IntPtr)buffer;

            this.OnPaint(m_browser, m_type, m_dirtyRects, m_buffer);
        }
        /// <summary>
        /// Called to retrieve the view rectangle which is relative to screen
        /// coordinates. Return true if the rectangle was provided.
        /// </summary>
        private int get_view_rect(cef_render_handler_t* self, cef_browser_t* browser, cef_rect_t* rect)
        {
            ThrowIfObjectDisposed();

            var m_browser = CefBrowser.From(browser);
            CefRect m_rect;

            var handled = this.GetViewRect(m_browser, out m_rect);

            if (handled)
            {
                m_rect.To(rect);
            }

            return handled ? 1 : 0;
        }
Beispiel #7
0
 internal static unsafe CefRect From(cef_rect_t* ptr)
 {
     return new CefRect(ptr);
 }