protected CefRenderHandler()
 {
     _self = cef_render_handler_t.Alloc();
 
     _ds0 = new cef_render_handler_t.add_ref_delegate(add_ref);
     _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
     _ds1 = new cef_render_handler_t.release_delegate(release);
     _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
     _ds2 = new cef_render_handler_t.get_refct_delegate(get_refct);
     _self->_base._get_refct = Marshal.GetFunctionPointerForDelegate(_ds2);
     _ds3 = new cef_render_handler_t.get_root_screen_rect_delegate(get_root_screen_rect);
     _self->_get_root_screen_rect = Marshal.GetFunctionPointerForDelegate(_ds3);
     _ds4 = new cef_render_handler_t.get_view_rect_delegate(get_view_rect);
     _self->_get_view_rect = Marshal.GetFunctionPointerForDelegate(_ds4);
     _ds5 = new cef_render_handler_t.get_screen_point_delegate(get_screen_point);
     _self->_get_screen_point = Marshal.GetFunctionPointerForDelegate(_ds5);
     _ds6 = new cef_render_handler_t.get_screen_info_delegate(get_screen_info);
     _self->_get_screen_info = Marshal.GetFunctionPointerForDelegate(_ds6);
     _ds7 = new cef_render_handler_t.on_popup_show_delegate(on_popup_show);
     _self->_on_popup_show = Marshal.GetFunctionPointerForDelegate(_ds7);
     _ds8 = new cef_render_handler_t.on_popup_size_delegate(on_popup_size);
     _self->_on_popup_size = Marshal.GetFunctionPointerForDelegate(_ds8);
     _ds9 = new cef_render_handler_t.on_paint_delegate(on_paint);
     _self->_on_paint = Marshal.GetFunctionPointerForDelegate(_ds9);
     _dsa = new cef_render_handler_t.on_cursor_change_delegate(on_cursor_change);
     _self->_on_cursor_change = Marshal.GetFunctionPointerForDelegate(_dsa);
     _dsb = new cef_render_handler_t.on_scroll_offset_changed_delegate(on_scroll_offset_changed);
     _self->_on_scroll_offset_changed = Marshal.GetFunctionPointerForDelegate(_dsb);
 }
        private void update_drag_cursor(cef_render_handler_t *self, cef_browser_t *browser, CefDragOperationsMask operation)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);

            UpdateDragCursor(m_browser, operation);
        }
        private void on_popup_show(cef_render_handler_t *self, cef_browser_t *browser, int show)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);

            OnPopupShow(m_browser, show != 0);
        }
        private void on_scroll_offset_changed(cef_render_handler_t *self, cef_browser_t *browser, double x, double y)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);

            OnScrollOffsetChanged(m_browser, x, y);
        }
Beispiel #5
0
        private void on_virtual_keyboard_requested(cef_render_handler_t *self, cef_browser_t *browser, CefTextInputMode input_mode)
        {
            CheckSelf(self);

            var mBrowser = CefBrowser.FromNative(browser);

            OnVirtualKeyboardRequested(mBrowser, input_mode);
        }
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_render_handler_t.Free(_self);
         _self = null;
     }
 }
 protected virtual void Dispose(bool disposing)
 {
     if (_self != null)
     {
         cef_render_handler_t.Free(_self);
         _self = null;
     }
 }
Beispiel #8
0
        private void on_cursor_change(cef_render_handler_t *self, cef_browser_t *browser, IntPtr cursor)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);

            OnCursorChange(m_browser, cursor);
        }
Beispiel #9
0
        /// <summary>
        /// Called when the browser window's cursor has changed.
        /// </summary>
        private void on_cursor_change(cef_render_handler_t *self, cef_browser_t *browser, cef_cursor_handle *cursor)
        {
            ThrowIfObjectDisposed();

            var m_browser = CefBrowser.From(browser);
            var m_cursor  = (IntPtr)cursor;

            this.OnCursorChange(m_browser, m_cursor);
        }
Beispiel #10
0
        /// <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);
        }
