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