• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2022 Marshall A. Greenblatt. All rights reserved.
2 //
3 // Redistribution and use in source and binary forms, with or without
4 // modification, are permitted provided that the following conditions are
5 // met:
6 //
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
12 // distribution.
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.
17 //
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.
29 //
30 // ---------------------------------------------------------------------------
31 //
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
34 // more information.
35 //
36 // $hash=79fba8a1a86cc65251dd7251e0863dd20205bb3b$
37 //
38 
39 #ifndef CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
40 #define CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
41 #pragma once
42 
43 #include "include/capi/cef_accessibility_handler_capi.h"
44 #include "include/capi/cef_base_capi.h"
45 #include "include/capi/cef_browser_capi.h"
46 #include "include/capi/cef_drag_data_capi.h"
47 
48 #ifdef __cplusplus
49 extern "C" {
50 #endif
51 
52 ///
53 // Implement this structure to handle events when window rendering is disabled.
54 // The functions of this structure will be called on the UI thread.
55 ///
56 typedef struct _cef_render_handler_t {
57   ///
58   // Base structure.
59   ///
60   cef_base_ref_counted_t base;
61 
62   ///
63   // Return the handler for accessibility notifications. If no handler is
64   // provided the default implementation will be used.
65   ///
66   struct _cef_accessibility_handler_t*(CEF_CALLBACK* get_accessibility_handler)(
67       struct _cef_render_handler_t* self);
68 
69   ///
70   // Called to retrieve the root window rectangle in screen coordinates. Return
71   // true (1) if the rectangle was provided. If this function returns false (0)
72   // the rectangle from GetViewRect will be used.
73   ///
74   int(CEF_CALLBACK* get_root_screen_rect)(struct _cef_render_handler_t* self,
75                                           struct _cef_browser_t* browser,
76                                           cef_rect_t* rect);
77 
78   ///
79   // Called to retrieve the view rectangle which is relative to screen
80   // coordinates. This function must always provide a non-NULL rectangle.
81   ///
82   void(CEF_CALLBACK* get_view_rect)(struct _cef_render_handler_t* self,
83                                     struct _cef_browser_t* browser,
84                                     cef_rect_t* rect);
85 
86   ///
87   // Called to retrieve the translation from view coordinates to actual screen
88   // coordinates. Return true (1) if the screen coordinates were provided.
89   ///
90   int(CEF_CALLBACK* get_screen_point)(struct _cef_render_handler_t* self,
91                                       struct _cef_browser_t* browser,
92                                       int viewX,
93                                       int viewY,
94                                       int* screenX,
95                                       int* screenY);
96 
97   ///
98   // Called to allow the client to fill in the CefScreenInfo object with
99   // appropriate values. Return true (1) if the |screen_info| structure has been
100   // modified.
101   //
102   // If the screen info rectangle is left NULL the rectangle from GetViewRect
103   // will be used. If the rectangle is still NULL or invalid popups may not be
104   // drawn correctly.
105   ///
106   int(CEF_CALLBACK* get_screen_info)(struct _cef_render_handler_t* self,
107                                      struct _cef_browser_t* browser,
108                                      struct _cef_screen_info_t* screen_info);
109 
110   ///
111   // Called when the browser wants to show or hide the popup widget. The popup
112   // should be shown if |show| is true (1) and hidden if |show| is false (0).
113   ///
114   void(CEF_CALLBACK* on_popup_show)(struct _cef_render_handler_t* self,
115                                     struct _cef_browser_t* browser,
116                                     int show);
117 
118   ///
119   // Called when the browser wants to move or resize the popup widget. |rect|
120   // contains the new location and size in view coordinates.
121   ///
122   void(CEF_CALLBACK* on_popup_size)(struct _cef_render_handler_t* self,
123                                     struct _cef_browser_t* browser,
124                                     const cef_rect_t* rect);
125 
126   ///
127   // Called when an element should be painted. Pixel values passed to this
128   // function are scaled relative to view coordinates based on the value of
129   // CefScreenInfo.device_scale_factor returned from GetScreenInfo. |type|
130   // indicates whether the element is the view or the popup widget. |buffer|
131   // contains the pixel data for the whole image. |dirtyRects| contains the set
132   // of rectangles in pixel coordinates that need to be repainted. |buffer| will
133   // be |width|*|height|*4 bytes in size and represents a BGRA image with an
134   // upper-left origin. This function is only called when
135   // cef_window_tInfo::shared_texture_enabled is set to false (0).
136   ///
137   void(CEF_CALLBACK* on_paint)(struct _cef_render_handler_t* self,
138                                struct _cef_browser_t* browser,
139                                cef_paint_element_type_t type,
140                                size_t dirtyRectsCount,
141                                cef_rect_t const* dirtyRects,
142                                const void* buffer,
143                                int width,
144                                int height);
145 
146   ///
147   // Called when an element has been rendered to the shared texture handle.
148   // |type| indicates whether the element is the view or the popup widget.
149   // |dirtyRects| contains the set of rectangles in pixel coordinates that need
150   // to be repainted. |shared_handle| is the handle for a D3D11 Texture2D that
151   // can be accessed via ID3D11Device using the OpenSharedResource function.
152   // This function is only called when cef_window_tInfo::shared_texture_enabled
153   // is set to true (1), and is currently only supported on Windows.
154   ///
155   void(CEF_CALLBACK* on_accelerated_paint)(struct _cef_render_handler_t* self,
156                                            struct _cef_browser_t* browser,
157                                            cef_paint_element_type_t type,
158                                            size_t dirtyRectsCount,
159                                            cef_rect_t const* dirtyRects,
160                                            void* shared_handle);
161 
162   ///
163   // Called when the user starts dragging content in the web view. Contextual
164   // information about the dragged content is supplied by |drag_data|. (|x|,
165   // |y|) is the drag start location in screen coordinates. OS APIs that run a
166   // system message loop may be used within the StartDragging call.
167   //
168   // Return false (0) to abort the drag operation. Don't call any of
169   // cef_browser_host_t::DragSource*Ended* functions after returning false (0).
170   //
171   // Return true (1) to handle the drag operation. Call
172   // cef_browser_host_t::DragSourceEndedAt and DragSourceSystemDragEnded either
173   // synchronously or asynchronously to inform the web view that the drag
174   // operation has ended.
175   ///
176   int(CEF_CALLBACK* start_dragging)(struct _cef_render_handler_t* self,
177                                     struct _cef_browser_t* browser,
178                                     struct _cef_drag_data_t* drag_data,
179                                     cef_drag_operations_mask_t allowed_ops,
180                                     int x,
181                                     int y);
182 
183   ///
184   // Called when the web view wants to update the mouse cursor during a drag &
185   // drop operation. |operation| describes the allowed operation (none, move,
186   // copy, link).
187   ///
188   void(CEF_CALLBACK* update_drag_cursor)(struct _cef_render_handler_t* self,
189                                          struct _cef_browser_t* browser,
190                                          cef_drag_operations_mask_t operation);
191 
192   ///
193   // Called when the scroll offset has changed.
194   ///
195   void(CEF_CALLBACK* on_scroll_offset_changed)(
196       struct _cef_render_handler_t* self,
197       struct _cef_browser_t* browser,
198       double x,
199       double y);
200 
201   ///
202   // Called when the IME composition range has changed. |selected_range| is the
203   // range of characters that have been selected. |character_bounds| is the
204   // bounds of each character in view coordinates.
205   ///
206   void(CEF_CALLBACK* on_ime_composition_range_changed)(
207       struct _cef_render_handler_t* self,
208       struct _cef_browser_t* browser,
209       const cef_range_t* selected_range,
210       size_t character_boundsCount,
211       cef_rect_t const* character_bounds);
212 
213   ///
214   // Called when text selection has changed for the specified |browser|.
215   // |selected_text| is the currently selected text and |selected_range| is the
216   // character range.
217   ///
218   void(CEF_CALLBACK* on_text_selection_changed)(
219       struct _cef_render_handler_t* self,
220       struct _cef_browser_t* browser,
221       const cef_string_t* selected_text,
222       const cef_range_t* selected_range);
223 
224   ///
225   // Called when an on-screen keyboard should be shown or hidden for the
226   // specified |browser|. |input_mode| specifies what kind of keyboard should be
227   // opened. If |input_mode| is CEF_TEXT_INPUT_MODE_NONE, any existing keyboard
228   // for this browser should be hidden.
229   ///
230   void(CEF_CALLBACK* on_virtual_keyboard_requested)(
231       struct _cef_render_handler_t* self,
232       struct _cef_browser_t* browser,
233       cef_text_input_mode_t input_mode);
234 } cef_render_handler_t;
235 
236 #ifdef __cplusplus
237 }
238 #endif
239 
240 #endif  // CEF_INCLUDE_CAPI_CEF_RENDER_HANDLER_CAPI_H_
241