Beispiel #11
0
        /// <summary>
        /// Called when the browser wants to show or hide the popup widget. The
        /// popup should be shown if |show| is true and hidden if |show| is
        /// false.
        /// </summary>
        private void on_popup_show(cef_render_handler_t *self, cef_browser_t *browser, int show)
        {
            ThrowIfObjectDisposed();

            var m_browser = CefBrowser.From(browser);
            var m_show    = show != 0;

            this.OnPopupShow(m_browser, m_show);
        }
        private void on_popup_size(cef_render_handler_t *self, cef_browser_t *browser, cef_rect_t *rect)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_rect    = new CefRectangle(rect->x, rect->y, rect->width, rect->height);

            OnPopupSize(m_browser, m_rect);
        }
        private void on_text_selection_changed(cef_render_handler_t *self, cef_browser_t *browser, cef_string_t *selected_text, cef_range_t *selected_range)
        {
            CheckSelf(self);

            var m_browser        = CefBrowser.FromNative(browser);
            var m_selected_text  = cef_string_t.ToString(selected_text);
            var m_selected_range = new CefRange(selected_range->from, selected_range->to);

            OnTextSelectionChanged(m_browser, m_selected_text, m_selected_range);
        }
        private cef_accessibility_handler_t *get_accessibility_handler(cef_render_handler_t *self)
        {
            CheckSelf(self);
            var result = GetAccessibilityHandler();

            if (result == null)
            {
                return(null);
            }
            return(result.ToNative());
        }
        private int start_dragging(cef_render_handler_t *self, cef_browser_t *browser, cef_drag_data_t *drag_data, CefDragOperationsMask allowed_ops, int x, int y)
        {
            CheckSelf(self);

            var m_browser  = CefBrowser.FromNative(browser);
            var m_dragData = CefDragData.FromNative(drag_data);

            var m_result = StartDragging(m_browser, m_dragData, allowed_ops, x, y);

            return(m_result ? 1 : 0);
        }
Beispiel #16
0
 private void add_ref(cef_render_handler_t *self)
 {
     lock (SyncRoot)
     {
         var result = ++_refct;
         if (result == 1)
         {
             lock (_roots) { _roots.Add((IntPtr)_self, this); }
         }
     }
 }
Beispiel #17
0
 private int release(cef_render_handler_t *self)
 {
     lock (SyncRoot)
     {
         var result = --_refct;
         if (result == 0)
         {
             lock (_roots) { _roots.Remove((IntPtr)_self); }
         }
         return(result);
     }
 }
        private void on_cursor_change(cef_render_handler_t *self, cef_browser_t *browser, IntPtr cursor, CefCursorType type, cef_cursor_info_t *custom_cursor_info)
        {
            CheckSelf(self);

            var m_browser       = CefBrowser.FromNative(browser);
            var m_cefCursorInfo = type == CefCursorType.Custom ? new CefCursorInfo(custom_cursor_info) : null;

            OnCursorChange(m_browser, cursor, type, m_cefCursorInfo);

            if (m_cefCursorInfo != null)
            {
                m_cefCursorInfo.Dispose();
            }
        }
        private int get_screen_info(cef_render_handler_t *self, cef_browser_t *browser, cef_screen_info_t *screen_info)
        {
            CheckSelf(self);

            var m_browser    = CefBrowser.FromNative(browser);
            var m_screenInfo = new CefScreenInfo(screen_info);

            var result = GetScreenInfo(m_browser, m_screenInfo);

            m_screenInfo.Dispose();
            m_browser.Dispose();

            return(result ? 1 : 0);
        }
        private void get_view_rect(cef_render_handler_t *self, cef_browser_t *browser, cef_rect_t *rect)
        {
            CheckSelf(self);

            var          m_browser = CefBrowser.FromNative(browser);
            CefRectangle m_rect;

            GetViewRect(m_browser, out m_rect);

            rect->x      = m_rect.X;
            rect->y      = m_rect.Y;
            rect->width  = m_rect.Width;
            rect->height = m_rect.Height;
        }
Beispiel #21
0
        /// <summary>
        /// Called to retrieve the simulated screen rectangle. Return true if the
        /// rectangle was provided.
        /// </summary>
        private int get_screen_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.GetScreenRect(m_browser, out m_rect);

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

            return(handled ? 1 : 0);
        }
