1 // Copyright (c) 2015 Marshall A. Greenblatt. All rights reserved.
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
7 // * Redistributions of source code must retain the above copyright
8 // notice, this list of conditions and the following disclaimer.
9 // * Redistributions in binary form must reproduce the above
10 // copyright notice, this list of conditions and the following disclaimer
11 // in the documentation and/or other materials provided with the
13 // * Neither the name of Google Inc. nor the name Chromium Embedded
14 // Framework nor the names of its contributors may be used to endorse
15 // or promote products derived from this software without specific prior
16 // written permission.
18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 // ---------------------------------------------------------------------------
32 // This file was generated by the CEF translator tool and should not edited
33 // by hand. See the translator.README.txt file in the tools directory for
37 #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
38 #define CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
41 #include "include/capi/cef_base_capi.h"
42 #include "include/capi/cef_browser_capi.h"
43 #include "include/capi/cef_drag_data_capi.h"
51 // Implement this structure to handle events when window rendering is disabled.
52 // The functions of this structure will be called on the UI thread.
54 typedef struct _cef_render_handler_t {
61 // Called to retrieve the root window rectangle in screen coordinates. Return
62 // true (1) if the rectangle was provided.
64 int (CEF_CALLBACK *get_root_screen_rect)(struct _cef_render_handler_t* self,
65 struct _cef_browser_t* browser, cef_rect_t* rect);
68 // Called to retrieve the view rectangle which is relative to screen
69 // coordinates. Return true (1) if the rectangle was provided.
71 int (CEF_CALLBACK *get_view_rect)(struct _cef_render_handler_t* self,
72 struct _cef_browser_t* browser, cef_rect_t* rect);
75 // Called to retrieve the translation from view coordinates to actual screen
76 // coordinates. Return true (1) if the screen coordinates were provided.
78 int (CEF_CALLBACK *get_screen_point)(struct _cef_render_handler_t* self,
79 struct _cef_browser_t* browser, int viewX, int viewY, int* screenX,
83 // Called to allow the client to fill in the CefScreenInfo object with
84 // appropriate values. Return true (1) if the |screen_info| structure has been
87 // If the screen info rectangle is left NULL the rectangle from GetViewRect
88 // will be used. If the rectangle is still NULL or invalid popups may not be
91 int (CEF_CALLBACK *get_screen_info)(struct _cef_render_handler_t* self,
92 struct _cef_browser_t* browser, struct _cef_screen_info_t* screen_info);
95 // Called when the browser wants to show or hide the popup widget. The popup
96 // should be shown if |show| is true (1) and hidden if |show| is false (0).
98 void (CEF_CALLBACK *on_popup_show)(struct _cef_render_handler_t* self,
99 struct _cef_browser_t* browser, int show);
102 // Called when the browser wants to move or resize the popup widget. |rect|
103 // contains the new location and size in view coordinates.
105 void (CEF_CALLBACK *on_popup_size)(struct _cef_render_handler_t* self,
106 struct _cef_browser_t* browser, const cef_rect_t* rect);
109 // Called when an element should be painted. Pixel values passed to this
110 // function are scaled relative to view coordinates based on the value of
111 // CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type|
112 // indicates whether the element is the view or the popup widget. |buffer|
113 // contains the pixel data for the whole image. |dirtyRects| contains the set
114 // of rectangles in pixel coordinates that need to be repainted. |buffer| will
115 // be |width|*|height|*4 bytes in size and represents a BGRA image with an
116 // upper-left origin.
118 void (CEF_CALLBACK *on_paint)(struct _cef_render_handler_t* self,
119 struct _cef_browser_t* browser, cef_paint_element_type_t type,
120 size_t dirtyRectsCount, cef_rect_t const* dirtyRects, const void* buffer,
121 int width, int height);
124 // Called when the browser's cursor has changed. If |type| is CT_CUSTOM then
125 // |custom_cursor_info| will be populated with the custom cursor information.
127 void (CEF_CALLBACK *on_cursor_change)(struct _cef_render_handler_t* self,
128 struct _cef_browser_t* browser, cef_cursor_handle_t cursor,
129 cef_cursor_type_t type,
130 const struct _cef_cursor_info_t* custom_cursor_info);
133 // Called when the user starts dragging content in the web view. Contextual
134 // information about the dragged content is supplied by |drag_data|. (|x|,
135 // |y|) is the drag start location in screen coordinates. OS APIs that run a
136 // system message loop may be used within the StartDragging call.
138 // Return false (0) to abort the drag operation. Don't call any of
139 // cef_browser_host_t::DragSource*Ended* functions after returning false (0).
141 // Return true (1) to handle the drag operation. Call
142 // cef_browser_host_t::DragSourceEndedAt and DragSourceSystemDragEnded either
143 // synchronously or asynchronously to inform the web view that the drag
144 // operation has ended.
146 int (CEF_CALLBACK *start_dragging)(struct _cef_render_handler_t* self,
147 struct _cef_browser_t* browser, struct _cef_drag_data_t* drag_data,
148 cef_drag_operations_mask_t allowed_ops, int x, int y);
151 // Called when the web view wants to update the mouse cursor during a drag &
152 // drop operation. |operation| describes the allowed operation (none, move,
155 void (CEF_CALLBACK *update_drag_cursor)(struct _cef_render_handler_t* self,
156 struct _cef_browser_t* browser, cef_drag_operations_mask_t operation);
159 // Called when the scroll offset has changed.
161 void (CEF_CALLBACK *on_scroll_offset_changed)(
162 struct _cef_render_handler_t* self, struct _cef_browser_t* browser,
164 } cef_render_handler_t;
171 #endif // CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_