1 // Copyright (c) 2022 The Chromium Embedded Framework Authors. All rights
2 // reserved. Use of this source code is governed by a BSD-style license that
3 // can be found in the LICENSE file.
4 //
5 // ---------------------------------------------------------------------------
6 //
7 // This file was generated by the CEF translator tool. If making changes by
8 // hand only do so within the body of existing method and function
9 // implementations. See the translator.README.txt file in the tools directory
10 // for more information.
11 //
12 // $hash=43217c47279478323050eef44d6403cb4b5c62a6$
13 //
14
15 #include "libcef_dll/cpptoc/views/view_delegate_cpptoc.h"
16 #include "libcef_dll/cpptoc/views/browser_view_delegate_cpptoc.h"
17 #include "libcef_dll/cpptoc/views/button_delegate_cpptoc.h"
18 #include "libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h"
19 #include "libcef_dll/cpptoc/views/panel_delegate_cpptoc.h"
20 #include "libcef_dll/cpptoc/views/textfield_delegate_cpptoc.h"
21 #include "libcef_dll/cpptoc/views/window_delegate_cpptoc.h"
22 #include "libcef_dll/ctocpp/views/view_ctocpp.h"
23 #include "libcef_dll/shutdown_checker.h"
24
25 namespace {
26
27 // MEMBER FUNCTIONS - Body may be edited by hand.
28
29 cef_size_t CEF_CALLBACK
view_delegate_get_preferred_size(struct _cef_view_delegate_t * self,cef_view_t * view)30 view_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
31 cef_view_t* view) {
32 shutdown_checker::AssertNotShutdown();
33
34 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
35
36 DCHECK(self);
37 if (!self)
38 return CefSize();
39 // Verify param: view; type: refptr_diff
40 DCHECK(view);
41 if (!view)
42 return CefSize();
43
44 // Execute
45 cef_size_t _retval = CefViewDelegateCppToC::Get(self)->GetPreferredSize(
46 CefViewCToCpp::Wrap(view));
47
48 // Return type: simple
49 return _retval;
50 }
51
52 cef_size_t CEF_CALLBACK
view_delegate_get_minimum_size(struct _cef_view_delegate_t * self,cef_view_t * view)53 view_delegate_get_minimum_size(struct _cef_view_delegate_t* self,
54 cef_view_t* view) {
55 shutdown_checker::AssertNotShutdown();
56
57 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
58
59 DCHECK(self);
60 if (!self)
61 return CefSize();
62 // Verify param: view; type: refptr_diff
63 DCHECK(view);
64 if (!view)
65 return CefSize();
66
67 // Execute
68 cef_size_t _retval = CefViewDelegateCppToC::Get(self)->GetMinimumSize(
69 CefViewCToCpp::Wrap(view));
70
71 // Return type: simple
72 return _retval;
73 }
74
75 cef_size_t CEF_CALLBACK
view_delegate_get_maximum_size(struct _cef_view_delegate_t * self,cef_view_t * view)76 view_delegate_get_maximum_size(struct _cef_view_delegate_t* self,
77 cef_view_t* view) {
78 shutdown_checker::AssertNotShutdown();
79
80 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
81
82 DCHECK(self);
83 if (!self)
84 return CefSize();
85 // Verify param: view; type: refptr_diff
86 DCHECK(view);
87 if (!view)
88 return CefSize();
89
90 // Execute
91 cef_size_t _retval = CefViewDelegateCppToC::Get(self)->GetMaximumSize(
92 CefViewCToCpp::Wrap(view));
93
94 // Return type: simple
95 return _retval;
96 }
97
98 int CEF_CALLBACK
view_delegate_get_height_for_width(struct _cef_view_delegate_t * self,cef_view_t * view,int width)99 view_delegate_get_height_for_width(struct _cef_view_delegate_t* self,
100 cef_view_t* view,
101 int width) {
102 shutdown_checker::AssertNotShutdown();
103
104 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
105
106 DCHECK(self);
107 if (!self)
108 return 0;
109 // Verify param: view; type: refptr_diff
110 DCHECK(view);
111 if (!view)
112 return 0;
113
114 // Execute
115 int _retval = CefViewDelegateCppToC::Get(self)->GetHeightForWidth(
116 CefViewCToCpp::Wrap(view), width);
117
118 // Return type: simple
119 return _retval;
120 }
121
122 void CEF_CALLBACK
view_delegate_on_parent_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * parent)123 view_delegate_on_parent_view_changed(struct _cef_view_delegate_t* self,
124 cef_view_t* view,
125 int added,
126 cef_view_t* parent) {
127 shutdown_checker::AssertNotShutdown();
128
129 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
130
131 DCHECK(self);
132 if (!self)
133 return;
134 // Verify param: view; type: refptr_diff
135 DCHECK(view);
136 if (!view)
137 return;
138 // Verify param: parent; type: refptr_diff
139 DCHECK(parent);
140 if (!parent)
141 return;
142
143 // Execute
144 CefViewDelegateCppToC::Get(self)->OnParentViewChanged(
145 CefViewCToCpp::Wrap(view), added ? true : false,
146 CefViewCToCpp::Wrap(parent));
147 }
148
149 void CEF_CALLBACK
view_delegate_on_child_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * child)150 view_delegate_on_child_view_changed(struct _cef_view_delegate_t* self,
151 cef_view_t* view,
152 int added,
153 cef_view_t* child) {
154 shutdown_checker::AssertNotShutdown();
155
156 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
157
158 DCHECK(self);
159 if (!self)
160 return;
161 // Verify param: view; type: refptr_diff
162 DCHECK(view);
163 if (!view)
164 return;
165 // Verify param: child; type: refptr_diff
166 DCHECK(child);
167 if (!child)
168 return;
169
170 // Execute
171 CefViewDelegateCppToC::Get(self)->OnChildViewChanged(
172 CefViewCToCpp::Wrap(view), added ? true : false,
173 CefViewCToCpp::Wrap(child));
174 }
175
176 void CEF_CALLBACK
view_delegate_on_window_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added)177 view_delegate_on_window_changed(struct _cef_view_delegate_t* self,
178 cef_view_t* view,
179 int added) {
180 shutdown_checker::AssertNotShutdown();
181
182 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
183
184 DCHECK(self);
185 if (!self)
186 return;
187 // Verify param: view; type: refptr_diff
188 DCHECK(view);
189 if (!view)
190 return;
191
192 // Execute
193 CefViewDelegateCppToC::Get(self)->OnWindowChanged(CefViewCToCpp::Wrap(view),
194 added ? true : false);
195 }
196
197 void CEF_CALLBACK
view_delegate_on_layout_changed(struct _cef_view_delegate_t * self,cef_view_t * view,const cef_rect_t * new_bounds)198 view_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
199 cef_view_t* view,
200 const cef_rect_t* new_bounds) {
201 shutdown_checker::AssertNotShutdown();
202
203 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
204
205 DCHECK(self);
206 if (!self)
207 return;
208 // Verify param: view; type: refptr_diff
209 DCHECK(view);
210 if (!view)
211 return;
212 // Verify param: new_bounds; type: simple_byref_const
213 DCHECK(new_bounds);
214 if (!new_bounds)
215 return;
216
217 // Translate param: new_bounds; type: simple_byref_const
218 CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
219
220 // Execute
221 CefViewDelegateCppToC::Get(self)->OnLayoutChanged(CefViewCToCpp::Wrap(view),
222 new_boundsVal);
223 }
224
view_delegate_on_focus(struct _cef_view_delegate_t * self,cef_view_t * view)225 void CEF_CALLBACK view_delegate_on_focus(struct _cef_view_delegate_t* self,
226 cef_view_t* view) {
227 shutdown_checker::AssertNotShutdown();
228
229 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
230
231 DCHECK(self);
232 if (!self)
233 return;
234 // Verify param: view; type: refptr_diff
235 DCHECK(view);
236 if (!view)
237 return;
238
239 // Execute
240 CefViewDelegateCppToC::Get(self)->OnFocus(CefViewCToCpp::Wrap(view));
241 }
242
view_delegate_on_blur(struct _cef_view_delegate_t * self,cef_view_t * view)243 void CEF_CALLBACK view_delegate_on_blur(struct _cef_view_delegate_t* self,
244 cef_view_t* view) {
245 shutdown_checker::AssertNotShutdown();
246
247 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
248
249 DCHECK(self);
250 if (!self)
251 return;
252 // Verify param: view; type: refptr_diff
253 DCHECK(view);
254 if (!view)
255 return;
256
257 // Execute
258 CefViewDelegateCppToC::Get(self)->OnBlur(CefViewCToCpp::Wrap(view));
259 }
260
261 } // namespace
262
263 // CONSTRUCTOR - Do not edit by hand.
264
CefViewDelegateCppToC()265 CefViewDelegateCppToC::CefViewDelegateCppToC() {
266 GetStruct()->get_preferred_size = view_delegate_get_preferred_size;
267 GetStruct()->get_minimum_size = view_delegate_get_minimum_size;
268 GetStruct()->get_maximum_size = view_delegate_get_maximum_size;
269 GetStruct()->get_height_for_width = view_delegate_get_height_for_width;
270 GetStruct()->on_parent_view_changed = view_delegate_on_parent_view_changed;
271 GetStruct()->on_child_view_changed = view_delegate_on_child_view_changed;
272 GetStruct()->on_window_changed = view_delegate_on_window_changed;
273 GetStruct()->on_layout_changed = view_delegate_on_layout_changed;
274 GetStruct()->on_focus = view_delegate_on_focus;
275 GetStruct()->on_blur = view_delegate_on_blur;
276 }
277
278 // DESTRUCTOR - Do not edit by hand.
279
~CefViewDelegateCppToC()280 CefViewDelegateCppToC::~CefViewDelegateCppToC() {
281 shutdown_checker::AssertNotShutdown();
282 }
283
284 template <>
285 CefRefPtr<CefViewDelegate> CefCppToCRefCounted<
286 CefViewDelegateCppToC,
287 CefViewDelegate,
UnwrapDerived(CefWrapperType type,cef_view_delegate_t * s)288 cef_view_delegate_t>::UnwrapDerived(CefWrapperType type,
289 cef_view_delegate_t* s) {
290 if (type == WT_BROWSER_VIEW_DELEGATE) {
291 return CefBrowserViewDelegateCppToC::Unwrap(
292 reinterpret_cast<cef_browser_view_delegate_t*>(s));
293 }
294 if (type == WT_BUTTON_DELEGATE) {
295 return CefButtonDelegateCppToC::Unwrap(
296 reinterpret_cast<cef_button_delegate_t*>(s));
297 }
298 if (type == WT_MENU_BUTTON_DELEGATE) {
299 return CefMenuButtonDelegateCppToC::Unwrap(
300 reinterpret_cast<cef_menu_button_delegate_t*>(s));
301 }
302 if (type == WT_PANEL_DELEGATE) {
303 return CefPanelDelegateCppToC::Unwrap(
304 reinterpret_cast<cef_panel_delegate_t*>(s));
305 }
306 if (type == WT_TEXTFIELD_DELEGATE) {
307 return CefTextfieldDelegateCppToC::Unwrap(
308 reinterpret_cast<cef_textfield_delegate_t*>(s));
309 }
310 if (type == WT_WINDOW_DELEGATE) {
311 return CefWindowDelegateCppToC::Unwrap(
312 reinterpret_cast<cef_window_delegate_t*>(s));
313 }
314 NOTREACHED() << "Unexpected class type: " << type;
315 return nullptr;
316 }
317
318 template <>
319 CefWrapperType CefCppToCRefCounted<CefViewDelegateCppToC,
320 CefViewDelegate,
321 cef_view_delegate_t>::kWrapperType =
322 WT_VIEW_DELEGATE;
323