Beispiel #22
0
        /// <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);
        }
        protected CefRenderHandler()
        {
            _self = cef_render_handler_t.Alloc();

            _ds0 = new cef_render_handler_t.add_ref_delegate(add_ref);
            _self->_base._add_ref = Marshal.GetFunctionPointerForDelegate(_ds0);
            _ds1 = new cef_render_handler_t.release_delegate(release);
            _self->_base._release = Marshal.GetFunctionPointerForDelegate(_ds1);
            _ds2 = new cef_render_handler_t.has_one_ref_delegate(has_one_ref);
            _self->_base._has_one_ref = Marshal.GetFunctionPointerForDelegate(_ds2);
            _ds3 = new cef_render_handler_t.has_at_least_one_ref_delegate(has_at_least_one_ref);
            _self->_base._has_at_least_one_ref = Marshal.GetFunctionPointerForDelegate(_ds3);
            _ds4 = new cef_render_handler_t.get_accessibility_handler_delegate(get_accessibility_handler);
            _self->_get_accessibility_handler = Marshal.GetFunctionPointerForDelegate(_ds4);
            _ds5 = new cef_render_handler_t.get_root_screen_rect_delegate(get_root_screen_rect);
            _self->_get_root_screen_rect = Marshal.GetFunctionPointerForDelegate(_ds5);
            _ds6 = new cef_render_handler_t.get_view_rect_delegate(get_view_rect);
            _self->_get_view_rect = Marshal.GetFunctionPointerForDelegate(_ds6);
            _ds7 = new cef_render_handler_t.get_screen_point_delegate(get_screen_point);
            _self->_get_screen_point = Marshal.GetFunctionPointerForDelegate(_ds7);
            _ds8 = new cef_render_handler_t.get_screen_info_delegate(get_screen_info);
            _self->_get_screen_info = Marshal.GetFunctionPointerForDelegate(_ds8);
            _ds9 = new cef_render_handler_t.on_popup_show_delegate(on_popup_show);
            _self->_on_popup_show = Marshal.GetFunctionPointerForDelegate(_ds9);
            _dsa = new cef_render_handler_t.on_popup_size_delegate(on_popup_size);
            _self->_on_popup_size = Marshal.GetFunctionPointerForDelegate(_dsa);
            _dsb                                     = new cef_render_handler_t.on_paint_delegate(on_paint);
            _self->_on_paint                         = Marshal.GetFunctionPointerForDelegate(_dsb);
            _dsc                                     = new cef_render_handler_t.on_accelerated_paint_delegate(on_accelerated_paint);
            _self->_on_accelerated_paint             = Marshal.GetFunctionPointerForDelegate(_dsc);
            _dsd                                     = new cef_render_handler_t.on_cursor_change_delegate(on_cursor_change);
            _self->_on_cursor_change                 = Marshal.GetFunctionPointerForDelegate(_dsd);
            _dse                                     = new cef_render_handler_t.start_dragging_delegate(start_dragging);
            _self->_start_dragging                   = Marshal.GetFunctionPointerForDelegate(_dse);
            _dsf                                     = new cef_render_handler_t.update_drag_cursor_delegate(update_drag_cursor);
            _self->_update_drag_cursor               = Marshal.GetFunctionPointerForDelegate(_dsf);
            _ds10                                    = new cef_render_handler_t.on_scroll_offset_changed_delegate(on_scroll_offset_changed);
            _self->_on_scroll_offset_changed         = Marshal.GetFunctionPointerForDelegate(_ds10);
            _ds11                                    = new cef_render_handler_t.on_ime_composition_range_changed_delegate(on_ime_composition_range_changed);
            _self->_on_ime_composition_range_changed = Marshal.GetFunctionPointerForDelegate(_ds11);
            _ds12                                    = new cef_render_handler_t.on_text_selection_changed_delegate(on_text_selection_changed);
            _self->_on_text_selection_changed        = Marshal.GetFunctionPointerForDelegate(_ds12);
            _ds13                                    = new cef_render_handler_t.on_virtual_keyboard_requested_delegate(on_virtual_keyboard_requested);
            _self->_on_virtual_keyboard_requested    = Marshal.GetFunctionPointerForDelegate(_ds13);
        }
