Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        private void on_find_result(cef_find_handler_t *self, cef_browser_t *browser, int identifier, int count, cef_rect_t *selectionRect, int activeMatchOrdinal, int finalUpdate)
        {
            CheckSelf(self);

            var mBrowser       = CefBrowser.FromNative(browser);
            var mSelectionRect = new CefRectangle(selectionRect->x, selectionRect->y, selectionRect->width, selectionRect->height);

            OnFindResult(mBrowser, identifier, count, mSelectionRect, activeMatchOrdinal, finalUpdate != 0);
        }
Exemplo n.º 3
0
 private unsafe CefDraggableRegion(cef_draggable_region_t *ptr)
 {
     _bounds = new CefRectangle(
         ptr->bounds.x,
         ptr->bounds.y,
         ptr->bounds.width,
         ptr->bounds.height
         );
     _draggable = ptr->draggable != 0;
 }
        public void SetAsChild(IntPtr parentHandle, CefRectangle rect)
        {
            ThrowIfDisposed();

            Style = WindowStyle.WS_CHILD
                    | WindowStyle.WS_CLIPCHILDREN
                    | WindowStyle.WS_CLIPSIBLINGS
                    | WindowStyle.WS_TABSTOP
                    | WindowStyle.WS_VISIBLE;

            ParentHandle = parentHandle;

            X      = rect.X;
            Y      = rect.Y;
            Width  = rect.Width;
            Height = rect.Height;
        }
        /// <summary>
        /// Set the printer printable area in device units.
        /// Some platforms already provide flipped area. Set |landscape_needs_flip|
        /// to false on those platforms to avoid double flipping.
        /// </summary>
        public void SetPrinterPrintableArea(CefSize physicalSizeDeviceUnits, CefRectangle printableAreaDeviceUnits, bool landscapeNeedsFlip)
        {
            var n_physicalSizeDeviceUnits = new cef_size_t(
                physicalSizeDeviceUnits.Width,
                physicalSizeDeviceUnits.Height
                );

            var n_printableAreaDeviceUnits = new cef_rect_t(
                printableAreaDeviceUnits.X,
                printableAreaDeviceUnits.Y,
                printableAreaDeviceUnits.Width,
                printableAreaDeviceUnits.Height
                );

            cef_print_settings_t.set_printer_printable_area(
                _self,
                &n_physicalSizeDeviceUnits,
                &n_printableAreaDeviceUnits,
                landscapeNeedsFlip ? 1 : 0
                );
        }
Exemplo n.º 6
0
        private int get_view_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 = GetViewRect(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);
            }
        }
Exemplo n.º 7
0
        private void on_paint(cef_render_handler_t *self, cef_browser_t *browser, CefPaintElementType type, UIntPtr dirtyRectsCount, cef_rect_t *dirtyRects, void *buffer, int width, int height)
        {
            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++;
            }

            OnPaint(m_browser, type, m_dirtyRects, (IntPtr)buffer, width, height);
        }
Exemplo n.º 8
0
 /// <summary>
 /// Called to retrieve the view rectangle which is relative to screen
 /// coordinates. Return true if the rectangle was provided.
 /// </summary>
 protected virtual bool GetViewRect(CefBrowser browser, ref CefRectangle rect)
 {
     // TODO: return CefRectangle? (Nullable<CefRectangle>) instead of returning bool?
     return(false);
 }
Exemplo n.º 9
0
 /// <summary>
 /// Called when the browser wants to move or resize the popup widget. |rect|
 /// contains the new location and size in view coordinates.
 /// </summary>
 protected abstract void OnPopupSize(CefBrowser browser, CefRectangle rect);
Exemplo n.º 10
0
 /// <summary>
 /// Called to report find results returned by CefBrowserHost::Find().
 /// |identifer| is the identifier passed to 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>
 protected abstract void OnFindResult(CefBrowser browser, int identifier, int count, CefRectangle selectionRect, int activeMatchOrdinal, bool finalUpdate);