33// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
44
55using System ;
6- using CefSharp . Enums ;
76using CefSharp . Structs ;
87
98namespace CefSharp . OffScreen
109{
11- public interface IRenderHandler
10+ /// <summary>
11+ /// Implement this interface to handle Offscreen Rendering (OSR).
12+ /// NOTE: Currently only OnPaint is implemented, at some point expand the API to include all
13+ /// of CefRenderHandler methods http://magpcss.org/ceforum/apidocs3/projects/(default)/CefRenderHandler.html
14+ /// </summary>
15+ public interface IRenderHandler : IDisposable
1216 {
13- /// <summary>
14- /// Called to allow the client to return a ScreenInfo object with appropriate values.
15- /// If null is returned then the rectangle from GetViewRect will be used.
16- /// If the rectangle is still empty or invalid popups may not be drawn correctly.
17- /// </summary>
18- /// <returns>Return null if no screenInfo structure is provided.</returns>
19- ScreenInfo ? GetScreenInfo ( ) ;
20-
21- /// <summary>
22- /// Called to retrieve the view rectangle which is relative to screen coordinates.
23- /// </summary>
24- /// <returns>Return a ViewRect strict containing the rectangle or null. If the rectangle is
25- /// still empty or invalid popups may not be drawn correctly. </returns>
26- ViewRect ? GetViewRect ( ) ;
27-
28- /// <summary>
29- /// Called to retrieve the translation from view coordinates to actual screen coordinates.
30- /// </summary>
31- /// <param name="viewX">x</param>
32- /// <param name="viewY">y</param>
33- /// <param name="screenX">screen x</param>
34- /// <param name="screenY">screen y</param>
35- /// <returns>Return true if the screen coordinates were provided.</returns>
36- bool GetScreenPoint ( int viewX , int viewY , out int screenX , out int screenY ) ;
37-
38- /// <summary>
39- /// Called when an element should be painted. Pixel values passed to this method are scaled relative to view coordinates based on the
40- /// value of <see cref="ScreenInfo.ScaleFactor"/> returned from <see cref="GetScreenInfo"/>.
41- /// Called on the CEF UI Thread
42- /// </summary>
43- /// <param name="type">indicates whether the element is the view or the popup widget.</param>
44- /// <param name="dirtyRect">contains the set of rectangles in pixel coordinates that need to be repainted</param>
45- /// <param name="buffer">The bitmap will be will be width * height *4 bytes in size and represents a BGRA image with an upper-left origin</param>
46- /// <param name="width">width</param>
47- /// <param name="height">height</param>
48- void OnPaint ( PaintElementType type , Rect dirtyRect , IntPtr buffer , int width , int height ) ;
49-
50- /// <summary>
51- /// Called when the browser's cursor has changed. .
52- /// </summary>
53- /// <param name="cursor">If type is Custom then customCursorInfo will be populated with the custom cursor information</param>
54- /// <param name="type">cursor type</param>
55- /// <param name="customCursorInfo">custom cursor Information</param>
56- void OnCursorChange ( IntPtr cursor , CursorType type , CursorInfo customCursorInfo ) ;
57-
58- /// <summary>
59- /// Called when the user starts dragging content in the web view. Contextual information about the dragged content is
60- /// supplied by dragData. (|x|, |y|) is the drag start location in screen coordinates. OS APIs that run a system message
61- /// loop may be used within the StartDragging call. Return false to abort the drag operation. Don't call any of
62- /// CefBrowserHost::DragSource*Ended* methods after returning false. Return true to handle the drag operation.
63- /// Call IBrowserHost::DragSourceEndedAt and DragSourceSystemDragEnded either synchronously or asynchronously to inform
64- /// the web view that the drag operation has ended.
65- /// </summary>
66- /// <param name="dragData">drag data</param>
67- /// <param name="mask">operation mask</param>
68- /// <param name="x">x coordinate</param>
69- /// <param name="y">y coordinate</param>
70- /// <returns>Return false to abort the drag operation.</returns>
71- bool StartDragging ( IDragData dragData , DragOperationsMask mask , int x , int y ) ;
72-
73- /// <summary>
74- /// Called when the web view wants to update the mouse cursor during a drag & drop operation.
75- /// </summary>
76- /// <param name="operation">describes the allowed operation (none, move, copy, link). </param>
77- void UpdateDragCursor ( DragOperationsMask operation ) ;
78-
79- /// <summary>
80- /// Called when the browser wants to show or hide the popup widget.
81- /// </summary>
82- /// <param name="show">The popup should be shown if show is true and hidden if show is false.</param>
83- void OnPopupShow ( bool show ) ;
84-
85- /// <summary>
86- /// Called when the browser wants to move or resize the popup widget.
87- /// </summary>
88- /// <param name="rect">|rect| contains the new location and size in view coordinates. </param>
89- void OnPopupSize ( Rect rect ) ;
90-
91- /// <summary>
92- /// Called when the IME composition range has changed.
93- /// </summary>
94- /// <param name="selectedRange">is the range of characters that have been selected</param>
95- /// <param name="characterBounds">is the bounds of each character in view coordinates.</param>
96- void OnImeCompositionRangeChanged ( Range selectedRange , Rect [ ] characterBounds ) ;
17+ void OnPaint ( bool isPopup , Rect dirtyRect , IntPtr buffer , int width , int height ) ;
9718 }
98- }
19+ }
0 commit comments