Beispiel #24
0
        /// <summary>
        /// Called to retrieve the translation from view coordinates to actual
        /// screen coordinates. Return true if the screen coordinates were
        /// provided.
        /// </summary>
        private int get_screen_point(cef_render_handler_t *self, cef_browser_t *browser, int viewX, int viewY, int *screenX, int *screenY)
        {
            ThrowIfObjectDisposed();

            var m_browser = CefBrowser.From(browser);
            int m_screenX;
            int m_screenY;

            var handled = this.GetScreenPoint(m_browser, viewX, viewY, out m_screenX, out m_screenY);

            if (handled)
            {
                *screenX = m_screenX;
                *screenY = m_screenY;
            }

            return(handled ? 1 : 0);
        }
Beispiel #25
0
        public CefRenderHandler()
        {
            cef_render_handler_t *self = this.NativeInstance;

            self->get_accessibility_handler = (void *)Marshal.GetFunctionPointerForDelegate(fnGetAccessibilityHandler);
            self->get_root_screen_rect      = (void *)Marshal.GetFunctionPointerForDelegate(fnGetRootScreenRect);
            self->get_view_rect             = (void *)Marshal.GetFunctionPointerForDelegate(fnGetViewRect);
            self->get_screen_point          = (void *)Marshal.GetFunctionPointerForDelegate(fnGetScreenPoint);
            self->get_screen_info           = (void *)Marshal.GetFunctionPointerForDelegate(fnGetScreenInfo);
            self->on_popup_show             = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPopupShow);
            self->on_popup_size             = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPopupSize);
            self->on_paint                         = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPaint);
            self->on_accelerated_paint             = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAcceleratedPaint);
            self->on_cursor_change                 = (void *)Marshal.GetFunctionPointerForDelegate(fnOnCursorChange);
            self->start_dragging                   = (void *)Marshal.GetFunctionPointerForDelegate(fnStartDragging);
            self->update_drag_cursor               = (void *)Marshal.GetFunctionPointerForDelegate(fnUpdateDragCursor);
            self->on_scroll_offset_changed         = (void *)Marshal.GetFunctionPointerForDelegate(fnOnScrollOffsetChanged);
            self->on_ime_composition_range_changed = (void *)Marshal.GetFunctionPointerForDelegate(fnOnImeCompositionRangeChanged);
            self->on_text_selection_changed        = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTextSelectionChanged);
            self->on_virtual_keyboard_requested    = (void *)Marshal.GetFunctionPointerForDelegate(fnOnVirtualKeyboardRequested);
        }
        private int get_screen_point(cef_render_handler_t *self, cef_browser_t *browser, int viewX, int viewY, int *screenX, int *screenY)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);

            int m_screenX = 0;
            int m_screenY = 0;

            var result = GetScreenPoint(m_browser, viewX, viewY, ref m_screenX, ref m_screenY);

            if (result)
            {
                *screenX = m_screenX;
                *screenY = m_screenY;
                return(1);
            }
            else
            {
                return(0);
            }
        }
        private int get_root_screen_rect(cef_render_handler_t *self, cef_browser_t *browser, cef_rect_t *rect)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);
            var m_rect    = new CefRectangle();

            var result = GetRootScreenRect(m_browser, ref m_rect);

            if (result)
            {
                rect->x      = m_rect.X;
                rect->y      = m_rect.Y;
                rect->width  = m_rect.Width;
                rect->height = m_rect.Height;
                return(1);
            }
            else
            {
                return(0);
            }
        }
