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=269173ab9f81796dec4b732e2050e26a177d8387$
13 //
14
15 #include "libcef_dll/cpptoc/views/menu_button_delegate_cpptoc.h"
16 #include "libcef_dll/ctocpp/views/button_ctocpp.h"
17 #include "libcef_dll/ctocpp/views/menu_button_ctocpp.h"
18 #include "libcef_dll/ctocpp/views/menu_button_pressed_lock_ctocpp.h"
19 #include "libcef_dll/ctocpp/views/view_ctocpp.h"
20 #include "libcef_dll/shutdown_checker.h"
21
22 namespace {
23
24 // MEMBER FUNCTIONS - Body may be edited by hand.
25
menu_button_delegate_on_menu_button_pressed(struct _cef_menu_button_delegate_t * self,cef_menu_button_t * menu_button,const cef_point_t * screen_point,cef_menu_button_pressed_lock_t * button_pressed_lock)26 void CEF_CALLBACK menu_button_delegate_on_menu_button_pressed(
27 struct _cef_menu_button_delegate_t* self,
28 cef_menu_button_t* menu_button,
29 const cef_point_t* screen_point,
30 cef_menu_button_pressed_lock_t* button_pressed_lock) {
31 shutdown_checker::AssertNotShutdown();
32
33 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
34
35 DCHECK(self);
36 if (!self)
37 return;
38 // Verify param: menu_button; type: refptr_diff
39 DCHECK(menu_button);
40 if (!menu_button)
41 return;
42 // Verify param: screen_point; type: simple_byref_const
43 DCHECK(screen_point);
44 if (!screen_point)
45 return;
46 // Verify param: button_pressed_lock; type: refptr_diff
47 DCHECK(button_pressed_lock);
48 if (!button_pressed_lock)
49 return;
50
51 // Translate param: screen_point; type: simple_byref_const
52 CefPoint screen_pointVal = screen_point ? *screen_point : CefPoint();
53
54 // Execute
55 CefMenuButtonDelegateCppToC::Get(self)->OnMenuButtonPressed(
56 CefMenuButtonCToCpp::Wrap(menu_button), screen_pointVal,
57 CefMenuButtonPressedLockCToCpp::Wrap(button_pressed_lock));
58 }
59
60 void CEF_CALLBACK
menu_button_delegate_on_button_pressed(struct _cef_button_delegate_t * self,cef_button_t * button)61 menu_button_delegate_on_button_pressed(struct _cef_button_delegate_t* self,
62 cef_button_t* button) {
63 shutdown_checker::AssertNotShutdown();
64
65 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
66
67 DCHECK(self);
68 if (!self)
69 return;
70 // Verify param: button; type: refptr_diff
71 DCHECK(button);
72 if (!button)
73 return;
74
75 // Execute
76 CefMenuButtonDelegateCppToC::Get(
77 reinterpret_cast<cef_menu_button_delegate_t*>(self))
78 ->OnButtonPressed(CefButtonCToCpp::Wrap(button));
79 }
80
menu_button_delegate_on_button_state_changed(struct _cef_button_delegate_t * self,cef_button_t * button)81 void CEF_CALLBACK menu_button_delegate_on_button_state_changed(
82 struct _cef_button_delegate_t* self,
83 cef_button_t* button) {
84 shutdown_checker::AssertNotShutdown();
85
86 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
87
88 DCHECK(self);
89 if (!self)
90 return;
91 // Verify param: button; type: refptr_diff
92 DCHECK(button);
93 if (!button)
94 return;
95
96 // Execute
97 CefMenuButtonDelegateCppToC::Get(
98 reinterpret_cast<cef_menu_button_delegate_t*>(self))
99 ->OnButtonStateChanged(CefButtonCToCpp::Wrap(button));
100 }
101
102 cef_size_t CEF_CALLBACK
menu_button_delegate_get_preferred_size(struct _cef_view_delegate_t * self,cef_view_t * view)103 menu_button_delegate_get_preferred_size(struct _cef_view_delegate_t* self,
104 cef_view_t* view) {
105 shutdown_checker::AssertNotShutdown();
106
107 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
108
109 DCHECK(self);
110 if (!self)
111 return CefSize();
112 // Verify param: view; type: refptr_diff
113 DCHECK(view);
114 if (!view)
115 return CefSize();
116
117 // Execute
118 cef_size_t _retval = CefMenuButtonDelegateCppToC::Get(
119 reinterpret_cast<cef_menu_button_delegate_t*>(self))
120 ->GetPreferredSize(CefViewCToCpp::Wrap(view));
121
122 // Return type: simple
123 return _retval;
124 }
125
126 cef_size_t CEF_CALLBACK
menu_button_delegate_get_minimum_size(struct _cef_view_delegate_t * self,cef_view_t * view)127 menu_button_delegate_get_minimum_size(struct _cef_view_delegate_t* self,
128 cef_view_t* view) {
129 shutdown_checker::AssertNotShutdown();
130
131 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
132
133 DCHECK(self);
134 if (!self)
135 return CefSize();
136 // Verify param: view; type: refptr_diff
137 DCHECK(view);
138 if (!view)
139 return CefSize();
140
141 // Execute
142 cef_size_t _retval = CefMenuButtonDelegateCppToC::Get(
143 reinterpret_cast<cef_menu_button_delegate_t*>(self))
144 ->GetMinimumSize(CefViewCToCpp::Wrap(view));
145
146 // Return type: simple
147 return _retval;
148 }
149
150 cef_size_t CEF_CALLBACK
menu_button_delegate_get_maximum_size(struct _cef_view_delegate_t * self,cef_view_t * view)151 menu_button_delegate_get_maximum_size(struct _cef_view_delegate_t* self,
152 cef_view_t* view) {
153 shutdown_checker::AssertNotShutdown();
154
155 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
156
157 DCHECK(self);
158 if (!self)
159 return CefSize();
160 // Verify param: view; type: refptr_diff
161 DCHECK(view);
162 if (!view)
163 return CefSize();
164
165 // Execute
166 cef_size_t _retval = CefMenuButtonDelegateCppToC::Get(
167 reinterpret_cast<cef_menu_button_delegate_t*>(self))
168 ->GetMaximumSize(CefViewCToCpp::Wrap(view));
169
170 // Return type: simple
171 return _retval;
172 }
173
174 int CEF_CALLBACK
menu_button_delegate_get_height_for_width(struct _cef_view_delegate_t * self,cef_view_t * view,int width)175 menu_button_delegate_get_height_for_width(struct _cef_view_delegate_t* self,
176 cef_view_t* view,
177 int width) {
178 shutdown_checker::AssertNotShutdown();
179
180 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
181
182 DCHECK(self);
183 if (!self)
184 return 0;
185 // Verify param: view; type: refptr_diff
186 DCHECK(view);
187 if (!view)
188 return 0;
189
190 // Execute
191 int _retval = CefMenuButtonDelegateCppToC::Get(
192 reinterpret_cast<cef_menu_button_delegate_t*>(self))
193 ->GetHeightForWidth(CefViewCToCpp::Wrap(view), width);
194
195 // Return type: simple
196 return _retval;
197 }
198
199 void CEF_CALLBACK
menu_button_delegate_on_parent_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * parent)200 menu_button_delegate_on_parent_view_changed(struct _cef_view_delegate_t* self,
201 cef_view_t* view,
202 int added,
203 cef_view_t* parent) {
204 shutdown_checker::AssertNotShutdown();
205
206 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
207
208 DCHECK(self);
209 if (!self)
210 return;
211 // Verify param: view; type: refptr_diff
212 DCHECK(view);
213 if (!view)
214 return;
215 // Verify param: parent; type: refptr_diff
216 DCHECK(parent);
217 if (!parent)
218 return;
219
220 // Execute
221 CefMenuButtonDelegateCppToC::Get(
222 reinterpret_cast<cef_menu_button_delegate_t*>(self))
223 ->OnParentViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
224 CefViewCToCpp::Wrap(parent));
225 }
226
227 void CEF_CALLBACK
menu_button_delegate_on_child_view_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added,cef_view_t * child)228 menu_button_delegate_on_child_view_changed(struct _cef_view_delegate_t* self,
229 cef_view_t* view,
230 int added,
231 cef_view_t* child) {
232 shutdown_checker::AssertNotShutdown();
233
234 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
235
236 DCHECK(self);
237 if (!self)
238 return;
239 // Verify param: view; type: refptr_diff
240 DCHECK(view);
241 if (!view)
242 return;
243 // Verify param: child; type: refptr_diff
244 DCHECK(child);
245 if (!child)
246 return;
247
248 // Execute
249 CefMenuButtonDelegateCppToC::Get(
250 reinterpret_cast<cef_menu_button_delegate_t*>(self))
251 ->OnChildViewChanged(CefViewCToCpp::Wrap(view), added ? true : false,
252 CefViewCToCpp::Wrap(child));
253 }
254
255 void CEF_CALLBACK
menu_button_delegate_on_window_changed(struct _cef_view_delegate_t * self,cef_view_t * view,int added)256 menu_button_delegate_on_window_changed(struct _cef_view_delegate_t* self,
257 cef_view_t* view,
258 int added) {
259 shutdown_checker::AssertNotShutdown();
260
261 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
262
263 DCHECK(self);
264 if (!self)
265 return;
266 // Verify param: view; type: refptr_diff
267 DCHECK(view);
268 if (!view)
269 return;
270
271 // Execute
272 CefMenuButtonDelegateCppToC::Get(
273 reinterpret_cast<cef_menu_button_delegate_t*>(self))
274 ->OnWindowChanged(CefViewCToCpp::Wrap(view), added ? true : false);
275 }
276
277 void CEF_CALLBACK
menu_button_delegate_on_layout_changed(struct _cef_view_delegate_t * self,cef_view_t * view,const cef_rect_t * new_bounds)278 menu_button_delegate_on_layout_changed(struct _cef_view_delegate_t* self,
279 cef_view_t* view,
280 const cef_rect_t* new_bounds) {
281 shutdown_checker::AssertNotShutdown();
282
283 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
284
285 DCHECK(self);
286 if (!self)
287 return;
288 // Verify param: view; type: refptr_diff
289 DCHECK(view);
290 if (!view)
291 return;
292 // Verify param: new_bounds; type: simple_byref_const
293 DCHECK(new_bounds);
294 if (!new_bounds)
295 return;
296
297 // Translate param: new_bounds; type: simple_byref_const
298 CefRect new_boundsVal = new_bounds ? *new_bounds : CefRect();
299
300 // Execute
301 CefMenuButtonDelegateCppToC::Get(
302 reinterpret_cast<cef_menu_button_delegate_t*>(self))
303 ->OnLayoutChanged(CefViewCToCpp::Wrap(view), new_boundsVal);
304 }
305
306 void CEF_CALLBACK
menu_button_delegate_on_focus(struct _cef_view_delegate_t * self,cef_view_t * view)307 menu_button_delegate_on_focus(struct _cef_view_delegate_t* self,
308 cef_view_t* view) {
309 shutdown_checker::AssertNotShutdown();
310
311 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
312
313 DCHECK(self);
314 if (!self)
315 return;
316 // Verify param: view; type: refptr_diff
317 DCHECK(view);
318 if (!view)
319 return;
320
321 // Execute
322 CefMenuButtonDelegateCppToC::Get(
323 reinterpret_cast<cef_menu_button_delegate_t*>(self))
324 ->OnFocus(CefViewCToCpp::Wrap(view));
325 }
326
327 void CEF_CALLBACK
menu_button_delegate_on_blur(struct _cef_view_delegate_t * self,cef_view_t * view)328 menu_button_delegate_on_blur(struct _cef_view_delegate_t* self,
329 cef_view_t* view) {
330 shutdown_checker::AssertNotShutdown();
331
332 // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
333
334 DCHECK(self);
335 if (!self)
336 return;
337 // Verify param: view; type: refptr_diff
338 DCHECK(view);
339 if (!view)
340 return;
341
342 // Execute
343 CefMenuButtonDelegateCppToC::Get(
344 reinterpret_cast<cef_menu_button_delegate_t*>(self))
345 ->OnBlur(CefViewCToCpp::Wrap(view));
346 }
347
348 } // namespace
349
350 // CONSTRUCTOR - Do not edit by hand.
351
CefMenuButtonDelegateCppToC()352 CefMenuButtonDelegateCppToC::CefMenuButtonDelegateCppToC() {
353 GetStruct()->on_menu_button_pressed =
354 menu_button_delegate_on_menu_button_pressed;
355 GetStruct()->base.on_button_pressed = menu_button_delegate_on_button_pressed;
356 GetStruct()->base.on_button_state_changed =
357 menu_button_delegate_on_button_state_changed;
358 GetStruct()->base.base.get_preferred_size =
359 menu_button_delegate_get_preferred_size;
360 GetStruct()->base.base.get_minimum_size =
361 menu_button_delegate_get_minimum_size;
362 GetStruct()->base.base.get_maximum_size =
363 menu_button_delegate_get_maximum_size;
364 GetStruct()->base.base.get_height_for_width =
365 menu_button_delegate_get_height_for_width;
366 GetStruct()->base.base.on_parent_view_changed =
367 menu_button_delegate_on_parent_view_changed;
368 GetStruct()->base.base.on_child_view_changed =
369 menu_button_delegate_on_child_view_changed;
370 GetStruct()->base.base.on_window_changed =
371 menu_button_delegate_on_window_changed;
372 GetStruct()->base.base.on_layout_changed =
373 menu_button_delegate_on_layout_changed;
374 GetStruct()->base.base.on_focus = menu_button_delegate_on_focus;
375 GetStruct()->base.base.on_blur = menu_button_delegate_on_blur;
376 }
377
378 // DESTRUCTOR - Do not edit by hand.
379
~CefMenuButtonDelegateCppToC()380 CefMenuButtonDelegateCppToC::~CefMenuButtonDelegateCppToC() {
381 shutdown_checker::AssertNotShutdown();
382 }
383
384 template <>
385 CefRefPtr<CefMenuButtonDelegate> CefCppToCRefCounted<
386 CefMenuButtonDelegateCppToC,
387 CefMenuButtonDelegate,
UnwrapDerived(CefWrapperType type,cef_menu_button_delegate_t * s)388 cef_menu_button_delegate_t>::UnwrapDerived(CefWrapperType type,
389 cef_menu_button_delegate_t* s) {
390 NOTREACHED() << "Unexpected class type: " << type;
391 return nullptr;
392 }
393
394 template <>
395 CefWrapperType CefCppToCRefCounted<CefMenuButtonDelegateCppToC,
396 CefMenuButtonDelegate,
397 cef_menu_button_delegate_t>::kWrapperType =
398 WT_MENU_BUTTON_DELEGATE;
399