Beispiel #28
0
        public CefRenderHandler()
        {
            cef_render_handler_t *self = this.NativeInstance;

                        #if NET_LESS_5_0
            self->get_accessibility_handler = (void *)Marshal.GetFunctionPointerForDelegate(fnGetAccessibilityHandler);
            self->get_root_screen_rect      = (void *)Marshal.GetFunctionPointerForDelegate(fnGetRootScreenRect);
            self->get_view_rect             = (void *)Marshal.GetFunctionPointerForDelegate(fnGetViewRect);
            self->get_screen_point          = (void *)Marshal.GetFunctionPointerForDelegate(fnGetScreenPoint);
            self->get_screen_info           = (void *)Marshal.GetFunctionPointerForDelegate(fnGetScreenInfo);
            self->on_popup_show             = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPopupShow);
            self->on_popup_size             = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPopupSize);
            self->on_paint                         = (void *)Marshal.GetFunctionPointerForDelegate(fnOnPaint);
            self->on_accelerated_paint             = (void *)Marshal.GetFunctionPointerForDelegate(fnOnAcceleratedPaint);
            self->start_dragging                   = (void *)Marshal.GetFunctionPointerForDelegate(fnStartDragging);
            self->update_drag_cursor               = (void *)Marshal.GetFunctionPointerForDelegate(fnUpdateDragCursor);
            self->on_scroll_offset_changed         = (void *)Marshal.GetFunctionPointerForDelegate(fnOnScrollOffsetChanged);
            self->on_ime_composition_range_changed = (void *)Marshal.GetFunctionPointerForDelegate(fnOnImeCompositionRangeChanged);
            self->on_text_selection_changed        = (void *)Marshal.GetFunctionPointerForDelegate(fnOnTextSelectionChanged);
            self->on_virtual_keyboard_requested    = (void *)Marshal.GetFunctionPointerForDelegate(fnOnVirtualKeyboardRequested);
                        #else
            self->get_accessibility_handler = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_accessibility_handler_t * >) & GetAccessibilityHandlerImpl;
            self->get_root_screen_rect      = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, cef_rect_t *, int >) & GetRootScreenRectImpl;
            self->get_view_rect             = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, cef_rect_t *, void >) & GetViewRectImpl;
            self->get_screen_point          = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, int, int, int *, int *, int >) & GetScreenPointImpl;
            self->get_screen_info           = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, cef_screen_info_t *, int >) & GetScreenInfoImpl;
            self->on_popup_show             = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, int, void >) & OnPopupShowImpl;
            self->on_popup_size             = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, cef_rect_t *, void >) & OnPopupSizeImpl;
            self->on_paint                         = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, CefPaintElementType, UIntPtr, cef_rect_t *, void *, int, int, void >) & OnPaintImpl;
            self->on_accelerated_paint             = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, CefPaintElementType, UIntPtr, cef_rect_t *, void *, void >) & OnAcceleratedPaintImpl;
            self->start_dragging                   = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, cef_drag_data_t *, CefDragOperationsMask, int, int, int >) & StartDraggingImpl;
            self->update_drag_cursor               = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, CefDragOperationsMask, void >) & UpdateDragCursorImpl;
            self->on_scroll_offset_changed         = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, double, double, void >) & OnScrollOffsetChangedImpl;
            self->on_ime_composition_range_changed = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, cef_range_t *, UIntPtr, cef_rect_t *, void >) & OnImeCompositionRangeChangedImpl;
            self->on_text_selection_changed        = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, cef_string_t *, cef_range_t *, void >) & OnTextSelectionChangedImpl;
            self->on_virtual_keyboard_requested    = (delegate * unmanaged[Stdcall] < cef_render_handler_t *, cef_browser_t *, CefTextInputMode, void >) & OnVirtualKeyboardRequestedImpl;
                        #endif
        }
        private void on_accelerated_paint(cef_render_handler_t *self, cef_browser_t *browser, CefPaintElementType type, UIntPtr dirtyRectsCount, cef_rect_t *dirtyRects, void *shared_handle)
        {
            CheckSelf(self);

            var m_browser = CefBrowser.FromNative(browser);

            // TODO: reuse arrays?
            var m_dirtyRects = new CefRectangle[(int)dirtyRectsCount];

            var count = (int)dirtyRectsCount;
            var rect  = dirtyRects;

            for (var i = 0; i < count; i++)
            {
                m_dirtyRects[i].X      = rect->x;
                m_dirtyRects[i].Y      = rect->y;
                m_dirtyRects[i].Width  = rect->width;
                m_dirtyRects[i].Height = rect->height;

                rect++;
            }

            OnAcceleratedPaint(m_browser, type, m_dirtyRects, (IntPtr)shared_handle);
        }
Beispiel #30
0
 internal static void Free(cef_render_handler_t *ptr)
 {
     Marshal.FreeHGlobal((IntPtr)ptr);
 }
Beispiel #31
0
 private int has_one_ref(cef_render_handler_t *self)
 {
     lock (SyncRoot) { return(_refct == 1 ? 1 : 0); }
 }
Beispiel #32
0
 private int has_at_least_one_ref(cef_render_handler_t *self)
 {
     lock (SyncRoot) { return(_refct != 0 ? 1 : 0); }
 }